From c91ea5822998412430415f53badac7286b3eaa3e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 22:04:02 +0000 Subject: [PATCH 01/20] chore(deps): Bump setuptools from 65.5.1 to 70.3.0 Bumps [setuptools](https://github.com/pypa/setuptools) from 65.5.1 to 70.3.0. - [Release notes](https://github.com/pypa/setuptools/releases) - [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst) - [Commits](https://github.com/pypa/setuptools/compare/v65.5.1...v70.3.0) --- updated-dependencies: - dependency-name: setuptools dependency-type: indirect ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- requirements-dev.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 18d880de..a852bd2c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ [build-system] requires = [ - "setuptools==65.5.1", + "setuptools==70.3.0", "wheel==0.41.3", ] build-backend = "setuptools.build_meta:__legacy__" diff --git a/requirements-dev.txt b/requirements-dev.txt index 14bd2108..b9705749 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -191,5 +191,5 @@ zipp==3.19.2 # The following packages are considered to be unsafe in a requirements file: pip==23.3 # via pip-tools -setuptools==65.5.1 +setuptools==70.3.0 # via pip-tools From 547fb09ecde9aa5b99dbdf75737d1581112aa66e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 23 Aug 2024 16:29:59 +0000 Subject: [PATCH 02/20] chore: Bump django from 4.2.14 to 4.2.15 Bumps [django](https://github.com/django/django) from 4.2.14 to 4.2.15. - [Commits](https://github.com/django/django/compare/4.2.14...4.2.15) --- updated-dependencies: - dependency-name: django dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 0785636d..bdf54e5f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -28,7 +28,7 @@ cryptography==42.0.8 # signxml defusedxml==0.7.1 # via -r requirements.in -django==4.2.14 +django==4.2.15 # via # -r requirements.in # django-filter From dee5b2988944b53e68de49233d10a2a472195558 Mon Sep 17 00:00:00 2001 From: Jose Tomas Robles Hahn Date: Fri, 23 Aug 2024 13:31:01 -0400 Subject: [PATCH 03/20] chore(deps): Update `pip` from 23.3 to 24.2 - [Software Repository](https://pypi.org/project/pip/24.2/) - [Release notes](https://pip.pypa.io/en/stable/news/#v24-2) - [Changelog](https://github.com/pypa/pip/blob/24.2/NEWS.rst#242-2024-07-28) - [Commits](https://github.com/pypa/pip/compare/23.3...24.2) --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index b9705749..1240b711 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -189,7 +189,7 @@ zipp==3.19.2 # importlib-metadata # The following packages are considered to be unsafe in a requirements file: -pip==23.3 +pip==24.2 # via pip-tools setuptools==70.3.0 # via pip-tools From 83d2650a55886b8e7d0b4ff853f3ae53ade455ee Mon Sep 17 00:00:00 2001 From: Jose Tomas Robles Hahn Date: Fri, 23 Aug 2024 13:39:03 -0400 Subject: [PATCH 04/20] =?UTF-8?q?chore(deps):=20Update=20`wheel`=20from=20?= =?UTF-8?q?=E2=89=A40.43.0=20to=200.44.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - [Software Repository](https://pypi.org/project/wheel/0.44.0/) - [Release notes](https://github.com/pypa/wheel/releases/tag/0.44.0) - [Changelog](https://github.com/pypa/wheel/blob/0.44.0/docs/news.rst) - [Commits](https://github.com/pypa/wheel/compare/0.43.0...0.44.0) --- pyproject.toml | 2 +- requirements-dev.in | 2 +- requirements-dev.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a852bd2c..b4e046f6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,6 +9,6 @@ [build-system] requires = [ "setuptools==70.3.0", - "wheel==0.41.3", + "wheel==0.44.0", ] build-backend = "setuptools.build_meta:__legacy__" diff --git a/requirements-dev.in b/requirements-dev.in index 128cfa57..6adecb3f 100644 --- a/requirements-dev.in +++ b/requirements-dev.in @@ -16,4 +16,4 @@ twine==5.1.1 types-jsonschema==4.22.0.20240610 types-pyOpenSSL==24.1.0.20240425 types-pytz==2024.1.0.20240417 -wheel==0.43.0 +wheel==0.44.0 diff --git a/requirements-dev.txt b/requirements-dev.txt index 1240b711..9f14d988 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -179,7 +179,7 @@ virtualenv==20.26.3 # via tox webencodings==0.5.1 # via bleach -wheel==0.43.0 +wheel==0.44.0 # via # -r requirements-dev.in # pip-tools From 1ebac1c34acef1b9ecf42d3498ca01da2822cfe3 Mon Sep 17 00:00:00 2001 From: Jose Tomas Robles Hahn Date: Fri, 23 Aug 2024 11:53:46 -0400 Subject: [PATCH 05/20] chore: Update documentation links in Python Project Configuration --- pyproject.toml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b4e046f6..f650d6b5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,12 @@ # Python Project Configuration # # Documentation: +# - https://packaging.python.org/en/latest/specifications/pyproject-toml/ +# (https://github.com/pypa/packaging.python.org/blob/caa20073/source/specifications/pyproject-toml.rst) # - https://pip.pypa.io/en/stable/reference/build-system/pyproject-toml/ -# - https://github.com/pypa/pip/blob/23.2.1/docs/html/reference/build-system/pyproject-toml.md -# - https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ -# - https://github.com/pypa/packaging.python.org/blob/df2c8b22/source/specifications/declaring-project-metadata.rst +# (https://github.com/pypa/pip/blob/24.2/docs/html/reference/build-system/pyproject-toml.md) +# - https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html +# (https://github.com/pypa/setuptools/blob/v70.3.0/docs/userguide/pyproject_config.rst) [build-system] requires = [ From fe06140f37acf29b8e0516bc8a26d34ef7de439d Mon Sep 17 00:00:00 2001 From: Jose Tomas Robles Hahn Date: Fri, 23 Aug 2024 12:53:47 -0400 Subject: [PATCH 06/20] chore: Replace Setuptools Config. with Python Project Configuration > Starting with PEP 621, the Python community selected `pyproject.toml` > as a standard way of specifying *project metadata*. `Setuptools` has > adopted this standard and will use the information contained in this > file as an input in the build process. Note: Some deprecated and/or obsolete options were not migrated from `setup.py` to `pyproject.toml`. See also: [How to modernize a `setup.py` based project?](https://packaging.python.org/en/latest/guides/modernize-setup-py-project/) ([GitHub](https://github.com/pypa/packaging.python.org/blob/bcbb476c/source/guides/modernize-setup-py-project.rst)) --- pyproject.toml | 77 +++++++++++++++++++++++++++++++++++++++- setup.py | 96 ++------------------------------------------------ 2 files changed, 78 insertions(+), 95 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f650d6b5..f87346de 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,4 +13,79 @@ requires = [ "setuptools==70.3.0", "wheel==0.44.0", ] -build-backend = "setuptools.build_meta:__legacy__" +build-backend = "setuptools.build_meta" + +[project] +name = "cl-sii" +dependencies = [ + "cryptography>=38.0.0", + "defusedxml>=0.6.0,<1", + "jsonschema>=3.1.1", + "lxml>=4.6.5,<6", + "marshmallow>=3,<4", + "pydantic>=2.3.0,!=1.7.*,!=1.8.*,!=1.9.*", + "pyOpenSSL>=22.0.0", + "pytz>=2019.3", + "signxml>=3.1.0", +] +requires-python = ">=3.8, <3.11" +authors = [ + {name = "Fyntex TI SpA", email = "no-reply@fyntex.ai"}, +] +description = "Python library for Servicio de Impuestos Internos (SII) of Chile." +readme = "README.md" +license = {text = "MIT"} +classifiers = [ + # See https://pypi.org/classifiers/ + "Development Status :: 3 - Alpha", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", +] +dynamic = ["version"] + +[project.optional-dependencies] +django = ["Django>=2.2.24"] +django-filter = ["django-filter>=24.2"] +djangorestframework = ["djangorestframework>=3.10.3,<3.16"] + +[project.urls] +Homepage = "https://github.com/fyntex/lib-cl-sii-python" +Changelog = "https://github.com/fyntex/lib-cl-sii-python/blob/develop/HISTORY.md" + +[tool.setuptools] +include-package-data = true +zip-safe = false + +[tool.setuptools.packages.find] +where = ["src"] +include = ["*"] +exclude = [ + "scripts", + "tests*", +] +namespaces = true + +[tool.setuptools.package-data] +# note: the "typing information" of this project's packages is not made available to its users +# automatically; it needs to be packaged and distributed. The way to do so is fairly new and +# it is specified in PEP 561 - "Distributing and Packaging Type Information". +# See: +# - https://www.python.org/dev/peps/pep-0561/#packaging-type-information +# - https://github.com/python/typing/issues/84 +# - https://github.com/python/mypy/issues/3930 +# warning: remember to replicate this in the manifest file for source distribution ('MANIFEST.in'). +cl_sii = [ + # Indicates that the "typing information" of the package should be distributed. + "py.typed", + # Data files that are not in a sub-package. + "data/cte/schemas-json/*.schema.json", + "data/ref/factura_electronica/schemas-xml/*.xsd", +] + +[tool.setuptools.dynamic] +version = {attr = "cl_sii.__version__"} diff --git a/setup.py b/setup.py index d39ae3e5..dd4e63e4 100644 --- a/setup.py +++ b/setup.py @@ -1,98 +1,6 @@ #!/usr/bin/env python -import os -import re -from typing import Sequence -from setuptools import find_packages, setup +from setuptools import setup -def get_version(*file_paths: str) -> str: - filename = os.path.join(os.path.dirname(__file__), *file_paths) - version_file = open(filename).read() - version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M) - if version_match: - return version_match.group(1) - raise RuntimeError('Unable to find version string.') - - -version = get_version('src', 'cl_sii', '__init__.py') - -readme = open('README.md').read() -history = open('HISTORY.md').read() - -requirements = [ - 'cryptography>=38.0.0', - 'defusedxml>=0.6.0,<1', - 'jsonschema>=3.1.1', - 'lxml>=4.6.5,<6', - 'marshmallow>=3,<4', - 'pydantic>=2.3.0,!=1.7.*,!=1.8.*,!=1.9.*', - 'pyOpenSSL>=22.0.0', - 'pytz>=2019.3', - 'signxml>=3.1.0', -] - -extras_requirements = { - 'django': ['Django>=2.2.24'], - 'django-filter': ['django-filter>=24.2'], - 'djangorestframework': ['djangorestframework>=3.10.3,<3.16'], -} - -setup_requirements: Sequence[str] = [] - -test_requirements: Sequence[str] = [ - # note: include here only packages **imported** in test code (e.g. 'requests-mock'), NOT those - # like 'coverage' or 'tox'. -] - -# note: the "typing information" of this project's packages is not made available to its users -# automatically; it needs to be packaged and distributed. The way to do so is fairly new and -# it is specified in PEP 561 - "Distributing and Packaging Type Information". -# See: -# - https://www.python.org/dev/peps/pep-0561/#packaging-type-information -# - https://github.com/python/typing/issues/84 -# - https://github.com/python/mypy/issues/3930 -# warning: remember to replicate this in the manifest file for source distribution ('MANIFEST.in'). -_package_data = { - 'cl_sii': [ - # Indicates that the "typing information" of the package should be distributed. - 'py.typed', - # Data files that are not in a sub-package. - 'data/cte/schemas-json/*.schema.json', - 'data/ref/factura_electronica/schemas-xml/*.xsd', - ], -} - -setup( - author='Fyntex TI SpA', - author_email='no-reply@fyntex.ai', - classifiers=[ - # See https://pypi.org/classifiers/ - 'Development Status :: 3 - Alpha', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Natural Language :: English', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - ], - description="""Python library for Servicio de Impuestos Internos (SII) of Chile.""", - extras_require=extras_requirements, - install_requires=requirements, - license="MIT", - long_description=readme + '\n\n' + history, - long_description_content_type='text/markdown', # for reStructuredText: 'text/x-rst' - include_package_data=True, - name='cl-sii', - package_data=_package_data, - package_dir={'': 'src'}, - packages=find_packages(where='src', exclude=['scripts', 'tests*']), - python_requires='>=3.8, <3.11', - setup_requires=setup_requirements, - test_suite='tests', - tests_require=test_requirements, - url='https://github.com/fyntex/lib-cl-sii-python', - version=version, - zip_safe=False, -) +setup() From 1fb632276cf121b4d2f53de1484964f6799ecc0e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 23 Aug 2024 18:59:29 +0000 Subject: [PATCH 07/20] chore: Bump jsonschema from 4.22.0 to 4.23.0 Bumps [jsonschema](https://github.com/python-jsonschema/jsonschema) from 4.22.0 to 4.23.0. - [Release notes](https://github.com/python-jsonschema/jsonschema/releases) - [Changelog](https://github.com/python-jsonschema/jsonschema/blob/main/CHANGELOG.rst) - [Commits](https://github.com/python-jsonschema/jsonschema/compare/v4.22.0...v4.23.0) --- updated-dependencies: - dependency-name: jsonschema dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.in | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.in b/requirements.in index 01ed5af9..6a51ec34 100644 --- a/requirements.in +++ b/requirements.in @@ -12,7 +12,7 @@ django-filter>=24.2 Django>=2.2.24 djangorestframework>=3.10.3,<3.16 importlib-metadata==7.1.0 -jsonschema==4.22.0 +jsonschema==4.23.0 lxml==5.2.2 marshmallow==3.21.3 pydantic==2.7.2 diff --git a/requirements.txt b/requirements.txt index bdf54e5f..8ed3c590 100644 --- a/requirements.txt +++ b/requirements.txt @@ -43,7 +43,7 @@ importlib-resources==6.4.0 # via # jsonschema # jsonschema-specifications -jsonschema==4.22.0 +jsonschema==4.23.0 # via -r requirements.in jsonschema-specifications==2023.12.1 # via jsonschema From e239c97a85a67b20ad1b8960ec40eec644bf18fd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 23 Aug 2024 19:03:16 +0000 Subject: [PATCH 08/20] chore: Bump the development-dependencies group with 7 updates Bumps the development-dependencies group with 7 updates in the / directory: | Package | From | To | | --- | --- | --- | | [black](https://github.com/psf/black) | `24.4.2` | `24.8.0` | | [coverage](https://github.com/nedbat/coveragepy) | `7.5.4` | `7.6.1` | | [flake8](https://github.com/pycqa/flake8) | `7.1.0` | `7.1.1` | | [mypy](https://github.com/python/mypy) | `1.10.1` | `1.11.1` | | [tox](https://github.com/tox-dev/tox) | `4.16.0` | `4.18.0` | | [types-jsonschema](https://github.com/python/typeshed) | `4.22.0.20240610` | `4.23.0.20240813` | | [types-pyopenssl](https://github.com/python/typeshed) | `24.1.0.20240425` | `24.1.0.20240722` | Updates `black` from 24.4.2 to 24.8.0 - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md) - [Commits](https://github.com/psf/black/compare/24.4.2...24.8.0) Updates `coverage` from 7.5.4 to 7.6.1 - [Release notes](https://github.com/nedbat/coveragepy/releases) - [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst) - [Commits](https://github.com/nedbat/coveragepy/compare/7.5.4...7.6.1) Updates `flake8` from 7.1.0 to 7.1.1 - [Commits](https://github.com/pycqa/flake8/compare/7.1.0...7.1.1) Updates `mypy` from 1.10.1 to 1.11.1 - [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md) - [Commits](https://github.com/python/mypy/compare/v1.10.1...v1.11.1) Updates `tox` from 4.16.0 to 4.18.0 - [Release notes](https://github.com/tox-dev/tox/releases) - [Changelog](https://github.com/tox-dev/tox/blob/main/docs/changelog.rst) - [Commits](https://github.com/tox-dev/tox/compare/4.16.0...4.18.0) Updates `types-jsonschema` from 4.22.0.20240610 to 4.23.0.20240813 - [Commits](https://github.com/python/typeshed/commits) Updates `types-pyopenssl` from 24.1.0.20240425 to 24.1.0.20240722 - [Commits](https://github.com/python/typeshed/commits) --- updated-dependencies: - dependency-name: black dependency-type: direct:development update-type: version-update:semver-minor dependency-group: development-dependencies - dependency-name: coverage dependency-type: direct:development update-type: version-update:semver-minor dependency-group: development-dependencies - dependency-name: flake8 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: development-dependencies - dependency-name: mypy dependency-type: direct:development update-type: version-update:semver-minor dependency-group: development-dependencies - dependency-name: tox dependency-type: direct:development update-type: version-update:semver-minor dependency-group: development-dependencies - dependency-name: types-jsonschema dependency-type: direct:development update-type: version-update:semver-minor dependency-group: development-dependencies - dependency-name: types-pyopenssl dependency-type: direct:development update-type: version-update:semver-patch dependency-group: development-dependencies ... Signed-off-by: dependabot[bot] --- requirements-dev.in | 14 +++++++------- requirements-dev.txt | 16 ++++++++-------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/requirements-dev.in b/requirements-dev.in index 6adecb3f..3f3bb4db 100644 --- a/requirements-dev.in +++ b/requirements-dev.in @@ -4,16 +4,16 @@ -c requirements.txt -black==24.4.2 +black==24.8.0 bumpversion==0.5.3 -coverage==7.5.4 -flake8==7.1.0 +coverage==7.6.1 +flake8==7.1.1 isort==5.13.2 -mypy==1.10.1 +mypy==1.11.1 pip-tools==7.4.1 -tox==4.16.0 +tox==4.18.0 twine==5.1.1 -types-jsonschema==4.22.0.20240610 -types-pyOpenSSL==24.1.0.20240425 +types-jsonschema==4.23.0.20240813 +types-pyOpenSSL==24.1.0.20240722 types-pytz==2024.1.0.20240417 wheel==0.44.0 diff --git a/requirements-dev.txt b/requirements-dev.txt index 9f14d988..7971f92a 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -8,7 +8,7 @@ attrs==23.2.0 # via # -c requirements.txt # referencing -black==24.4.2 +black==24.8.0 # via -r requirements-dev.in bleach==5.0.1 # via readme-renderer @@ -16,7 +16,7 @@ build==1.0.3 # via pip-tools bumpversion==0.5.3 # via -r requirements-dev.in -cachetools==5.3.3 +cachetools==5.5.0 # via tox certifi==2024.7.4 # via @@ -36,7 +36,7 @@ click==8.0.3 # pip-tools colorama==0.4.6 # via tox -coverage==7.5.4 +coverage==7.6.1 # via -r requirements-dev.in cryptography==42.0.8 # via @@ -51,7 +51,7 @@ filelock==3.15.4 # via # tox # virtualenv -flake8==7.1.0 +flake8==7.1.1 # via -r requirements-dev.in idna==3.7 # via requests @@ -74,7 +74,7 @@ mccabe==0.7.0 # via flake8 mdurl==0.1.2 # via markdown-it-py -mypy==1.10.1 +mypy==1.11.1 # via -r requirements-dev.in mypy-extensions==1.0.0 # via @@ -151,15 +151,15 @@ tomli==2.0.1 # pyproject-api # pyproject-hooks # tox -tox==4.16.0 +tox==4.18.0 # via -r requirements-dev.in twine==5.1.1 # via -r requirements-dev.in types-cffi==1.16.0.20240331 # via types-pyopenssl -types-jsonschema==4.22.0.20240610 +types-jsonschema==4.23.0.20240813 # via -r requirements-dev.in -types-pyopenssl==24.1.0.20240425 +types-pyopenssl==24.1.0.20240722 # via -r requirements-dev.in types-pytz==2024.1.0.20240417 # via -r requirements-dev.in From da84feb45852860f549bb982d8f5371e3f5dffa3 Mon Sep 17 00:00:00 2001 From: Jose Tomas Robles Hahn Date: Fri, 23 Aug 2024 15:07:06 -0400 Subject: [PATCH 09/20] chore: Reformat source code using 'Black' --- src/scripts/clean_dte_xml_file.py | 20 ++++++++------------ src/scripts/example.py | 4 ++-- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/scripts/clean_dte_xml_file.py b/src/scripts/clean_dte_xml_file.py index 3f846902..cb1f3ca9 100755 --- a/src/scripts/clean_dte_xml_file.py +++ b/src/scripts/clean_dte_xml_file.py @@ -62,17 +62,16 @@ def clean_dte_xml_file(input_file_path: str, output_file_path: str) -> Iterable[ # note: another way to compute the difference in a similar format is # `diff -Naur $input_file_path $output_file_path` file_bytes_diff_gen = difflib.diff_bytes( - dfunc=difflib.unified_diff, - a=file_bytes.splitlines(), - b=file_bytes_rewritten.splitlines()) + dfunc=difflib.unified_diff, a=file_bytes.splitlines(), b=file_bytes_rewritten.splitlines() + ) return file_bytes_diff_gen def main_single_file(input_file_path: str, output_file_path: str) -> None: file_bytes_diff_gen = clean_dte_xml_file( - input_file_path=input_file_path, - output_file_path=output_file_path) + input_file_path=input_file_path, output_file_path=output_file_path + ) for diff_line in file_bytes_diff_gen: print(diff_line) @@ -89,8 +88,8 @@ def main_dir_files(input_files_dir_path: str) -> None: print(f"\n\nWill clean file '{input_file_path}' and save it to '{output_file_path}'.") file_bytes_diff_gen = clean_dte_xml_file( - input_file_path=input_file_path, - output_file_path=output_file_path) + input_file_path=input_file_path, output_file_path=output_file_path + ) print("Difference between input and output files:") diff_line = None @@ -102,11 +101,8 @@ def main_dir_files(input_files_dir_path: str) -> None: if __name__ == '__main__': if sys.argv[1] == 'file': - main_single_file( - input_file_path=sys.argv[2], - output_file_path=sys.argv[3]) + main_single_file(input_file_path=sys.argv[2], output_file_path=sys.argv[3]) elif sys.argv[1] == 'dir': - main_dir_files( - input_files_dir_path=sys.argv[2]) + main_dir_files(input_files_dir_path=sys.argv[2]) else: raise ValueError(f"Invalid option: '{sys.argv[1]}'") diff --git a/src/scripts/example.py b/src/scripts/example.py index 8c4259af..5c88cf19 100755 --- a/src/scripts/example.py +++ b/src/scripts/example.py @@ -49,6 +49,7 @@ # script ############################################################################### + def main(args: Sequence[str]) -> None: start_ts = datetime.now() @@ -57,8 +58,7 @@ def main(args: Sequence[str]) -> None: try: print("Action: do something") except FileNotFoundError: - logger.exception( - "Process aborted: a file could not be opened.", exc_info=True) + logger.exception("Process aborted: a file could not be opened.", exc_info=True) except KeyboardInterrupt: logger.error("Process interrupted by user.") except Exception: From 827d811f7a5914600fde7c9fc7511ffd6318bf97 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 23 Aug 2024 20:58:38 +0000 Subject: [PATCH 10/20] chore: Bump the production-dependencies group with 2 updates Bumps the production-dependencies group with 2 updates in the / directory: [actions/upload-artifact](https://github.com/actions/upload-artifact) and [actions/dependency-review-action](https://github.com/actions/dependency-review-action). Updates `actions/upload-artifact` from 4.3.4 to 4.3.6 - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v4.3.4...v4.3.6) Updates `actions/dependency-review-action` from 4.3.3 to 4.3.4 - [Release notes](https://github.com/actions/dependency-review-action/releases) - [Commits](https://github.com/actions/dependency-review-action/compare/v4.3.3...v4.3.4) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-patch dependency-group: production-dependencies - dependency-name: actions/dependency-review-action dependency-type: direct:production update-type: version-update:semver-patch dependency-group: production-dependencies ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yaml | 2 +- .github/workflows/dependency-review.yaml | 2 +- .github/workflows/release.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f4e86776..ba8d588d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -137,7 +137,7 @@ jobs: - name: Store Artifacts if: ${{ always() }} - uses: actions/upload-artifact@v4.3.4 + uses: actions/upload-artifact@v4.3.6 with: name: test_reports_${{ matrix.python_version }} path: test-reports/ diff --git a/.github/workflows/dependency-review.yaml b/.github/workflows/dependency-review.yaml index 865a3540..2bff4f41 100644 --- a/.github/workflows/dependency-review.yaml +++ b/.github/workflows/dependency-review.yaml @@ -24,6 +24,6 @@ jobs: uses: actions/checkout@v4.1.7 - name: Dependency Review - uses: actions/dependency-review-action@v4.3.3 + uses: actions/dependency-review-action@v4.3.4 with: fail-on-severity: critical diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index a73732aa..4842f76f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -68,7 +68,7 @@ jobs: make dist - name: Store Artifacts - uses: actions/upload-artifact@v4.3.4 + uses: actions/upload-artifact@v4.3.6 with: name: release path: ${{ env.ARTIFACTS_PATH }}/ From 5d6fb278969d9da009cf7437777a4d438a2bb9b1 Mon Sep 17 00:00:00 2001 From: Jose Tomas Robles Hahn Date: Fri, 23 Aug 2024 17:16:40 -0400 Subject: [PATCH 11/20] fix: Test coverage broken by migration from setup.py to pyproject.toml `setup.py test` has been deprecated for years. See: - https://github.com/pypa/setuptools/issues/1684 - https://github.com/pypa/setuptools/pull/4522 --- Makefile | 2 +- tox.ini | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 41faa1bd..41c87fc8 100644 --- a/Makefile +++ b/Makefile @@ -101,7 +101,7 @@ test-all: ## run tests on every Python version with tox tox test-coverage: ## run tests and record test coverage - coverage run --rcfile=setup.cfg setup.py test + coverage run --rcfile=setup.cfg -m unittest discover -v -c -b -s src -t src test-coverage-report: test-coverage-report-console test-coverage-report: test-coverage-report-xml diff --git a/tox.ini b/tox.ini index 1fe875ad..769cf9bc 100644 --- a/tox.ini +++ b/tox.ini @@ -7,7 +7,7 @@ envlist = [testenv] setenv = PYTHONPATH = {toxinidir}:{toxinidir}/cl_sii -commands = coverage run --rcfile=setup.cfg setup.py test +commands = coverage run --rcfile=setup.cfg -m unittest discover -v -c -b -s src -t src deps = -r{toxinidir}/requirements.txt -r{toxinidir}/requirements-dev.txt From 996c44744b2b4eaa58de90058c507b7c50956b0d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 23 Aug 2024 19:12:07 +0000 Subject: [PATCH 12/20] chore: Bump pyopenssl from 24.1.0 to 24.2.1 Bumps [pyopenssl](https://github.com/pyca/pyopenssl) from 24.1.0 to 24.2.1. - [Changelog](https://github.com/pyca/pyopenssl/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pyca/pyopenssl/compare/24.1.0...24.2.1) --- updated-dependencies: - dependency-name: pyopenssl dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.in | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.in b/requirements.in index 6a51ec34..8dc53b57 100644 --- a/requirements.in +++ b/requirements.in @@ -16,6 +16,6 @@ jsonschema==4.23.0 lxml==5.2.2 marshmallow==3.21.3 pydantic==2.7.2 -pyOpenSSL==24.1.0 +pyOpenSSL==24.2.1 pytz==2024.1 signxml==3.2.2 diff --git a/requirements.txt b/requirements.txt index 8ed3c590..8d119b36 100644 --- a/requirements.txt +++ b/requirements.txt @@ -63,7 +63,7 @@ pydantic==2.7.2 # via -r requirements.in pydantic-core==2.18.3 # via pydantic -pyopenssl==24.1.0 +pyopenssl==24.2.1 # via # -r requirements.in # signxml From 500d1b592819b0997d5bdae8df605c3fdc125477 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 23 Aug 2024 23:12:14 +0000 Subject: [PATCH 13/20] chore(deps): Bump importlib-metadata from 7.1.0 to 8.4.0 Bumps [importlib-metadata](https://github.com/python/importlib_metadata) from 7.1.0 to 8.4.0. - [Release notes](https://github.com/python/importlib_metadata/releases) - [Changelog](https://github.com/python/importlib_metadata/blob/main/NEWS.rst) - [Commits](https://github.com/python/importlib_metadata/compare/v7.1.0...v8.4.0) --- updated-dependencies: - dependency-name: importlib-metadata dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- requirements-dev.txt | 2 +- requirements.in | 2 +- requirements.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 7971f92a..f44ecc6d 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -55,7 +55,7 @@ flake8==7.1.1 # via -r requirements-dev.in idna==3.7 # via requests -importlib-metadata==7.1.0 +importlib-metadata==8.4.0 # via # -c requirements.txt # build diff --git a/requirements.in b/requirements.in index 8dc53b57..a514d458 100644 --- a/requirements.in +++ b/requirements.in @@ -11,7 +11,7 @@ defusedxml==0.7.1 django-filter>=24.2 Django>=2.2.24 djangorestframework>=3.10.3,<3.16 -importlib-metadata==7.1.0 +importlib-metadata==8.4.0 jsonschema==4.23.0 lxml==5.2.2 marshmallow==3.21.3 diff --git a/requirements.txt b/requirements.txt index 8d119b36..7996cb6b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -37,7 +37,7 @@ django-filter==24.2 # via -r requirements.in djangorestframework==3.15.2 # via -r requirements.in -importlib-metadata==7.1.0 +importlib-metadata==8.4.0 # via -r requirements.in importlib-resources==6.4.0 # via From 9cf5c3930b342ee2087b0c68c07dfcaebb9cddc9 Mon Sep 17 00:00:00 2001 From: Jose Tomas Robles Hahn Date: Wed, 28 Aug 2024 18:16:27 -0400 Subject: [PATCH 14/20] chore: Move Flake8 configuration from `setup.cfg` to its own file --- .flake8 | 20 ++++++++++++++++++++ setup.cfg | 21 --------------------- 2 files changed, 20 insertions(+), 21 deletions(-) create mode 100644 .flake8 diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..7b8f6f64 --- /dev/null +++ b/.flake8 @@ -0,0 +1,20 @@ +[flake8] +ignore = + # W503 line break before binary operator + W503 + +exclude = + *.egg-info/, + .git/, + .mypy_cache/, + .pyenvs/, + __pycache__/, + build/, + dist/, + docs/ + +max-line-length = 100 + +doctests = True +show-source = True +statistics = True diff --git a/setup.cfg b/setup.cfg index 3746bf09..57612edb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,24 +19,3 @@ output = test-reports/coverage/xml/coverage.xml [coverage:html] directory = test-reports/coverage/html - -[flake8] -ignore = - # W503 line break before binary operator - W503 - -exclude = - *.egg-info/, - .git/, - .mypy_cache/, - .pyenvs/, - __pycache__/, - build/, - dist/, - docs/ - -max-line-length = 100 - -doctests = True -show-source = True -statistics = True From 7a4e171a37e386f9348b9110ec72509ee09069ac Mon Sep 17 00:00:00 2001 From: Jose Tomas Robles Hahn Date: Wed, 28 Aug 2024 18:26:29 -0400 Subject: [PATCH 15/20] chore: Move Coverage.py configuration from `setup.cfg` to its own file --- .coveragerc.test.ini | 18 ++++++++++++++++++ Makefile | 8 ++++---- setup.cfg | 19 ------------------- tox.ini | 2 +- 4 files changed, 23 insertions(+), 24 deletions(-) create mode 100644 .coveragerc.test.ini diff --git a/.coveragerc.test.ini b/.coveragerc.test.ini new file mode 100644 index 00000000..295b959a --- /dev/null +++ b/.coveragerc.test.ini @@ -0,0 +1,18 @@ +[run] +source = src/ +omit = + src/scripts/* + src/tests/* +branch = True + +[report] +exclude_lines = + pragma: no cover + if __name__ == .__main__. +show_missing = True + +[xml] +output = test-reports/coverage/xml/coverage.xml + +[html] +directory = test-reports/coverage/html diff --git a/Makefile b/Makefile index 41c87fc8..ec5b85ec 100644 --- a/Makefile +++ b/Makefile @@ -101,7 +101,7 @@ test-all: ## run tests on every Python version with tox tox test-coverage: ## run tests and record test coverage - coverage run --rcfile=setup.cfg -m unittest discover -v -c -b -s src -t src + coverage run --rcfile=.coveragerc.test.ini -m unittest discover -v -c -b -s src -t src test-coverage-report: test-coverage-report-console test-coverage-report: test-coverage-report-xml @@ -109,13 +109,13 @@ test-coverage-report: test-coverage-report-html test-coverage-report: ## Run tests, measure code coverage, and generate reports test-coverage-report-console: ## print test coverage summary - coverage report --rcfile=setup.cfg -m + coverage report --rcfile=.coveragerc.test.ini -m test-coverage-report-xml: ## Generate test coverage XML report - coverage xml --rcfile=setup.cfg + coverage xml --rcfile=.coveragerc.test.ini test-coverage-report-html: ## generate test coverage HTML report - coverage html --rcfile=setup.cfg + coverage html --rcfile=.coveragerc.test.ini build: ## Build Python package $(PYTHON) setup.py build diff --git a/setup.cfg b/setup.cfg index 57612edb..526aeb28 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,21 +1,2 @@ [bdist_wheel] universal = 0 - -[coverage:run] -source = src/ -omit = - src/scripts/* - src/tests/* -branch = True - -[coverage:report] -exclude_lines = - pragma: no cover - if __name__ == .__main__. -show_missing = True - -[coverage:xml] -output = test-reports/coverage/xml/coverage.xml - -[coverage:html] -directory = test-reports/coverage/html diff --git a/tox.ini b/tox.ini index 769cf9bc..779afe35 100644 --- a/tox.ini +++ b/tox.ini @@ -7,7 +7,7 @@ envlist = [testenv] setenv = PYTHONPATH = {toxinidir}:{toxinidir}/cl_sii -commands = coverage run --rcfile=setup.cfg -m unittest discover -v -c -b -s src -t src +commands = coverage run --rcfile=.coveragerc.test.ini -m unittest discover -v -c -b -s src -t src deps = -r{toxinidir}/requirements.txt -r{toxinidir}/requirements-dev.txt From 7a805c8f8b2435c37075d15a52b7e54b2e40deee Mon Sep 17 00:00:00 2001 From: Jose Tomas Robles Hahn Date: Wed, 28 Aug 2024 18:51:13 -0400 Subject: [PATCH 16/20] chore: Replace `setup.py sdist` and `bdist_wheel` with `build` Setuptools has deprecated `python setup.py sdist` and `python setup.py bdist_wheel` in favor of `python -m build`. This commit replaces the deprecated commands with the new `python -m build` command in `Makefile`, and moves the tool's configuration from `setup.cfg` to `pyproject.toml`. See also: [How to modernize a `setup.py`` based project?](https://packaging.python.org/en/latest/guides/modernize-setup-py-project/) ([GitHub](https://github.com/pypa/packaging.python.org/blob/afb69f3d/source/guides/modernize-setup-py-project.rst)) --- Makefile | 4 ++-- pyproject.toml | 3 +++ setup.cfg | 2 -- 3 files changed, 5 insertions(+), 4 deletions(-) delete mode 100644 setup.cfg diff --git a/Makefile b/Makefile index ec5b85ec..cc9e3f57 100644 --- a/Makefile +++ b/Makefile @@ -121,8 +121,8 @@ build: ## Build Python package $(PYTHON) setup.py build dist: build ## builds source and wheel package - python setup.py sdist - python setup.py bdist_wheel + python -m build --sdist + python -m build --wheel twine check dist/* ls -l dist diff --git a/pyproject.toml b/pyproject.toml index f87346de..c6b22efc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -89,3 +89,6 @@ cl_sii = [ [tool.setuptools.dynamic] version = {attr = "cl_sii.__version__"} + +[tool.distutils.bdist_wheel] +universal = false diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 526aeb28..00000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[bdist_wheel] -universal = 0 From a4f75663510cee3d32f38c766c7e954707d7d934 Mon Sep 17 00:00:00 2001 From: Jose Tomas Robles Hahn Date: Wed, 28 Aug 2024 18:58:11 -0400 Subject: [PATCH 17/20] chore(deps): Install Python package `build` > A simple, correct Python build frontend. - [Web Site](https://build.pypa.io/) - [VCS Repository](https://github.com/pypa/build.git) - [Documentation](https://build.pypa.io/) - [Software Repository](https://pypi.org/project/build/) --- requirements-dev.in | 1 + requirements-dev.txt | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/requirements-dev.in b/requirements-dev.in index 3f3bb4db..4a3b3e98 100644 --- a/requirements-dev.in +++ b/requirements-dev.in @@ -5,6 +5,7 @@ -c requirements.txt black==24.8.0 +build==1.0.3 bumpversion==0.5.3 coverage==7.6.1 flake8==7.1.1 diff --git a/requirements-dev.txt b/requirements-dev.txt index f44ecc6d..fa0cd541 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -13,7 +13,9 @@ black==24.8.0 bleach==5.0.1 # via readme-renderer build==1.0.3 - # via pip-tools + # via + # -r requirements-dev.in + # pip-tools bumpversion==0.5.3 # via -r requirements-dev.in cachetools==5.5.0 From e1479783a972eb5355f6e1a60b7ac240c2f76282 Mon Sep 17 00:00:00 2001 From: Jose Tomas Robles Hahn Date: Wed, 28 Aug 2024 19:11:52 -0400 Subject: [PATCH 18/20] chore: When running `twine check`, fail on warnings --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index cc9e3f57..14542897 100644 --- a/Makefile +++ b/Makefile @@ -123,7 +123,7 @@ build: ## Build Python package dist: build ## builds source and wheel package python -m build --sdist python -m build --wheel - twine check dist/* + twine check --strict dist/* ls -l dist upload-release: ## upload dist packages From e6126cfbccb2de04e966ce9379f928f017fab32c Mon Sep 17 00:00:00 2001 From: Jose Tomas Robles Hahn Date: Wed, 28 Aug 2024 19:20:19 -0400 Subject: [PATCH 19/20] chore: Update history for new version --- HISTORY.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/HISTORY.md b/HISTORY.md index f588b139..3c83184f 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,23 @@ # History +## 0.32.0 (2024-08-28) + +- (PR #660, 2024-08-23) chore: Bump setuptools from 65.5.1 to 70.3.0 +- (PR #672, 2024-08-23) chore: Bump django from 4.2.14 to 4.2.15 +- (PR #676, 2024-08-23) chore(deps): Update `pip` from 23.3 to 24.2 +- (PR #677, 2024-08-23) chore(deps): Update `wheel` from ≤0.43.0 to 0.44.0 +- (PR #675, 2024-08-23) Replace Setuptools Configuration with Python Project Configuration +- (PR #670, 2024-08-23) chore: Bump jsonschema from 4.22.0 to 4.23.0 +- (PR #678, 2024-08-23) chore: Bump the development-dependencies group across 1 directory with 7 updates +- (PR #679, 2024-08-23) chore: Bump the production-dependencies group across 1 directory with 2 updates +- (PR #680, 2024-08-23) Test coverage broken by migration from `setup.py` to `pyproject.toml` +- (PR #668, 2024-08-23) chore: Bump pyopenssl from 24.1.0 to 24.2.1 +- (PR #673, 2024-08-23) chore(deps): Bump importlib-metadata from 7.1.0 to 8.4.0 +- (PR #681, 2024-08-28) Move Flake8 configuration from `setup.cfg` to its own file +- (PR #682, 2024-08-28) Move Coverage.py configuration from `setup.cfg` to its own file +- (PR #683, 2024-08-28) Replace `setup.py sdist` and `bdist_wheel` with `build` +- (PR #684, 2024-08-28) When running `twine check`, fail on warnings + ## 0.31.0 (2024-07-17) - (PR #661, 2024-07-17) extras: Add `RutFilter` for Django views and DRF views From 1530138df1ec09b770ba3492092619180e0d6b93 Mon Sep 17 00:00:00 2001 From: Jose Tomas Robles Hahn Date: Wed, 28 Aug 2024 19:20:38 -0400 Subject: [PATCH 20/20] chore: Bump version from 0.31.0 to 0.32.0 --- .bumpversion.cfg | 2 +- src/cl_sii/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index bcf97b41..c8aa3d1d 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.31.0 +current_version = 0.32.0 commit = True tag = False message = chore: Bump version from {current_version} to {new_version} diff --git a/src/cl_sii/__init__.py b/src/cl_sii/__init__.py index 67546f89..2826ea58 100644 --- a/src/cl_sii/__init__.py +++ b/src/cl_sii/__init__.py @@ -4,4 +4,4 @@ """ -__version__ = '0.31.0' +__version__ = '0.32.0'