Feature Request: poetry deploy
See original GitHub issue- I have searched the issues of this repo and believe that this is not a duplicate.
poetry deploy
What I am looking for is a way to generate a poetry.lock
and my project wheel and then deploy them without needing to have any of the source/pyproject.tom
or anything else available. Preferably into a venv
of my choosing, or a default created one.
Running poetry build
with a --with-lock
that copies the existing poetry.lock
, renames it to be versioned and adds the hash for the newly built wheel, and then places that in the dist
folder.
Then when a user wants to deploy, they specifically do:
poetry deploy myapp-0.1.0-poetry.lock
And poetry
would create a new virtualenv (or update it) and installs the application with the locked dependencies, verifying the wheel file (which has to exist in the same folder as the lock file, or maybe add a --wheel-path
to allow an alternate location to find wheels, default to next to .lock fall back to PyPI).
Either way, the end result should be a virtualenv that has all of the dependencies + package installed as set in the lock file without needing to have the source code available.
This would be great for doing deployments inside of Docker containers, or Heroku build-packs so that you don’t need to ship the full source, just the lock file and a wheel.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:62
- Comments:14 (2 by maintainers)
Top GitHub Comments
The
bundle
command mentioned by @hynek is definitely on my radar but will likely be implemented after the1.0
release.The lack of something like this is pretty much the only reason I cannot put poetry into production.
As of now, if you’re in an activated virtualenv and call
poetry install
, it does exactly what you want to.However it’s impossible to pass it as a parameter or env variable which is a problem on build servers.
A cheap win would be something like
TARGET_VENV=/app poetry install
but I understand that that’s rather clunky, especially in the context of the whole design.I kinda like the idea of
poetry deploy
but I’d rather call itpoetry bundle
or something like that and make it pluggable. Imagine being able to call:poetry bundle --type venv /app
orpoetry bundle --type shiv Fooo.shiv
or evenpoetry bundle --type pyinstaller Foo.exe
– what do I know. There’s many ways to bundle a Python application.P.S. requirements.txt exports are a thing as of #675 but since I’d want to go all-in on poetry it means I have not setup.py so it doesn’t help me when deploying.