-
Notifications
You must be signed in to change notification settings - Fork 96
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
Migrate tool settings from setup.cfg to pyproject.toml #363
base: master
Are you sure you want to change the base?
Conversation
This also requires additional exclusions or pytype will get confused
... and delete setup.cfg
Because we no longer have `setup.py` Also add one line to ensure the latest version of pip and setuptools
echo "Running flake8 ... there will be no output if no errors:" | ||
python -m flake8 aiosmtpd housekeep.py release.py | ||
echo "flake8 done." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added just to ensure that flake8 actually runs. flake8's silence on no error sometimes make me wonder if it ran or not 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW it's quite common to wrap linters with the pre-commit.com too.
@@ -28,8 +28,12 @@ | |||
f"dist/aiosmtpd-{ver_str}-py3-none-any.whl", | |||
] | |||
|
|||
RELEASE_TOOLKIT = ["setuptools", "wheel", "twine", "build"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
build
is the new build system created by PyPA that supports PEP 517.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. You need build
for making dists and twine
for linting them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, PyPI no longer supports GPG. It's possible to use Sigstore, though.
My PyPUG article has an example of that: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RELEASE_TOOLKIT = ["setuptools", "wheel", "twine", "build"] | |
RELEASE_TOOLKIT = ["build", "twine"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments
Codecov Report
@@ Coverage Diff @@
## master #363 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 7 7
Lines 1706 1706
Branches 310 310
=========================================
Hits 1706 1706
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aaaawesome! A few bits of feedback - not sure if anything really needs to change...
@@ -38,7 +36,7 @@ jobs: | |||
# language=bash | |||
run: | | |||
python -m pip install --upgrade pip setuptools wheel | |||
python setup.py develop | |||
python -m pip install . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should that be install -e .?
that's more equivalent to develop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe? Ahaha this "install using pyproject.toml" is so new to me 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, -e
would be the direct equivalent.
@@ -110,7 +112,7 @@ jobs: | |||
# Test deps | |||
pip install colorama "coverage>=7.0.1" coverage[toml] "coverage-conditional-plugin>=0.5.0" packaging pytest pytest-cov pytest-mock | |||
# Package deps | |||
python setup.py develop | |||
python -m pip install . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question here, -e?
|
||
$ python3 -m venv /path/to/venv | ||
$ source /path/to/venv/bin/activate | ||
$ python setup.py install | ||
$ python -m pip install -U pip setuptools | ||
$ python -m pip install . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think here we should definitely recommend editable mode, if we're suggesting folks clone flr dev. Otherwise they can just install from pypi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as before. Let me do some study / experiments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pepoluan feel free to ask me if you have questions about Python packaging. I maintain PyPUG.
dependencies = [ | ||
"atpublic", | ||
"attrs", | ||
"typing-extensions ; python_version < '3.8'", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are typing extensions require to run aiosmtpd?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iirc it's to implement Protocol, I think that's in the Tproxy code.
Not really sure if that's actually needed to just run ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming that it's not needed for running we can put it in an extras_require
(yeah, not extra_requires) section. I'm not sure what the precise form is for that, tho.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that were true, it should be here, not in extras. FWIW it's only used in tests:
aiosmtpd/aiosmtpd/tests/test_handlers.py
Line 30 in abadbd4
from typing_extensions import Protocol |
@pepoluan FYI I'm still super interested in this getting in. There is a merge conflict in |
# region #### setuptools settings ########## | ||
|
||
[tool.setuptools] | ||
zip-safe = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it unsafe?
What do these changes do?
Practically all still-maintained projects are migrating to have a Single Source of Truth for their builds:
pyproject.toml
This is in accordance with the guidelines in PEP518 and PEP621.
I have ascertained that all tools
aiosmtpd
uses -- both as dependency or for development -- now have support for putting their configuration inpyproject.toml
(some needs a bit of workaround but works well). This left us with an emptysetup.cfg
file, which I removed because it's no longer useful (all setup information is now inpyproject.toml
as well).Are there changes in behavior for the user?
None if user has the latest
pip
andsetuptools
.Related issue number
None.
Checklist
NEWS.rst
file