Skip to content

Commit

Permalink
Officially support Python 3.12 and update dev environment (#183)
Browse files Browse the repository at this point in the history
* Officially support Python 3.12 and update dev environment

* Remove PY37 build reference
  • Loading branch information
facelessuser authored Sep 2, 2023
1 parent d50b51a commit 9d00b18
Show file tree
Hide file tree
Showing 21 changed files with 271 additions and 252 deletions.
25 changes: 12 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ jobs:
max-parallel: 4
matrix:
platform: [ubuntu-latest, windows-latest]
python-version: [3.7, 3.8, 3.9, '3.10', '3.11', '3.12-dev']
python-version: [3.8, 3.9, '3.10', '3.11', '3.12']
include:
- python-version: 3.7
tox-env: py37
- python-version: 3.8
tox-env: py38
- python-version: 3.9
Expand All @@ -29,24 +27,25 @@ jobs:
tox-env: py310
- python-version: '3.11'
tox-env: py311
- python-version: '3.12-dev'
- python-version: '3.12'
tox-env: py312
exclude:
- platform: windows-latest
python-version: '3.12-dev'
# exclude:
# - platform: windows-latest
# python-version: '3.12-dev'

env:
TOXENV: ${{ matrix.tox-env }}

runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
if: "!endsWith(matrix.python-version, '-dev')"
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Set up development Python ${{ matrix.python-version }}
if: endsWith(matrix.python-version, '-dev')
uses: deadsnakes/[email protected]
Expand Down Expand Up @@ -79,9 +78,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -103,9 +102,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -40,7 +40,7 @@ jobs:
strategy:
matrix:
distribution: [bdist_wheel]
python-3-version: [7, 8, 9, '10', '11']
python-3-version: [8, 9, '10', '11', '12']
include:
- distribution: sdist
python-3-version: '11'
Expand All @@ -49,8 +49,8 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.${{ matrix.python-3-version }}
- name: Package sdist
Expand All @@ -65,7 +65,7 @@ jobs:
python -m build -w
- name: Upload artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
path: dist/*

Expand Down
18 changes: 9 additions & 9 deletions backrefs/__meta__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def __new__(
raise ValueError("All version parts except 'release' should be integers.")

if release not in REL_MAP:
raise ValueError("'{}' is not a valid release type.".format(release))
raise ValueError(f"'{release}' is not a valid release type.")

# Ensure valid pre-release (we do not allow implicit pre-releases).
if ".dev-candidate" < release < "final":
Expand All @@ -118,7 +118,7 @@ def __new__(
elif dev:
raise ValueError("Version is not a development release.")

return super(Version, cls).__new__(cls, major, minor, micro, release, pre, post, dev)
return super().__new__(cls, major, minor, micro, release, pre, post, dev)

def _is_pre(self) -> bool:
"""Is prerelease."""
Expand All @@ -145,15 +145,15 @@ def _get_canonical(self) -> str:

# Assemble major, minor, micro version and append `pre`, `post`, or `dev` if needed..
if self.micro == 0:
ver = "{}.{}".format(self.major, self.minor)
ver = f"{self.major}.{self.minor}"
else:
ver = "{}.{}.{}".format(self.major, self.minor, self.micro)
ver = f"{self.major}.{self.minor}.{self.micro}"
if self._is_pre():
ver += '{}{}'.format(REL_MAP[self.release], self.pre)
ver += f'{REL_MAP[self.release]}{self.pre}'
if self._is_post():
ver += ".post{}".format(self.post)
ver += f".post{self.post}"
if self._is_dev():
ver += ".dev{}".format(self.dev)
ver += f".dev{self.dev}"

return ver

Expand All @@ -164,7 +164,7 @@ def parse_version(ver: str) -> Version:
m = RE_VER.match(ver)

if m is None:
raise ValueError("'{}' is not a valid version".format(ver))
raise ValueError(f"'{ver}' is not a valid version")

# Handle major, minor, micro
major = int(m.group('major'))
Expand Down Expand Up @@ -193,5 +193,5 @@ def parse_version(ver: str) -> Version:
return Version(major, minor, micro, release, pre, post, dev)


__version_info__ = Version(5, 5, 1, "final")
__version_info__ = Version(5, 6, 0, "final")
__version__ = __version_info__._get_canonical()
Loading

0 comments on commit 9d00b18

Please sign in to comment.