Is there anything wrong with pip freeze > requirements.txt and then pip install -r requirements.txt ? This would install the exact versions
Is there anything wrong with pip freeze > requirements.txt and then pip install -r requirements.txt ? This would install the exact versions
pip-sync was then called to install it in given environment, any promotion from devint -> qa -> staging -> prod, was just copying the requirements.txt from environment earlier and calling pip-sync.
Then bar releases version 0.2.2
So your deps want bar 0.2.1, but foo now wants bar 0.2.2
This breaks your pip install.
EDIT: there are a few other gotchas (please respond to this post if you know of any more)
e.g. from https://medium.com/knerd/the-nine-circles-of-python-dependen...
"If two of your dependencies are demanding overlapping versions of a library, pip will not necessarily install a version of this library that satisfies both requirements" e.g. https://github.com/pypa/pip/issues/2775
https://github.com/pandas-dev/pandas/issues/27206
All of a sudden, a numpy release pulls in a new version for a pandas build (that incidentally breaks for py2)
This without involving a "~=", but rather because pandas needs to build from source, and chooses the latest numpy build to do so.
No they are not.
Pip freeze does not resolve transitive dependencies, nor does pip know what to do if your transitive dependencies conflict with each another.
How? Doesn't pip freeze literally list all packages that's installed in the current environment besides basic toolings such as setuptools (and you could even instruct it to list those as well)?
I don't think this is correct:
$ python3 -m venv /tmp/v
$ /tmp/v/bin/pip install flask
[...]
Collecting MarkupSafe>=0.23 (from Jinja2>=2.10.1->flask)
[...]
$ /tmp/v/bin/pip freeze | grep MarkupSafe
MarkupSafe==1.1.1
> nor does pip know what to do if your transitive dependencies conflict with each anotherThis is true, but because Python exposes all libraries in a single namespace at runtime, there isn't actually anything reasonable to do if they genuinely conflict. You can't have both, say, MarkupSafe 1.1.1 and MarkupSafe 1.1.0 in PYTHONPATH and expect them to be both accessible. There's no way in an import statement to say which one you want.
However, it's notable that pip runs into trouble in cases where transitive dependencies don't genuinely conflict, too. See https://github.com/pypa/pip/issues/988 - this is a bug / acknowledged deficiency, and there is work in progress towards fixing it.
This would be fixable with a sys path hook, were pip so inclined
(Also it's not clear what those changed semantics would be.)
> remainder of the file as Ruby and not Python
That's a little excessive
Getting this right and reliable would be a) a considerable language design project in its own right and b) confusing to users of Python as it is documented, and in particular to people testing their modules locally without pip. It wouldn't be as drastically different a language as Ruby, but it would certainly be a different language.
Ruby does the same thing with Gemfile.lock. npm does the same thing with package-lock.json.
pip isn't actually part of Python proper.