-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Build and install the root package as a wheel in one invocation #1382
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Up. |
This is an important feature for multi-stage Docker builds. Multi-stage Docker builds for Python typically install the project into a virtualenv during the build stage, and then copy the virtualenv over into a slim final image. An editable install creates a .egg-link file that links to the source code, and this link would only be valid for the duration of the build stage. Currently my build stage installs projects by exporting from Poetry to pip: COPY pyproject.toml poetry.lock ./
RUN /root/.poetry/bin/poetry export -f requirements.txt | /venv/bin/pip install -r /dev/stdin
COPY . ./
RUN /root/.poetry/bin/poetry build && /venv/bin/pip install dist/*.whl The requested feature would allow us to use Poetry directly: COPY pyproject.toml poetry.lock ./
RUN /root/.poetry/bin/poetry install --no-root
COPY . ./
RUN /root/.poetry/bin/poetry install --no-editable |
I am using the exact same scenario as @cjolowicz but with the added configuration of a private PIP server. I cannot use the PIP_EXTRA_INDEX_URL due to security issues and have this configured via the pyproject.yml instead. Thus the solution is: RUN poetry install --no-dev
RUN rm .venv/lib/python3.7/site-packages/*.egg-link
RUN poetry build
RUN pip install dist/*.whl --target=.venv/lib/python3.7/site-packages/ --no-deps A |
@sdispater @finswimmer According to the number of thumbs up, this is an important feature. Being able to install projects in non editable mode is so important. Without this, we cannot use |
Currently the cleanest way I've found to do this is along the lines of python3 -m venv /venv && \
. /venv/bin/activate && \
poetry install -n --no-dev --no-root && \
poetry build -f wheel -n && \
pip install --no-deps dist/*.whl && \
rm -rf dist *.egg-info Adding this feature would cut the number of commands in half and I wouldn't have to worry about dist files getting left over in the event of a failure. Edit: Actually, I realized you can use |
This is also an issue with |
I'd like to see this feature for a reason I haven't seen enumerated yet. I can't validate my wheel has all the files I expect when I run my tests with my package in editable mode. Since the files will correctly be there locally, my tests pass, however it could very well be the case that I'm not including those files in my wheel meaning the package is broken. My solution would be that PR validation would install the package in non-editable mode. Today that's accomplished by building the wheel and installing that, but would lovee to see |
@thejcannon Isn't this exactly why tox exists? |
@finswimmer It may/may not be, but at this point I hope you aren't advocating for a testing solution that involves both |
Echoing this post -- today I couldn't figure out why my CI test for whether |
Any Update? |
@ShuzZzle: It is still in the To-do list: https://github.com/python-poetry/poetry/projects/3#card-31617262 |
@cjolowicz I agree. Moreover, this applies to the build process, CI/CD as well. @maggyero In PR I've implemented For add if I understand correctly Lastly, there is Have a good one! |
As @cjolowicz mentions, this feature is really essential for a cleanly working with multi-stage Docker builds purely within Poetry. If both this and venv path configuration were implemented (#1579), Poetry would have a super great story for Docker ❤️. Currently, it's a bit clunky to have to essentially shell out to the |
Closing this for now as covered by the https://github.com/python-poetry/poetry-plugin-bundle |
I don't think, that it should be designed as a plugin. Personally I was surprised,that it is not a core functionality of poetry. I suggest to reopen this issue =( |
@neersighted i don't believe the plugin you mentioned handles the case raised by this issue. python-poetry/poetry-plugin-bundle#37 (comment) |
Editable mode is orthogonal to whether installing a package and its deps into an environment (with the root in non-editable mode) is possible; indeed, that is what bundle currently does. You want it to grow a --no-editable or similar flag; your issue on the other repo is the correct place to track that. |
#1382 (comment) this workaround is great but I think it is a bug of |
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. |
@sdispater, in #730 you said:
Could you allow non-editable installations by adding a
--no-editable
command-line parameter for these three commands:poetry install --no-editable
poetry add --no-editable
poetry update --no-editable
The documentation states that it is already possible for local dependencies, but with a
develop
file parameter in thepyproject.toml
file:Here I think that a command-line parameter would be more appropriate than a file parameter, as it is something that you want to configure at the command-line level rather than at the project level (like with
pip
where sometimes you want to runpip install .
and sometimespip install -e .
). So if you could also drop thedevelop
file parameter that would be awesome.Being able to install projects in non-editable mode is so important, especially for deployment on servers. Currently we cannot use the
poetry install
command exclusively for such installations, we still have to resort to thepip install
command.The text was updated successfully, but these errors were encountered: