Skip to content

Commit

Permalink
drop 3.6, 3.7 support, add new version, update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
shadrintakkt committed Jun 11, 2024
1 parent ee3fbc8 commit 758ceed
Show file tree
Hide file tree
Showing 8 changed files with 338 additions and 525 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v2
Expand Down
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: python
os: linux
dist: xenial
dist: jammy
env:
global:
- POETRY_VIRTUALENVS_CREATE=false
Expand All @@ -26,10 +26,12 @@ jobs:
- name: mypy
script: mypy .
- stage: test
python: 3.6
- python: 3.7
- python: 3.8
python: 3.8
- python: 3.9
- python: 3.10
- python: 3.11
- python: 3.12
- python: 3.13
- stage: publish
script: skip
deploy:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ one source of truth for version, name and etc.

At the moment, the library provides the single point for a package version.

It supports Python 3.6+.
It supports Python 3.8+.

## Quick start

Expand Down
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[mypy]
python_version = 3.6
python_version = 3.8

[mypy-tests.*]
ignore_errors = True
815 changes: 319 additions & 496 deletions poetry.lock

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "single-source"
version = "0.3.0"
version = "0.4.0"
description = "Access to the project version in Python code for PEP 621-style projects"
authors = ["Daniil Shadrin <rabbit72rus@gmail.com>"]
maintainers = ["Daniil Shadrin <rabbit72rus@gmail.com>"]
Expand All @@ -24,25 +24,24 @@ packages = [{include = "single_source"}]
"Bug Tracker" = "https://github.com/rabbit72/single-source/issues"

[tool.poetry.dev-dependencies]
toml = "^0.10.1"
toml = "^0.10.2"
pytest = "*"
pytest-mock = "*"
black = "^22.1.0"
black = "^24.4.2"
isort = {version = "*", extras = ["pyproject"]}
flake8 = "*"
flake8-bugbear = "*"
pre-commit = "*"
mypy = "^0.812"
mypy = "^1.10.0"


[tool.poetry.dependencies]
python = "^3.6.2"
importlib_metadata = { version = ">=3.0,<5", python = "< 3.8" }
python = "^3.8"


[tool.black]
line-length = 88
target-version = ['py36']
target-version = ['py38']

# backward compatibility with black
[tool.isort]
Expand Down
6 changes: 1 addition & 5 deletions single_source/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@

from .errors import VersionNotFoundError

try:
import importlib.metadata as importlib_metadata
except ModuleNotFoundError:
# for Python <3.8 add 'importlib_metadata' as a dependency
import importlib_metadata # type: ignore
import importlib.metadata as importlib_metadata


VERSION_REGEX = r"\s*version\s*=\s*[\"']\s*([-.\w]{3,})\s*[\"']\s*"
Expand Down
13 changes: 3 additions & 10 deletions tests/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,10 @@

def test_get_version_from_installed_package(mocker):
expected_version = "2.0.1-alpha.0"
import importlib.metadata

if sys.version_info < (3, 8):
import importlib_metadata

mocker.patch("importlib_metadata.version")
importlib_metadata.version.return_value = expected_version
elif sys.version_info >= (3, 8):
import importlib.metadata

mocker.patch("importlib.metadata.version")
importlib.metadata.version.return_value = expected_version
mocker.patch("importlib.metadata.version")
importlib.metadata.version.return_value = expected_version

version_from_metadata = _get_version_from_metadata("does not matter")
assert version_from_metadata == expected_version
Expand Down

0 comments on commit 758ceed

Please sign in to comment.