This PR allows to specify -f pip, which emits the PEP 508 compatible specifiers from pyproject.toml, but strips out ; extra == "foo" markers, allowing it to be used with pip -r.
This is e.g. useful in Dockerfiles, because as long as no dependencies change between rebuilds, the layers before COPY my_pkg /build/my_pkg can be reused!
FROM python:3.9-slim
# Install dependencies
RUN pip install beni
COPY pyproject.toml README.rst /build/
WORKDIR /build
RUN beni --deps=production -f pip pyproject.toml > requirements.txt
RUN pip install -r requirements.txt
RUN pip uninstall beni
# Install own package
COPY my_pkg /build/my_pkg # Code changes will reuse the layers above and start from here
RUN pip install . # This only installs my_pkg, no dependencies.
RUN rm -rf /build
WORKDIR /root
ENTRYPOINT python -m my_pkg
Alternatives
On the other hand, dephell already exists, so idk if we need to maintain this at all or just recommend dephell …
/edit: dephell crashes for me and has many more dependencies itself, so beni has worth as a lightweight alternative for flit!
This PR allows to specify
-f pip
, which emits the PEP 508 compatible specifiers frompyproject.toml
, but strips out; extra == "foo"
markers, allowing it to be used withpip -r
.This is e.g. useful in Dockerfiles, because as long as no dependencies change between rebuilds, the layers before
COPY my_pkg /build/my_pkg
can be reused!Alternatives
On the other hand, dephell already exists, so idk if we need to maintain this at all or just recommend dephell …
/edit: dephell crashes for me and has many more dependencies itself, so beni has worth as a lightweight alternative for flit!