-
Notifications
You must be signed in to change notification settings - Fork 9
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
Use poetry to lock dependencies #18
Conversation
Would you mind throwing in a recursive diff of the two sdists (poetry and current)? |
Description updated with a diff between |
Note that
Additionally, the contents of the (new) wheel are minimal:
|
For cross referencing, matrix-org/synapse#11537 |
Yep. Poetry 1.2 will stop generating setuptools stubs in sdists by default, now that support for PEP 517 builds is widespread. There's a |
Oh, I've just learned that |
I'm going to force push a simpler commit history. Apologies all, but I think it's more helpful than to see my works in progress. |
The manifest file has been replaced with `include` config. To check this was sensible, I compared the sdist on pypi against the sdist generated by `poetry build`. I adjusted the TOML config until the newer sdist matched the existing one. We don't commit the lockfile, because this is a library.
This was a good exercise, but I think sydent (being an application, not a library) makes for a better test bed. |
This set of changes
.gitignore
s poetry's lockfile. (signedjson
is a library---there is no fixed set of dependencies it ships with and we should not allow ourselves the luxury of thinking so!)setup.py build
can be replaced withpoetry build
.From the bigger picture, this is a practice run to let us
How to try this out
~/.poetry
.pip install --user poetry
.pipx install poetry
.which poetry
.cd
to this repository.poetry install
. This will create a virtualenv behind the scenes and populate it with the right packages.poetry env info
shows you which interpreter you're running, and the virtualenv locationpoetry run echo hello
poetry shell
.exit
or Ctrl-D effectively quits the venv, instead ofdeactivate
.poetry env --help
for details of how you can switch between different environments.direnv
I found it really pleasant to use
direnv
to automatically switch to/from the env as I navigated into/out of the directory. Needed some extra config to support poetry though, see here (which eventually made its way into the wiki). By the looks of it, this packages queries poetry to find out where the current venv is on disk, and appends itsbin
directory to your path. This doesn't seem to detect use ofpoetry env
to switch to another virtual environment within the project.What do the built packages look like?
We want to convince ourselves that poetry generates and equivalent sdist to setuptools. One can test as follows:
poetry build
. A wheel and sdist should be generated indist
.pushd dist; tar -xzf signedjson-1.1.1.tar.gz; popd;
curl https://files.pythonhosted.org/packages/dc/f2/2b3c5574ab77e086597cdc85781fa1d2ef1b4e55bd53d47308bbd2ad7596/signedjson-1.1.1.tar.gz > /tmp/signedjson-pypi.tar.gz
pushd /tmp; tar -zxf signedjson-pypi.tar.gz; popd
diff -ru /tmp/signedjson-1.1.1/ dist/signedjson-1.1.1 > diff.txt
Here's my diff.txt.
It's probably most instructive to see which files have been added and removed as follows:
This yields