From 60ba466fb29429a22ebc80ebd7dfe70ac229adff Mon Sep 17 00:00:00 2001 From: hasansezertasan Date: Mon, 25 Aug 2025 13:13:24 +0300 Subject: [PATCH 1/4] ref(project-metadata): migrate to PEP 621 --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 135d070c..12679d98 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,11 @@ [tool.black] extend-exclude = 'capabilities-data' + [tool.isort] profile = "black" + [tool.pytest.ini_options] minversion = "6.0" addopts = "--doctest-modules --cov escpos --cov-report=xml" @@ -14,6 +16,7 @@ testpaths = [ "escpos", ] + [[tool.mypy.overrides]] module = ["pytest", "jaconv", From 32d9b4bec0037d6b409ee4c6fe1079a20c542ed4 Mon Sep 17 00:00:00 2001 From: hasansezertasan Date: Fri, 5 Sep 2025 01:15:10 +0300 Subject: [PATCH 2/4] ref(project-metadata): migrate from setup.cfg and setup.py to pyproject.toml for PEP 621 compliance --- .vscode/settings.json | 6 +-- pyproject.toml | 104 ++++++++++++++++++++++++++++++++++++++++++ requirements.test.txt | 10 ++++ setup.cfg | 77 ------------------------------- setup.py | 45 ------------------ 5 files changed, 117 insertions(+), 125 deletions(-) create mode 100644 requirements.test.txt delete mode 100755 setup.py diff --git a/.vscode/settings.json b/.vscode/settings.json index 01b93afb..2bae2228 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,7 +6,7 @@ "**/node_modules/*/**": true, "**/.eggs/**": true, "**/.hypothesis/**": true, - "**/.tox/**": true, + "**/.tox/**": true }, "editor.formatOnSave": true, "editor.formatOnPaste": true, @@ -15,5 +15,5 @@ "source.organizeImports": "explicit" }, "python.testing.unittestEnabled": false, - "python.testing.pytestEnabled": true, -} \ No newline at end of file + "python.testing.pytestEnabled": true +} diff --git a/pyproject.toml b/pyproject.toml index 12679d98..1a5e401e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,107 @@ +[build-system] +requires = ["setuptools", "setuptools-scm"] +build-backend = "setuptools.build_meta" + + +[project] +name = "python-escpos" +dynamic = ["version"] +description = "Python library to manipulate ESC/POS Printers" +readme = "README.rst" +license = {text = "MIT"} +authors = [ + {name = "python-escpos developers", email = "dev@pkanzler.de"}, +] +maintainers = [ + {name = "Patrick Kanzler", email = "dev@pkanzler.de"}, +] +keywords = [ + "ESC/POS", + "printer", + "printing", + "receipt", + "thermoprinter", + "voucher", +] +classifiers = [ + "Development Status :: 4 - Beta", + "Environment :: Console", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: Implementation :: CPython", + "Topic :: Office/Business :: Financial :: Point-Of-Sale", + "Topic :: Software Development :: Libraries :: Python Modules", +] +requires-python = ">=3.8" +dependencies = [ + "argcomplete", + "importlib_resources", + "Pillow>=2.0", + "platformdirs", + "python-barcode>=0.15.0,<1", + "PyYAML", + "qrcode>=4.0", + "setuptools", + "six", +] + + +[project.optional-dependencies] +all = [ + "pycups; platform_system!='Windows'", + "pyserial", + "pyusb>=1.0.0", + "pywin32; platform_system=='Windows'", +] +cups = [ + "pycups; platform_system!='Windows'", +] +serial = [ + "pyserial", +] +usb = [ + "pyusb>=1.0.0", +] +win32 = [ + "pywin32; platform_system=='Windows'", +] + + +[project.scripts] +python-escpos = "escpos.cli:main" + + +[project.urls] +"Bug Tracker" = "https://github.com/python-escpos/python-escpos/issues" +Documentation = "https://python-escpos.readthedocs.io/en/latest/" +Homepage = "https://github.com/python-escpos/python-escpos" +"Release Notes" = "https://github.com/python-escpos/python-escpos/releases" + + +[tool.setuptools_scm] +version_file = "src/escpos/version.py" +version_file_template = """\ +#!/usr/bin/python +# -*- coding: utf-8 -*- +\"\"\"Version identifier. + +file generated by setuptools_scm +don't change, don't track in version control +\"\"\" + +version = '{version}' +""" + + [tool.black] extend-exclude = 'capabilities-data' diff --git a/requirements.test.txt b/requirements.test.txt new file mode 100644 index 00000000..b69f26d0 --- /dev/null +++ b/requirements.test.txt @@ -0,0 +1,10 @@ +jaconv +tox>=4.11 +pytest>=7.4 +pytest-cov +pytest-mock +scripttest +mock +hypothesis>=6.83 +flake8 +sphinxcontrib-spelling>=8.0.0 diff --git a/setup.cfg b/setup.cfg index 5a20992e..a9568877 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,80 +1,3 @@ -[metadata] -name = python-escpos -url = https://github.com/python-escpos/python-escpos -description = Python library to manipulate ESC/POS Printers -long_description = file: README.rst -long_description_content_type = text/x-rst -license = MIT -license_file = LICENSE -author = python-escpos developers -author_email = dev@pkanzler.de -maintainer = Patrick Kanzler -maintainer_email = dev@pkanzler.de -keywords = ESC/POS, thermoprinter, voucher printer, printing, receipt -classifiers = - Development Status :: 4 - Beta - Environment :: Console - Intended Audience :: Developers - License :: OSI Approved :: MIT License - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: 3.12 - Programming Language :: Python :: 3.13 - Programming Language :: Python :: Implementation :: CPython - Topic :: Software Development :: Libraries :: Python Modules - Topic :: Office/Business :: Financial :: Point-Of-Sale -project_urls = - Bug Tracker = https://github.com/python-escpos/python-escpos/issues - Documentation = https://python-escpos.readthedocs.io/en/latest/ - Release Notes = https://github.com/python-escpos/python-escpos/releases - -[options] -python_requires = >=3.8 -zip_safe = false -include_package_data = true -install_requires = - Pillow>=2.0 - qrcode>=4.0 - python-barcode>=0.15.0,<1 - setuptools - six - platformdirs - PyYAML - argcomplete - importlib_resources -setup_requires = setuptools_scm -tests_require = - jaconv - tox>=4.11 - pytest>=7.4 - pytest-cov - pytest-mock - scripttest - mock - hypothesis>=6.83 - flake8 - sphinxcontrib-spelling>=8.0.0 - -[options.extras_require] -usb = - pyusb>=1.0.0 -serial = - pyserial -cups = - pycups; platform_system!='Windows' -win32 = - pywin32; platform_system=='Windows' -all = - pyusb>=1.0.0 - pyserial - pycups; platform_system!='Windows' - pywin32; platform_system=='Windows' - [flake8] exclude = .git,.venv,.tox,.github,.eggs,__pycache__,doc/conf.py,build,dist,capabilities-data,test,src/escpos/constants.py max-line-length = 120 diff --git a/setup.py b/setup.py deleted file mode 100755 index c1cec16d..00000000 --- a/setup.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python -"""Setup script for python package.""" - -import os -import sys - -from setuptools import find_packages, setup - -base_dir = os.path.dirname(__file__) -src_dir = os.path.join(base_dir, "src") - -# When executing the setup.py, we need to be able to import ourselves, this -# means that we need to add the src/ directory to the sys.path. -sys.path.insert(0, src_dir) - - -def read(fname): - """Read file from same path as setup.py.""" - return open(os.path.join(os.path.dirname(__file__), fname)).read() - - -setuptools_scm_template = """\ -#!/usr/bin/python -# -*- coding: utf-8 -*- -\"\"\"Version identifier. - -file generated by setuptools_scm -don't change, don't track in version control -\"\"\" - -version = '{version}' -""" - - -setup( - use_scm_version={ - "write_to": "src/escpos/version.py", - "write_to_template": setuptools_scm_template, - }, - platforms="any", - package_dir={"": "src"}, - packages=find_packages(where="src", exclude=["tests", "tests.*"]), - package_data={"escpos": ["capabilities.json"]}, - entry_points={"console_scripts": ["python-escpos = escpos.cli:main"]}, -) From 036c28e738403c60caa19c933dcb3bf70c8aaabb Mon Sep 17 00:00:00 2001 From: hasansezertasan Date: Fri, 5 Sep 2025 01:32:39 +0300 Subject: [PATCH 3/4] remove MANIFEST.in as part of project metadata migration to pyproject.toml --- MANIFEST.in | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index d8e439aa..00000000 --- a/MANIFEST.in +++ /dev/null @@ -1,13 +0,0 @@ -include *.rst -include *.txt -include LICENSE -include INSTALL -include tox.ini -include capabilities-data/dist/capabilities.json -include src/escpos/capabilities.json -recursive-include doc *.bat -recursive-include doc *.ico -recursive-include doc *.py -recursive-include doc *.rst -recursive-include doc *.txt -recursive-include doc Makefile From a070f4fc2e95e62a20e86cff52794ce63e96a97a Mon Sep 17 00:00:00 2001 From: hasansezertasan Date: Fri, 5 Sep 2025 01:33:05 +0300 Subject: [PATCH 4/4] ref(project-metadata): remove MIT License classifier from pyproject.toml --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 1a5e401e..6c9f9897 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,7 +27,6 @@ classifiers = [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3",