diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ab81429..096f643 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: os: [ ubuntu-22.04 ] - python: [ '3.8', '3.9', '3.10', '3.11', '3.12' ] + python: [ '3.8', '3.9', '3.10', '3.11', '3.12', '3.13' ] variant: [ "py", "py-images" ] include: - os: macOS-12 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ec56193..d7fc827 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,17 +1,17 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v5.0.0 hooks: - id: trailing-whitespace args: [--markdown-linebreak-ext=md] - id: end-of-file-fixer - id: debug-statements - repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v1.7.1' + rev: 'v1.15.0' hooks: - id: mypy - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 'v0.1.6' + rev: 'v0.11.9' hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] diff --git a/README.rst b/README.rst index 7231572..7010068 100644 --- a/README.rst +++ b/README.rst @@ -26,7 +26,7 @@ python-barcode There are no external dependencies when generating SVG files. Pillow is required for generating images (e.g.: PNGs). -Support Python 3.8 to 3.12. +Support Python 3.8 to 3.13. .. image:: example-ean13.png :target: https://github.com/WhyNotHugo/python-barcode diff --git a/barcode/__init__.py b/barcode/__init__.py index 1a16b4e..6a4d481 100755 --- a/barcode/__init__.py +++ b/barcode/__init__.py @@ -3,6 +3,7 @@ created as SVG objects. If Pillow is installed, the barcodes can also be rendered as images (all formats supported by Pillow). """ + from __future__ import annotations import os @@ -65,8 +66,7 @@ @overload def get( name: str, code: str, writer: BaseWriter | None = None, options: dict | None = None -) -> Barcode: - ... +) -> Barcode: ... @overload @@ -75,8 +75,7 @@ def get( code: None = None, writer: BaseWriter | None = None, options: dict | None = None, -) -> type[Barcode]: - ... +) -> type[Barcode]: ... def get( diff --git a/barcode/base.py b/barcode/base.py index 95223fb..cfcbe36 100755 --- a/barcode/base.py +++ b/barcode/base.py @@ -1,6 +1,5 @@ -"""barcode.base +"""barcode.base""" -""" from __future__ import annotations from typing import TYPE_CHECKING diff --git a/barcode/codabar.py b/barcode/codabar.py index aecd8ab..a70e3dd 100644 --- a/barcode/codabar.py +++ b/barcode/codabar.py @@ -2,6 +2,7 @@ :Provided barcodes: Codabar (NW-7) """ + from __future__ import annotations __docformat__ = "restructuredtext en" diff --git a/barcode/errors.py b/barcode/errors.py index 2da49d6..4725187 100755 --- a/barcode/errors.py +++ b/barcode/errors.py @@ -1,4 +1,5 @@ """barcode.errors""" + from __future__ import annotations __docformat__ = "restructuredtext en" diff --git a/barcode/isxn.py b/barcode/isxn.py index bcb56ba..e74ea58 100755 --- a/barcode/isxn.py +++ b/barcode/isxn.py @@ -21,6 +21,7 @@ '0132354187' """ + from __future__ import annotations from barcode.ean import EuropeanArticleNumber13 diff --git a/barcode/itf.py b/barcode/itf.py index 7d9c2fe..f40d9cb 100644 --- a/barcode/itf.py +++ b/barcode/itf.py @@ -2,6 +2,7 @@ :Provided barcodes: Interleaved 2 of 5 """ + from __future__ import annotations __docformat__ = "restructuredtext en" diff --git a/barcode/upc.py b/barcode/upc.py index 9093b8f..060f19f 100755 --- a/barcode/upc.py +++ b/barcode/upc.py @@ -2,6 +2,7 @@ :Provided barcodes: UPC-A """ + from __future__ import annotations __docformat__ = "restructuredtext en" diff --git a/docs/changelog.rst b/docs/changelog.rst index 12a1b56..7ee084e 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -14,6 +14,11 @@ v0.16.0 included resulting in a transparent background. * Do not paint text if its size would be zero, to avoid an "invalid ppem value" error with newer versions of Pillow. +* Add support for Python 3.13. +* Optimization of code creation, avoiding to many charset switch. + This results in shorter codes; according to GS1 codes should not + be longer than 165 mm (6.5"). (#232) + v0.15.1 ~~~~~~~ diff --git a/pyproject.toml b/pyproject.toml index 3eaa7ca..fb03ad5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,6 +6,9 @@ write_to = "barcode/version.py" version_scheme = "post-release" [tool.ruff] +target-version = "py38" + +[tool.ruff.lint] select = [ "F", "E", @@ -36,9 +39,8 @@ select = [ "PLE", "RUF", ] -target-version = "py38" -[tool.ruff.isort] +[tool.ruff.lint.isort] force-single-line = true required-imports = ["from __future__ import annotations"] @@ -46,3 +48,11 @@ required-imports = ["from __future__ import annotations"] exclude_lines = [ "if TYPE_CHECKING:", ] + +[tool.pytest.ini_options] +addopts = [ + "-vv", + "--cov=barcode", + "--cov-report=term-missing:skip-covered", + "--no-cov-on-fail", +] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index ed5ed80..0000000 --- a/setup.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[tool:pytest] -addopts = - -vv - --cov=barcode - --cov-report=term-missing:skip-covered - --no-cov-on-fail diff --git a/setup.py b/setup.py index 6605f21..f065586 100755 --- a/setup.py +++ b/setup.py @@ -30,6 +30,7 @@ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Topic :: Multimedia :: Graphics", "Topic :: Software Development :: Libraries :: Python Modules", ], diff --git a/tests/test_manually.py b/tests/test_manually.py index 1677792..12f4d15 100755 --- a/tests/test_manually.py +++ b/tests/test_manually.py @@ -1,4 +1,5 @@ """Generates barcodes for visually inspecting the results.""" + from __future__ import annotations import codecs