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

Replace setuptools with Poetry #975

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

lafrenierejm
Copy link
Contributor

@lafrenierejm lafrenierejm commented Oct 23, 2022

Description of Change

Intended to obsolete #835. This PR fixes tests and CI that are (as best as I can tell as of this writing) broken in #835.

Assumptions

Compared to the existing build system using setuptools and Pipfile, Poetry makes it easier to

  • Make builds fully reproducible (especially in e.g. CI) by automating the update of the lock file.
  • Ensure that pinned versions of botocore, boto3, and awscli are compatible.

Checklist for All Submissions

  • (NA) I have added change info to CHANGES.rst
  • (NA) If this is resolving an issue (needed so future developers can determine if change is still necessary and under what conditions) (can be provided via link to issue with these details):
    • Detailed description of issue
    • Alternative methods considered (if any)
    • How issue is being resolved
    • How issue can be reproduced
  • (NA) If this is providing a new feature (can be provided via link to issue with these details):
    • Detailed description of new feature
    • Why needed
    • Alternatives methods considered (if any)

Checklist when updating botocore and/or aiohttp versions

  • I have read and followed CONTRIBUTING.rst
  • I have updated test_patches.py where/if appropriate (also check if no changes necessary)
  • (NA) I have ensured that the awscli/boto3 versions match the updated botocore version

Darren Weber and others added 4 commits October 16, 2022 15:23
- poetry manages all aspects of project
  metadata and dependencies in pyproject.toml
- Pipfile is obsolete
- setup.py is obsolete
- project might only support python >=3.7,<4.0 now?
  - tests will not run in python 3.6.x
  - contributions require python 3.8
Poetry's dependency resolution will ensure that all packages are compatible.
@codecov
Copy link

codecov bot commented Oct 23, 2022

Codecov Report

Merging #975 (caf724d) into master (551343c) will decrease coverage by 0.17%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master     #975      +/-   ##
==========================================
- Coverage   84.98%   84.81%   -0.18%     
==========================================
  Files          50       50              
  Lines        4529     4464      -65     
==========================================
- Hits         3849     3786      -63     
+ Misses        680      678       -2     
Flag Coverage Δ
unittests 84.81% <ø> (-0.18%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
tests/test_version.py 97.56% <ø> (+0.39%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@lgtm-com
Copy link

lgtm-com bot commented Oct 23, 2022

This pull request fixes 8 alerts when merging ebc5ce5 into 551343c - view on LGTM.com

fixed alerts:

  • 5 for Missing call to `__init__` during object initialization
  • 2 for Module is imported with 'import' and 'import from'
  • 1 for `__eq__` not overridden when adding attributes

pipenv sync --dev
pipenv check || true
pipenv graph
curl -sSL https://install.python-poetry.org/ | python -
Copy link
Contributor

Choose a reason for hiding this comment

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

You can also install poetry using pip on the line below 👍🏻

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Implemented in lafrenierejm@caf724d.

Copy link
Contributor

@Fokko Fokko left a comment

Choose a reason for hiding this comment

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

Looks good! I'm a big fan of Poetry, but it is up to the maintainer to decide since it also impacts the release process.

@lafrenierejm
Copy link
Contributor Author

@thehesiod Any opinions on these changes?

@thehesiod
Copy link
Collaborator

@lafrenierejm cool! we finally bumped, could you merge/re-base. Also how does this solution guarantee that each PR has a correct boto3/awscli match to the botocore version? Wouldn't you need to re-lock each time? I would think we shouldn't have a lockfile checked in in that case.

@thehesiod thehesiod mentioned this pull request Jul 7, 2023
@hartungstenio
Copy link

If we are to change tools, maybe we should look at tools that support PEP 621. There are notable examples in the "PEP 517 ecosystem", like:

  • PDM, which supports lock file and reproducible builds, and seem to have better dependency resolution than poetry
  • Hatch, which have a great support for plugins. One good example is hatch-vcs, a plugin able to use the current git tag as the version package metadata, and automatically update the __version__ variable in __init__.py.

@thehesiod
Copy link
Collaborator

cool thanks for the tips, worthy conversation

@takeda
Copy link
Contributor

takeda commented Oct 7, 2023

@lafrenierejm cool! we finally bumped, could you merge/re-base. Also how does this solution guarantee that each PR has a correct boto3/awscli match to the botocore version? Wouldn't you need to re-lock each time? I would think we shouldn't have a lockfile checked in in that case.

So the match is enforced via the versions provided in pyproject.toml if you specify exact version then aiobotocore will require it. Since your code is a package not an application. The lock file is not relevant when uploading the package to PyPI.

The poetry.lock is still useful for development, as it pins all of the lose versions specified in pyproject.toml to specific ones. It is essentially doing the same thing as when you run pip-compile requirements-dev.in

After trying to contribute a PR I think switching from setuptools to poetry would simplify development.

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.

None yet

5 participants