Skip to content

Allow third-party versions to end in asterisk #6129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 10, 2021

Conversation

srittau
Copy link
Collaborator

@srittau srittau commented Oct 7, 2021

This is a first step towards #6095, where x.y and x.y.* are treated as
equivalent. The next step is to update existing versions to use x.y.*
where applicable and then treat x.y differently.

This is a first step towards python#6095, where x.y and x.y.* are treated as
equivalent. The next step is to update existing versions to use x.y.*
where applicable and then treat x.y differently.
@srittau
Copy link
Collaborator Author

srittau commented Oct 7, 2021

The text in CONTRIBUTING is a bit convoluted at the moment, but will be improved once we have fully switched to the new system.

the parts indicating the API level should be specified, with an
asterisk representing the API-independent part. In the case
of [Semantic Versioning](https://semver.org/), this version could look
like this: `2.7.*`. When the stubs are updated to a newer version
of the library, the version of the stub should be bumped (note that
previous versions are still available on PyPI). Some legacy stubs are
marked with version `0.1`, indicating that their supported version is
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still have 0.1 stubs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#6094 removes the remaining ones.

Comment on lines +107 to +108
unknown and needs to be updated. Other stubs don't use the asterisk
to denote the API-independent part.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to explain how the API-independent part works when there is no asterisk, but it doesn't really matter if this text will soon get revisited anyway.

@@ -169,7 +169,7 @@ def check_metadata():
assert "version" in data, f"Missing version for {distribution}"
version = data["version"]
msg = f"Unsupported Python version {version}"
assert re.match(r"^\d+\.\d+(\.\d+)?$", version), msg
assert re.match(r"^\d+(\.\d+)*(\.\*)?$", version), msg
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should 1 really be a valid version? How about 2.*?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Until the transition is over, this is the safe thing to do, but we can remove it later. The dataclasses backport has version 0.1 upstream, which causes a lot of problems at the moment.

@@ -48,8 +48,11 @@ def run_stubtest(dist: Path) -> None:
python_exe = str(venv_dir / "bin" / "python")

dist_version = metadata.get("version")
if dist_version is None or dist_version == "0.1":
assert isinstance(dist_version, str)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the assert belongs to check_consistent.py, not here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need it here for type checking purposes. But we should also check it in check_consistent.

@srittau srittau merged commit 46fc031 into python:master Oct 10, 2021
@srittau srittau deleted the support-star-versions branch October 10, 2021 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants