Skip to content

mypy-0.630's extensions does not satisfy its own runtime requirements #5763

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

Closed
ikelos opened this issue Oct 10, 2018 · 10 comments
Closed

mypy-0.630's extensions does not satisfy its own runtime requirements #5763

ikelos opened this issue Oct 10, 2018 · 10 comments

Comments

@ikelos
Copy link

ikelos commented Oct 10, 2018

Hiya,

I've installed mypy-0.630 which features the following:

setup.py's runtime requirements: mypy_extensions >= 0.4.0, < 0.5.0
extension's setup.py version number: 0.5.0-dev

This is still the case on master as of e170f6b.

Unfortunately, 0.5.0-dev does not appear to be < 0.5.0 according to the distutils version checking, meaning that the extensions shipped in the release tarball do not meet the requirements of the release itself (meaning people may have to download a previous release tarball to get this version to run). This appears to have been a very recent change (since 0.620 did not require the extensions).

Possible solutions would be that if the extensions module is to be treated as an independent package (with its own setup.py, which it appears to be as of 0.630) that it be moved to its own repository, ensuring that the versions do not need to be synchronized and can be released out of step with each other. If the extensions are not large enough to be their own package, and are a hard requirement of mypy, then perhaps they should simply be made part of the distribution?

The solution to this issue may also affect #5592

@ilevkivskyi
Copy link
Member

Unfortunately, 0.5.0-dev does not appear to be < 0.5.0 according to the distutils version checking

Hm, this is a bit weird. Is there any way in distutils to indicate a dev version (that is "less" that corresponding release)? If yes, maybe we can just switch versioning scheme for mypy_extensions?

@emmatyping
Copy link
Member

emmatyping commented Oct 11, 2018

@ilevkivskyi
I suppose we could switch to using any of these pre-release spellings: https://www.python.org/dev/peps/pep-0440/#pre-release-spelling.

We actually want development releases. Then it should handle things correctly. So perhaps we could do 0.5.0.dev0

@ikelos
Copy link
Author

ikelos commented Oct 12, 2018

I think it is already 0.5.0.dev0 when being processed (I've seen the dot rather than hyphen somewhere), but as I say, in its current form it doesn't work.

@ilevkivskyi
Copy link
Member

I think it is already 0.5.0.dev0 when being processed (I've seen the dot rather than hyphen somewhere), but as I say, in its current form it doesn't work.

But if distutils believes that 0.5.0.dev0 < 0.5.0 is not satisfied, isn't it a bug in distutils?

@ikelos
Copy link
Author

ikelos commented Oct 14, 2018

PEP 440 discourages public release of development releases (and cites that pre-releases can have development releases too, such as 0.5.0a0.dev0). It sounds as though the code should have been versioned 0.5.0a0 or 0.5.0b0 if it were a public prerelease (and looking at the distutils code, it should handle that as expected).

I'll continue on issue #5592 about whether this package should be separate or not.

@ikelos
Copy link
Author

ikelos commented Oct 14, 2018

Having said that, apparently a version of 0.5.0a0 doesn't pass 0.5.0a0 < 0.5.0 (nor does 0.5a0 < 0.5.0 so I'll be digging into it further to check whether there is an issue with distutils version checking...

@ikelos
Copy link
Author

ikelos commented Oct 14, 2018

Alright, it turns out distutils isn't used for requirements when mypy's run, but actually it's pkg_resources which makes use of packaging. It turns out packaging does versioning by removing all trailing 0s and then comparing packages. 0.5.0a0 (and 0.5.0.dev0) are both < 0.5.0, but apparently the packaging package has the following addition:

# This special case is here so that, unless the specifier itself
# includes is a pre-release version, that we do not accept pre-release
# versions for the version mentioned in the specifier (e.g. <3.1 should
# not match 3.1.dev0, but should match 3.0.dev0).
if not spec.is_prerelease and prospective.is_prerelease:
    if Version(prospective.base_version) == Version(spec.base_version):
        return False

So it seems as though it's by design and (from their perspective) not a bug.

@ikelos
Copy link
Author

ikelos commented Oct 31, 2018

This problem is still present in the 0.641 release. What needs to happen to get the dependencies fixed, so that the packages can install successfully?

@ikelos
Copy link
Author

ikelos commented Dec 4, 2018

It looks like this might make it through to 0.650. Is there anything that can be done about this? Even if we can't decouple the projects this release, could we at least ensure that the source package can be installed with the version of extensions that ships in the same tarball?

@msullivan
Copy link
Collaborator

OK, mypy_extensions has been split out into its own source project https://github.com/python/mypy_extensions. There are tags for 0.4.0 and 0.4.1 (which due to some sort of miscommunication, differ only by version number :P).

The extensions directory will be deleted in #6191.

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

No branches or pull requests

4 participants