What do version specifiers like `~=`, `==`, `>=,<` mean?
BeginnerConceptEnvironments, dependencies & packaging
Answer
==1.35.2: exactly that version.>=1.35,<2: range; allows minor and patch upgrades but not the next major.~=1.35.2: compatible release, means>=1.35.2,<1.36;~=1.35means>=1.35,<2.!=1.35.3: exclude a broken version.
Applications pin exactly via a lock file; libraries use ranges so they do not create resolution conflicts for their users.
More on Environments, dependencies & packaging
What is a virtual environment and why do we always use one?BeginnerWhat does `error: externally-managed-environment` mean?Beginner`requirements.txt` vs `pyproject.toml`: what goes where?IntermediateWhy is `pip freeze > requirements.txt` not a great lock strategy?IntermediateWhat are `pipx` and `uv`, and when do you use them?IntermediateHow do you manage multiple Python versions on one machine?Intermediate