-
Notifications
You must be signed in to change notification settings - Fork 16
Conversation
I've marked this ready for review. I'm particularly hoping @kushaldas can take a look and weigh in on the |
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 would prefer to store the pyproject.toml
in a different directory, or else we may again get stuck during packaging time.
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.
All looks good, but the final test step is not working for me. @rmol can you please tell me if I am missing something.
securedrop-sdk on black-isort [?] via 🐍 v3.7.3 (.venv) took 36s
❯ git log -1
commit e83ebfe79405fdca80ae5952f413c7cb9866129a (HEAD -> black-isort, origin/black-isort)
Author: John Hensley <john@freedom.press>
Date: Thu Jun 4 16:17:54 2020 -0400
Add .git-blame-ignore-revs
securedrop-sdk on black-isort [?] via 🐍 v3.7.3 (.venv)
❯ git config blame.ignoreRevsFile .git-blame-ignore-revs
securedrop-sdk on black-isort [?] via 🐍 v3.7.3 (.venv)
❯ git config blame.markIgnoredLines true
securedrop-sdk on black-isort [?] via 🐍 v3.7.3 (.venv)
❯ git config blame.markUnblamableLines true
securedrop-sdk on black-isort [?] via 🐍 v3.7.3 (.venv)
❯ git blame -e sdclientapi/__init__.py | head -21 | grep -c john@freedom.press
7
securedrop-sdk on black-isort [?] via 🐍 v3.7.3 (.venv)
❯ git version
git version 2.20.1
@kushaldas Yeah, the git blame options to ignore revisions weren't added until git version 2.23. Can you explain the packaging problems the default location causes? As far as I can see, the problems pip and setuptools had when the presence of I want to avoid requiring extra work for contributors to be able to run our formatting tools so that CI lint jobs pass. |
Ah yes, I wrote the other patch in a different box :)
|
@kushaldas I tried adding
It's looking for setuptools on our PyPI mirror and can't find it, because we're not hosting it. I think this is probably something we should fix in our packaging logic or infrastructure, instead of placing pyproject.toml in a nonstandard location, but I'll dig into it a bit more tomorrow. |
You will have to modify the scripts to disable the signing checks and test against a local server to verify if things are okay. |
I set up a local PyPI mirror with fallback to pypi.org, and the client package built successfully, suggesting that we can use the standard |
It turns out that the presence of a So we don't need to add anything to our PyPI, we just need to add https://pip.pypa.io/en/stable/reference/pip/#pep-517-and-518-support |
Add black and isort to dev requirements. Add Makefile targets for both checking and applying them, and make those part of "make check". Remove unused Sphinx requirement. Add pyproject.toml with configuration for both black and isort.
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.
This is good, thank you.
Resolves #123
Adds the black and isort tools to the development requirements, and adds Makefile targets for both checking and applying them.
Removes the apparently unused Sphinx requirement, which would otherwise need to be upgraded to address a jQuery security problem.
I'm configuring both black and isort in
pyproject.toml
, in the repo root, because according to PEP 517, "If the pyproject.toml file is absent, or the build-backend key is missing, the source tree is not using this specification, and tools should revert to the legacy behaviour of running setup.py (either directly, or by implicitly invoking thesetuptools.build_meta:__legacy__ backend
)."The configuration is using Black's suggested isort settings for compatibility, as well as an additional isort setting that will appear in an upcoming release.
Testing
black-isort
withgit checkout 24dc1ea
make check-isort
. It should show the changes it would make.make check-black
. It should show the changes it would make.git checkout black-isort
make check-isort
andmake check-black
. No changes should be indicated.git blame sdclientapi/__init__.py | head -21 | grep -c a31be70d
. There should be seven lines attributed to that revision.git config blame.ignoreRevsFile .git-blame-ignore-revs
git config blame.markIgnoredLines true
git config blame.markUnblamableLines true
git blame sdclientapi/__init__.py | head -21 | grep -c a31be70d
. There should no lines attributed to a31be70, now that the formatting revision is being ignored.