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
How to handle production only dependencies. psycopg2 #1264
Comments
@autoferrit you could make use of extras as a potential solution for your scenario. poetry add --dev psycopg2-binary
poetry add --extras=production psycopg2 And when installing in your production environment, you can do the following. # if installing from a package index
pip install somepackge[production]
# if installing from source
poetry install --no-dev --extras=production somepackage However, this means that if installed without extras your package/application may not work as expected. An operation solution might be better for your particular case of using psycopg2. For example, using a private index (nexus etc.) that has a securely built psycopg2-binary wheel; or you can consider pre-creating a virtual environment and installing psycopg2-binary prior to using EDIT: Just realised that this might not solve your particular issue as poetry installs optional packages too when installing in editable mode. |
Yea that doesn't really solve the issue. Really, normal deps would only be installed in production mode. and dev deps would only be installed in development. Dev deps would also have everything in the production deps as well. |
@autoferrit It's not clear to me -- are you just trying to find a solution that will work, or are you asking for a "clean" solution? Given the lack of support for Some less "clean" approaches that could also work if you are willing to go off the beaten path a little:
|
For now as a workaround, I am using the extras method mentioned by @abn above. both are marked optional and locally I do |
This is essentially a duplicate of #1007, and for the sake of maintaining some semblance of sanity in this repository, I humbly recommend that this issue be closed. 😊 |
#1007 is about having more environments. I still just want to use the ones i have. As it stands, passing the If I can specify a ENV var to specify which |
Here is yet another use case: [tool.poetry.dependencies]
...
dodoo = "^2.0" # Use from package mgt
[tool.poetry.dev-dependencies]
...
dodoo = {path = "../dodoo"} From a UX perspectve, maybe the
Please no workarounds, this is a genuine and valid use case of it's own! |
Closing this for now. there are other issues tracking the preferred methods. And for now using the |
I hit the same issue, albeit for a different use case. (Or maybe it's really the same use case, but we describe it differently.) – Here it goes: For local development I use This is a perfect setup for working with tools like Poetry seems to work differently. It fails, like above, because I don't have the database client libraries (and headers) installed. This makes it impossible for me to use Poetry. It doesn't support my usual development workflow. – And it's not an unusual workflow, is it? |
While exporting the dependencies the dodoo will come with path instead of version, do we have any solution for that issue? |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Question
One issue with poetry, which also is a problem in something like Pipenv, are dependencies that should only be installed on production. In my case, this is psycopg2. When doing development/testing, it is easy enough to install
psycopg2-binary
under[tool.poetry.dev-dependencies]
but the problem is, that the normal dependencies are not "production only". They are "all environemnts". So if I have:I still get the following error when installing on my local machine, where postgres is not installed.
So i can't leave
psycopg2
to only be installed on production and the binary version otherwise. How should I handle this? Others have asked to have aprod-dependencies
or something similar. But it doesnt seem like that will ever happen. Nor in Pipenv.How should I make this work? Assuming both environments are on linux.
The text was updated successfully, but these errors were encountered: