-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
87b6d8b
commit bf2297a
Showing
3 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env python3 | ||
|
||
"""Installs the minimum version of all dependencies, with pip. | ||
Assumptions: | ||
- You've installed the development dependencies: `pip install '.[dev]'` | ||
- All of the dependencies in pyproject.toml are specified with `>=` | ||
""" | ||
|
||
import subprocess | ||
import sys | ||
from pathlib import Path | ||
|
||
from packaging.requirements import Requirement | ||
|
||
assert sys.version_info[0] == 3 | ||
if sys.version_info[1] < 11: | ||
import tomli as toml | ||
else: | ||
import tomllib as toml | ||
|
||
|
||
root = Path(__file__).parents[1] | ||
with open(root / "pyproject.toml", "rb") as f: | ||
pyproject_toml = toml.load(f) | ||
requirements = [] | ||
for install_requires in filter( | ||
bool, | ||
(i.strip() for i in pyproject_toml["project"]["dependencies"]), | ||
): | ||
requirement = Requirement(install_requires) | ||
assert len(requirement.specifier) == 1 | ||
specifier = list(requirement.specifier)[0] | ||
assert specifier.operator == ">=" | ||
install_requires = install_requires.replace(">=", "==") | ||
requirements.append(install_requires) | ||
|
||
subprocess.run(["pip", "install", *requirements], check=True) |