Skip to content

Commit 83d8862

Browse files
committed
wip: implicitly allowing prereleases is not necessary and counterproductive (If only a prerelease fulfills a constraint, we choose it anyway. If a stable release fulfills a constraint, we shouldn't choose a prerelease if not explicitly requested.)
1 parent f07af0d commit 83d8862

File tree

2 files changed

+0
-27
lines changed

2 files changed

+0
-27
lines changed

src/poetry/core/packages/dependency.py

-10
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from packaging.utils import canonicalize_name
1414

1515
from poetry.core.constraints.generic import parse_constraint as parse_generic_constraint
16-
from poetry.core.constraints.version import VersionRangeConstraint
1716
from poetry.core.constraints.version import parse_constraint
1817
from poetry.core.packages.dependency_group import MAIN_GROUP
1918
from poetry.core.packages.specification import PackageSpecification
@@ -71,15 +70,6 @@ def __init__(
7170
groups = [MAIN_GROUP]
7271

7372
self._groups = frozenset(groups)
74-
75-
if (
76-
isinstance(self._constraint, VersionRangeConstraint)
77-
and self._constraint.min
78-
):
79-
allows_prereleases = (
80-
allows_prereleases or self._constraint.min.is_unstable()
81-
)
82-
8373
self._allows_prereleases = allows_prereleases
8474

8575
self._python_versions = "*"

tests/packages/test_dependency.py

-17
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,6 @@
99
from poetry.core.version.markers import parse_marker
1010

1111

12-
@pytest.mark.parametrize(
13-
"constraint,result",
14-
[
15-
("^1.0", False),
16-
("^1.0.dev0", True),
17-
("^1.0.0", False),
18-
("^1.0.0.dev0", True),
19-
("^1.0.0.alpha0", True),
20-
("^1.0.0.alpha0+local", True),
21-
("^1.0.0.rc0+local", True),
22-
("^1.0.0-1", False),
23-
],
24-
)
25-
def test_allows_prerelease(constraint: str, result: bool) -> None:
26-
assert Dependency("A", constraint).allows_prereleases() == result
27-
28-
2912
def test_to_pep_508() -> None:
3013
dependency = Dependency("Django", "^1.23")
3114

0 commit comments

Comments
 (0)