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

Modernise packaging configuration #1626

Merged
merged 13 commits into from
Oct 21, 2021

Conversation

joshuagl
Copy link
Member

@joshuagl joshuagl commented Oct 19, 2021

Please fill in the fields below to submit a pull request. The more information
that is provided, the better.

Fixes #1161

A grab-bag of modernisation in our packaging

Description of the changes being introduced by the pull request:

  • Move from invoking setup.py to build dists to instead using the build tool (adds pyproject.toml)
  • Move setuptools metadata from the dynamic setup.py file to setup.cfg (removes setup.py completely)
  • Add build and release dependencies to requirements-dev (build, wheel and twine packages)
  • Include documentation link in project_urls
  • update docs/RELEASE.md for packaging changes

Note: our sdist is effectively everything except the very few CI related files (.github/*, .fossa.yml, .readthedocs.yaml) – we could prune this back to be only the source we need to produce the wheel, but that is probably later work after we've cleaned up the documentation we keep in the repo (see #808)

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

@coveralls
Copy link

coveralls commented Oct 19, 2021

Pull Request Test Coverage Report for Build 1361060748

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+1.0%) to 98.35%

Totals Coverage Status
Change from base Build 1359563983: 1.0%
Covered Lines: 3703
Relevant Lines: 3731

💛 - Coveralls

@joshuagl joshuagl marked this pull request as ready for review October 20, 2021 10:56
@joshuagl
Copy link
Member Author

@sechkova you started looking into this in #1161, could you review the changes here?

@jku
Copy link
Member

jku commented Oct 21, 2021

oops, with-sslib-master uses python3.x and failure means whole build failure... and github seems to have switched to 3.10 by default. #1628 should fix the immediate issue

I think having a build that uses default python is good, but whether with-sslib-master should break build is debatable

This is the PyPA recommend tool for building Python packages:
https://packaging.python.org/guides/distributing-packages-using-setuptools/

Furthermore, direct invocation of setup.py is long ago deprecated:
https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html

Signed-off-by: Joshua Lock <jlock@vmware.com>
build, twine and wheel packages should all be installed in order to be
able to build and release python-tuf -- add those dependencies to
requirements-dev.txt

Signed-off-by: Joshua Lock <jlock@vmware.com>
* List license files in a new metadata section
* Remove .travis.yml from check-manifest section's ignore entry

Signed-off-by: Joshua Lock <jlock@vmware.com>
Signed-off-by: Joshua Lock <jlock@vmware.com>
Update the MANIFEST.in to be explicit about what we choose to ship in our
sdist. This _does not_ result in any additional files being included in
our sdist, but does remove warnings from build.

Signed-off-by: Joshua Lock <jlock@vmware.com>
Invoking setup.py directly is deprecated, see:
https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html

Therefore:
* remove the executable bit from setup.py's permissions
* remove the shebang entry from setup.py
* update the comments in setup.py to recommend using build to create dists
  and pip to install them

Signed-off-by: Joshua Lock <jlock@vmware.com>
Add a 'Documentation' entry to project_urls pointing to our stable docs
on readthedocs.io. This will result in a 'Documentation' entry under the
'Project links' section on PyPI.

Signed-off-by: Joshua Lock <jlock@vmware.com>
This is preferred and removes the crutch of invoking setup.py as a CLI
tool for building dists.

Signed-off-by: Joshua Lock <jlock@vmware.com>
We now use a static setup.cfg instead, update __init__.py and
docs/RELEASE.md to point there.

Signed-off-by: Joshua Lock <jlock@vmware.com>
Signed-off-by: Joshua Lock <jlock@vmware.com>
Per PEP 517 the pyproject.toml file lists tools required when building the
project with build: https://pypa-build.readthedocs.io/en/stable/index.html

Signed-off-by: Joshua Lock <jlock@vmware.com>
Signed-off-by: Joshua Lock <jlock@vmware.com>
Our sdist has typically included everything from git apart from the CI
related files (.github/*, .fossa.yml, .readthedocs.yaml). Update our
MANIFEST.in and the check-manifest section of setup.cfg to be explicit
about this.

Signed-off-by: Joshua Lock <jlock@vmware.com>
Copy link
Contributor

@sechkova sechkova left a comment

Choose a reason for hiding this comment

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

The changes look good but there was one caveat that we've discussed in the initial issue related to editable installs (#1161 (comment)).
Unless it was resolved by now keeping a minimal setup.py may still be needed.

@joshuagl
Copy link
Member Author

Thanks for the review! I think that the issue was resolved. With pip 21.2.4 here I can pip install -e ~/Projects/python-tuf with the branch above.
Out Tox configuration also installs python-tuf in editable mode without failures in CI.

@sechkova
Copy link
Contributor

Thanks for the review! I think that the issue was resolved. With pip 21.2.4 here I can pip install -e ~/Projects/python-tuf with the branch above.
Out Tox configuration also installs python-tuf in editable mode without failures in CI.

Got it, my pip version seems to be older!

@joshuagl joshuagl merged commit 6d18d53 into theupdateframework:develop Oct 21, 2021
@joshuagl joshuagl deleted the joshuagl/build branch October 21, 2021 21:05
@lukpueh lukpueh mentioned this pull request Dec 13, 2021
lukpueh added a commit to lukpueh/tuf that referenced this pull request Aug 30, 2022
setup.py was removed in favor of setup.cfg in theupdateframework#1626 and re-added
later in theupdateframework#1832 to work around a Dependabot issue theupdateframework#1828. This issue
seems to have been fixed upstream in dependabot/dependabot-core#5392.

Fixes theupdateframework#2089

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
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.

Modernise and rationalise packaging
4 participants