Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/install-example-projects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
set -ex
# Loop over all folders in `./example` and install them
for d in ./example/*/ ; do
unidep install -e "$d"
unidep install --verbose -e "$d"
pkg=$(basename $d)
python -c "import $pkg"
micromamba list
Expand Down Expand Up @@ -112,7 +112,7 @@ jobs:
set -ex
# Loop over all folders in `./example` and install them
for d in ./example/*/ ; do
unidep install -e "$d"
unidep install --verbose -e "$d"
pkg=$(basename $d)
python -c "import $pkg"
conda list
Expand Down
8 changes: 4 additions & 4 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ Using `unidep` for installation offers a more comprehensive approach. It handles
$ unidep install --dry-run -e ./setup_py_project
📦 Installing conda dependencies with `conda install --yes --override-channels --channel conda-forge pandas">=1,<3" adaptive">=0.15.0, <2.0.0" pfapack packaging adaptive-scheduler numpy">=1.21" hpc05 pexpect pytest pytest-cov`

📦 Installing pip dependencies with `/opt/hostedtoolcache/Python/3.12.5/x64/bin/python -m pip install yaml2bib rsync-time-machine slurm-usage pyyaml aiokef markdown-code-runner numthreads unidep`
📦 Installing pip dependencies with `/opt/hostedtoolcache/Python/3.12.6/x64/bin/python -m pip install yaml2bib rsync-time-machine slurm-usage pyyaml aiokef markdown-code-runner numthreads unidep`

📝 Found local dependencies: {'setup_py_project': ['hatch_project', 'setuptools_project']}

📦 Installing project with `/opt/hostedtoolcache/Python/3.12.5/x64/bin/python -m pip install --no-dependencies -e /home/runner/work/unidep/unidep/example/hatch_project -e /home/runner/work/unidep/unidep/example/setuptools_project -e ./setup_py_project`
📦 Installing project with `/opt/hostedtoolcache/Python/3.12.6/x64/bin/python -m pip install --no-dependencies -e /home/runner/work/unidep/unidep/example/hatch_project -e /home/runner/work/unidep/unidep/example/setuptools_project -e ./setup_py_project`

```

Expand Down Expand Up @@ -157,11 +157,11 @@ unidep install-all -e
$ unidep install-all -e --dry-run
📦 Installing conda dependencies with `conda install --yes --override-channels --channel conda-forge adaptive-scheduler numpy">=1.21" hpc05 pandas">=1,<3" pexpect adaptive">=0.15.0, <2.0.0" pfapack packaging pytest pytest-cov`

📦 Installing pip dependencies with `/opt/hostedtoolcache/Python/3.12.5/x64/bin/python -m pip install unidep markdown-code-runner numthreads yaml2bib rsync-time-machine slurm-usage pyyaml aiokef`
📦 Installing pip dependencies with `/opt/hostedtoolcache/Python/3.12.6/x64/bin/python -m pip install unidep markdown-code-runner numthreads yaml2bib rsync-time-machine slurm-usage pyyaml aiokef`

📝 Found local dependencies: {'pyproject_toml_project': ['hatch_project'], 'setup_py_project': ['hatch_project', 'setuptools_project'], 'setuptools_project': ['hatch_project']}

📦 Installing project with `/opt/hostedtoolcache/Python/3.12.5/x64/bin/python -m pip install --no-dependencies -e ./hatch2_project -e ./hatch_project -e ./pyproject_toml_project -e ./setup_py_project -e ./setuptools_project`
📦 Installing project with `/opt/hostedtoolcache/Python/3.12.6/x64/bin/python -m pip install --no-dependencies -e ./hatch2_project -e ./hatch_project -e ./pyproject_toml_project -e ./setup_py_project -e ./setuptools_project`

```

Expand Down
26 changes: 26 additions & 0 deletions tests/test_unidep.py
Original file line number Diff line number Diff line change
Expand Up @@ -2472,3 +2472,29 @@ def test_optional_dependencies_with_version_specifier(
)
assert resolved.keys() == {"adaptive"}
assert resolved["adaptive"][None]["conda"].pin == "=0.13.2"


@pytest.mark.parametrize("toml_or_yaml", ["toml", "yaml"])
def test_different_version_specifiers(
tmp_path: Path,
toml_or_yaml: Literal["toml", "yaml"],
) -> None:
p = tmp_path / "p" / "requirements.yaml"
p.parent.mkdir()
p.write_text(
textwrap.dedent(
"""\
dependencies:
- flatten-dict>= 0.4
""",
),
)
p = maybe_as_toml(toml_or_yaml, p)

requirements = parse_requirements(p, verbose=False)
resolved = resolve_conflicts(
requirements.requirements,
requirements.platforms,
optional_dependencies=requirements.optional_dependencies,
)
assert resolved["flatten-dict"][None]["conda"].pin == ">=0.4"