Skip to content

Commit 8b2ce8f

Browse files
authored
Finish changing versioning scheme (#60)
This change was removed from #57, so The changes here accomplish two things: First, allows us to change the specificity of how we pin versions in typeshed while ensuring that users who install without pinning versions still get the latest stub. Second, incrementing the fourth position helps disambiguate "upstream version" from "types version", reducing user confusion. See my comment here: #57 (comment)
1 parent 73ef1fd commit 8b2ce8f

File tree

2 files changed

+1
-30
lines changed

2 files changed

+1
-30
lines changed

stub_uploader/get_version.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,12 @@ def compute_incremented_version(
8989
if max_published.epoch > 0 or version_base.epoch > 0:
9090
raise NotImplementedError("Epochs in versions are not supported")
9191

92-
increment_specificity = specificity + 1
93-
# TODO: uncomment this in follow-up PR
9492
# We'll try to bump the fourth part of the release. So e.g. if our version_spec is
9593
# 1.1, we'll release 1.1.0.0, 1.1.0.1, 1.1.0.2, ...
9694
# But if our version_spec is 5.6.7.8, we'll release 5.6.7.8.0, 5.6.7.8.1, ...
97-
# increment_specificity = max(specificity + 1, 4)
95+
increment_specificity = max(specificity + 1, 4)
9896

9997
if version_base.release < max_published.release[:specificity]:
100-
raise AssertionError("TODO: remove this exception in follow-up PR")
101-
10298
# Our published versions have gone too far ahead the upstream version
10399
# So we can't guarantee our second property.
104100
# In practice, this will only happen if the specificity of version_spec is

tests/test_unit.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -50,31 +50,6 @@ def _incremented_ver(ver: str, published: list[str]) -> str:
5050
return str(compute_incremented_version(ver, published_vers))
5151

5252

53-
def test_compute_incremented_version_legacy() -> None:
54-
# never before published version
55-
empty_list: list[str] = []
56-
assert _incremented_ver("1", empty_list) == "1.0"
57-
assert _incremented_ver("1.2", empty_list) == "1.2.0"
58-
59-
# published less than version spec
60-
assert _incremented_ver("1.2", ["1.1.0.4"]) == "1.2.0"
61-
assert _incremented_ver("1", ["0.9"]) == "1.0"
62-
assert _incremented_ver("1.1", ["0.9"]) == "1.1.0"
63-
assert _incremented_ver("1.2.3", ["1.1.0.17"]) == "1.2.3.0"
64-
assert _incremented_ver("1.2.3.4", ["1.1.0.17"]) == "1.2.3.4.0"
65-
66-
# published equals version spec
67-
assert _incremented_ver("1.1", ["1.1"]) == "1.1.1"
68-
assert _incremented_ver("1.1", ["1.1.0.4"]) == "1.1.0.5"
69-
assert _incremented_ver("1.1", ["1.1.3.4"]) == "1.1.3.5"
70-
assert _incremented_ver("1.2.3.4", ["1.2.3.4.5"]) == "1.2.3.4.6"
71-
assert _incremented_ver("1.2.3.4.5", ["1.2.3.4.5"]) == "1.2.3.4.5.1"
72-
73-
# test that we do the max version right
74-
assert _incremented_ver("1.2", ["1.1.0.7", "1.2.0.7"]) == "1.2.0.8"
75-
76-
77-
@pytest.mark.skip(reason="Will use in follow-up PR")
7853
def test_compute_incremented_version() -> None:
7954
# never before published version
8055
empty_list: list[str] = []

0 commit comments

Comments
 (0)