Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] tuf-client as a standalone installation #1221

Closed
wants to merge 3 commits into from

Conversation

sechkova
Copy link
Contributor

@sechkova sechkova commented Nov 24, 2020

Fixes #1181

Description of the changes being introduced by the pull request:

This is a WIP trying to identify whether splitting the client and repository code and maintaining a client as
a separate installation (in a client branch for now) will be useful for client side users of tuf (e.g. pip) as well as for providing some kind of support for older versions.

Up to now I have only removed the pure repository code and generated a tuf-client distribution.
This only reduces the lines of code while the dependencies remain the same, since client and repository share all dependencies (see comment). Client even upgrades them with requests.

I added one dummy test simply calling updater.refresh without using the repository code.

Please give me your opinion on:

  • Does this even make sense?
  • Did I get the idea right?
  • Is this bringing a significant value given the effort to rewrite the test suite?
  • If all of the above is yes, should we continue with fixing all tests and the configuration?

Please verify and check that the pull request fulfills the following
requirements
:

  • The code follows the Code Style Guidelines
  • Tests have been added for the bug fix or new feature
  • Docs have been added for the bug fix or new feature

Modify setup.py with tuf-client information

Signed-off-by: Teodora Sechkova <[email protected]>
Split TUF in client and repository side: remove repository-only
source code.

Signed-off-by: Teodora Sechkova <[email protected]>
Create a dummy test without using repository_tool and repository_lib
functionality.

test_api is used as an example for test SetUp and TearDown.

Signed-off-by: Teodora Sechkova <[email protected]>
@sechkova
Copy link
Contributor Author

In case I have successfully regenerated requirements-pinned.txt following the guidelines in requirements.txt, the resulting diff is only in version numbers:

diff --git a/requirements-pinned.txt b/requirements-pinned.txt
index 848e99a8..48e73a38 100644
--- a/requirements-pinned.txt
+++ b/requirements-pinned.txt
@@ -1,14 +1,14 @@
-certifi==2020.6.20       # via requests
+certifi==2020.11.8        # via requests
 cffi==1.14.3              # via cryptography, pynacl
 chardet==3.0.4            # via requests
-cryptography==3.2.1         # via securesystemslib
-enum34==1.1.6             ; python_version < '3' # via cryptography
-idna==2.10                 # via requests
-ipaddress==1.0.23         ; python_version < '3' # via cryptography
+cryptography==3.2.1       # via securesystemslib
+enum34==1.1.10            # via cryptography
+idna==2.10                # via requests
+ipaddress==1.0.23         # via cryptography
 pycparser==2.20           # via cffi
 pynacl==1.4.0             # via securesystemslib
-requests==2.25.0
-securesystemslib[crypto,pynacl]==0.18.0
-six==1.15.0
-subprocess32==3.5.4       ; python_version < '3' # via securesystemslib
+requests==2.25.0          # via -r requirements.txt
+securesystemslib[crypto,pynacl]==0.18.0  # via -r requirements.txt
+six==1.15.0               # via -r requirements.txt, cryptography, pynacl, securesystemslib
+subprocess32==3.5.4       # via securesystemslib
 urllib3==1.26.2           # via requests

Copy link
Member

@joshuagl joshuagl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for taking a stab at this @sechkova! 🎉

My motivation for filing #1181 was the idea that an effort such as this might be useful:
a) for vendoring tuf into pip, to reduce the number of files and LOC added to that project (see pypa/pip#9041)
b) for theoretically providing an as small as possible base for interested parties to pick up if they want/need to continue to use tuf/client/updater.py on a version of the interpreter that will no longer be supported following the refactor towards 1.0 (i.e. 2.7)

I'll leave others to comment on whether they feel this work is worthwhile cc @lukpueh @trishankatdatadog @jku

@@ -124,7 +124,6 @@
],
packages = find_packages(exclude=['tests']),
scripts = [
'tuf/scripts/repo.py',
'tuf/scripts/client.py'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might as well scrap this, too. It's not useful for clients using updater.py

# Metadata role keys are needed by the test cases to make changes to the
# repository (e.g., adding a new target file to 'targets.json' and then
# requesting a refresh()).
self.role_keys = _load_role_keys(self.keystore_directory)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want/need this if we're not using repository_tool?

@sechkova
Copy link
Contributor Author

sechkova commented Dec 2, 2020

Change of heart!
@jku gave us convincing arguments about grouping repository/client/common code in a proper directory structure and packaging two separate repository/client distributions all in the current development branch.

I think this suggestion achieves the goals listed by Joshua:

My motivation for filing #1181 was the idea that an effort such as this might be useful:
a) for vendoring tuf into pip, to reduce the number of files and LOC added to that project (see pypa/pip#9041)
b) for theoretically providing an as small as possible base for interested parties to pick up if they want/need to continue to use tuf/client/updater.py on a version of the interpreter that will no longer be supported following the refactor towards 1.0 (i.e. 2.7)

while in addition:

  • no need to rewrite a big part of the test cases
  • no need to maintain common code in two places

As a drawback, one repository will host configuration for two packages. We can use the occasion to experiment with "modern packaging" #1161, however.

@sechkova
Copy link
Contributor Author

sechkova commented Dec 2, 2020

In case there are no objections on the proposal in the last comment, I will close this PR and reopen another one with the suggested approach.

@jku
Copy link
Member

jku commented Jul 19, 2021

Closing this based on last comment :)

@jku jku closed this Jul 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Identify components of client and determine how to split out client from current code base
3 participants