Skip to content
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

pip-tools-workflow #9

dfee opened this issue Jun 30, 2017 · 4 comments

pip-tools-workflow #9

dfee opened this issue Jun 30, 2017 · 4 comments
blog comment Comments and feedback on articles


Copy link

dfee commented Jun 30, 2017

@jamescooke wanted to provide you with an updated copy of my makefile (for your use or others). ref

The modifications I've made allow one to compile requirements.txt files (specifically base.txt and test.txt in this case) so that they can be pip-installed from the project's root directory.

Like your structure, I have my req files in $PROJECT_ROOT/requirements/{*.in,*.txt}. However, these modifications are helpful so that I can:

  1. push my code to repo shared by a team, and
  2. use tox to install my requirements for me.
# From James Cooke's blog:
# "A successful pip-tools workflow for managing Python package requirements"
.PHONY: all check clean

RELATIVE_PROJECT_ROOT = .. # relative path to project's root
REQUIREMENTS_ROOT = $(shell realpath --relative-to $(PROJECT_ROOT) .)
objects = $(wildcard *.in)
outputs := $(

all: $(outputs)

        @pushd $(PROJECT_ROOT) > /dev/null; \
        pip-compile --output-file $(REQUIREMENTS_ROOT)/$@ $(REQUIREMENTS_ROOT)/$<; \
        popd > /dev/null; \
        sed -i '' "s|file://$(PROJECT_ROOT)|.|" $@

test.txt: base.txt

        @which pip-compile > /dev/null

clean: check
        - rm *.txt
@jamescooke jamescooke added the blog comment Comments and feedback on articles label Aug 23, 2018
Copy link

gsakkis commented Sep 15, 2019

@jamescooke @dfee I came across James' blog post which is pretty close to my desired workflow. The challenge I have at the moment is how to integrate it in a broader Makefile that also takes care of installing the (compiled via pip-compile) dependencies. I posted my question on StackOverflow, if you happen to have dealt with (or worked around) this issue it would be great to share it here and/or there.

Copy link

I've pinged you on the StackOverflow question 👍

Copy link

gsakkis commented Sep 16, 2019


Copy link

A cookiecutter template implementing this workflow is being developed at

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
blog comment Comments and feedback on articles
None yet

No branches or pull requests

4 participants