pypa / bandersnatch

A PyPI mirror client according to PEP 381 http://www.python.org/dev/peps/pep-0381/
Academic Free License v3.0
453 stars 141 forks source link

Bandersnatch works for Python 3.6.1 or later rather than Python 3..6 or later --> change in the docs? #66

Closed d2gex closed 6 years ago

d2gex commented 6 years ago

Hi Development doc https://bandersnatch.readthedocs.io/en/latest/CONTRIBUTING.html#pre-install mentions that Python 3.6 or later is required however Python 3.6.0 fails to run 'src/bandersnatch/init.py' file which code is below:

!/usr/bin/env python3

from typing import NamedTuple

class _VersionInfo(NamedTuple):
    major: int
    minor: int
    micro: int
    releaselevel: str
    serial: int

    @property
    def version_str(self) -> str:
        release_level = f".{self.releaselevel}" if self.releaselevel else ""
        return f"{self.major}.{self.minor}.{self.micro}{release_level}"

__version_info__ = _VersionInfo(
    major=3,
    minor=0,
    micro=0,
    releaselevel="dev0",
    serial=0,  # Not currently in use with Bandersnatch versioning
)
__version__ = __version_info__.version_str

The error I got in Python 3.6.0 was:

Traceback (most recent call last):
  File "<input>", line 24, in <module>
AttributeError: '_VersionInfo' object has no attribute 'version_str'

Also see last note about Python 3.6.1 on https://docs.python.org/3/library/typing.html#typing.NamedTuple as shown below:

Changed in version 3.6: Added support for PEP 526 variable annotation syntax.
Changed in version 3.6.1: Added support for default values, methods, and docstrings.
cooperlees commented 6 years ago

Ahh my bad. Yes please. PR away to save other people the time. Sorry about that!

cooperlees commented 6 years ago

Put up https://github.com/pypa/bandersnatch/pull/67