3 ms·
I'll toss in my (macOS) workflow too: - Download whatever Python binaries I need from python.org - virtualenv --python=$PYTHON_VERSION ~/.virtualenvs/$PROJECT
by camgunz 3y ago
I'll toss in my (macOS) workflow too:
- Download whatever Python binaries I need from python.org
- virtualenv --python=$PYTHON_VERSION ~/.virtualenvs/$PROJECT_NAME
- pyproject.toml
- pip-compile --generate-hashes
There has been tons of churn in the Python project management space, and I feel like I've been blissfully unaware of all of it with this workflow. Can't recommend enough.
Why regular Python binaries and not pyenv? I've had enough pyenv snafus and meltdowns that I started looking for alternatives, and it turned out I could just install whatever Python binary I wanted and specify it wherever I wanted. What could be easier?
python -m venv is fine, I've just gotten used to virtualenv.
pyproject.toml is the future and almost everything supports it pretty well; it also has fewer implicit weirdnesses than setup.py or setup.cfg.
pip-tools are really simple, and they let you have hashed dependencies which are super important IMO.
- Capricorn2481 3y agoDoes it handle OS differences?
- camgunz 3y agoYep
- Capricorn2481 3y agoHow exactly? Isn't a requirements.txt file, generated from pip-compile, incapable of specifying OS stuff? It's also my understanding that pip-tools does not let you make layered requirements files with pyproject.toml files, only with .in files
- camgunz 3y agoYou can specify different dependencies in pyproject.toml and then use --extra with pip-compile to pull them in. I do this with dev and test sections for example. Constraints seem like they work like you'd expect here. pip-compile also has the -c flag if you want to use that. I guess I don't know what you mean by OS stuff, but maybe this works for that too?
- Capricorn2481 3y agoHmm. So you generate a requirements.txt and a dev-requirements.txt. It sounds like they have overlapping dependencies? I can't get them to be "layered" where the dev-requirements.txt only has the dev dependencies.
- camgunz 3y agoAh, yeah that's what I do--I don't think there's any way to do that no.