Skip to content

Commit

Permalink
Merge branch 'main' into remove-pip-dev-requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
maresb authored Oct 13, 2023
2 parents 57588a3 + f628b51 commit 2c3e257
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions conda_lock/src_parser/pyproject_toml.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,11 @@ def parse_poetry_pyproject_toml(
extras: List[Any] = []
in_extra: bool = False

# Poetry spec includes Python version in "tool.poetry.dependencies"
# Cannot be managed by pip
if depname == "python":
manager = "conda"

# Extras can only be defined in `tool.poetry.dependencies`
if default_category == "main":
in_extra = category != "main"
Expand Down
1 change: 1 addition & 0 deletions tests/test-poetry-default-pip/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description = ""
authors = ["conda-lock"]

[tool.poetry.dependencies]
python = "^3.7"
requests = "^2.13.0"
toml = ">=0.10"
tomlkit = { version = ">=0.7.0,<1.0.0", optional = true }
Expand Down
1 change: 1 addition & 0 deletions tests/test-poetry-git/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description = ""
authors = ["conda-lock"]

[tool.poetry.dependencies]
python = "^3.7"
requests = "^2.13.0"
toml = ">=0.10"
tomlkit = { version = ">=0.7.0,<1.0.0", optional = true }
Expand Down
1 change: 1 addition & 0 deletions tests/test-poetry-no-pypi/other_project1/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description = ""
authors = ["conda-lock"]

[tool.poetry.dependencies]
python = "^3.7"
requests = "^2.13.0"
toml = ">=0.10"
tomlkit = { version = ">=0.7.0,<1.0.0", optional = true }
Expand Down
1 change: 1 addition & 0 deletions tests/test-poetry-no-pypi/other_project2/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description = ""
authors = ["conda-lock"]

[tool.poetry.dependencies]
python = "^3.7"
requests = "^2.13.0"
toml = ">=0.10"
tomlkit = { version = ">=0.7.0,<1.0.0", optional = true }
Expand Down
1 change: 1 addition & 0 deletions tests/test-poetry-no-pypi/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description = ""
authors = ["conda-lock"]

[tool.poetry.dependencies]
python = "^3.7"
requests = "^2.13.0"
toml = ">=0.10"
tomlkit = { version = ">=0.7.0,<1.0.0", optional = true }
Expand Down
1 change: 1 addition & 0 deletions tests/test-poetry-optional/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description = ""
authors = ["conda-lock"]

[tool.poetry.dependencies]
python = "^3.7"
toml = ""
# Checking `optional = true` but not in extra
tomlkit = { version = "", optional = true }
Expand Down
1 change: 1 addition & 0 deletions tests/test-poetry/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description = ""
authors = ["conda-lock"]

[tool.poetry.dependencies]
python = "^3.7"
requests = "^2.13.0"
toml = ">=0.10"
tomlkit = { version = ">=0.7.0,<1.0.0", optional = true }
Expand Down
4 changes: 4 additions & 0 deletions tests/test_conda_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,8 @@ def test_parse_poetry(poetry_pyproject_toml: Path):
for dep in res.dependencies["linux-64"]
}

assert specs["python"].manager == "conda"
assert specs["python"].version == ">=3.7,<4.0"
assert specs["requests"].version == ">=2.13.0,<3.0.0"
assert specs["toml"].version == ">=0.10"
assert specs["sqlite"].version == "<3.34"
Expand All @@ -678,6 +680,8 @@ def test_parse_poetry_default_pip(poetry_pyproject_toml_default_pip: Path):
for dep in res.dependencies["linux-64"]
}

assert specs["python"].manager == "conda"
assert specs["python"].version == ">=3.7,<4.0"
assert specs["sqlite"].manager == "conda"
assert specs["certifi"].manager == "conda"
assert specs["requests"].manager == "pip"
Expand Down

0 comments on commit 2c3e257

Please sign in to comment.