From 770cd2f05ec4f399996abf8a2912510dc4e6f0d8 Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Fri, 8 Mar 2024 11:34:30 +0100 Subject: [PATCH 1/2] Add support for Python 3.12, drop support for Django 4.1 Update actions versions --- .github/workflows/ci.yml | 16 +++++++++------- .github/workflows/code_quality.yml | 6 +++--- setup.cfg | 2 +- tox.ini | 13 ++++++------- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc76742..0725591 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,17 +15,19 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: ["3.8", "3.9", "3.10", "3.11"] - django: ["3.2", "4.1", "4.2"] + python: ["3.8", "3.9", "3.10", "3.11", "3.12"] + django: ["3.2", "4.2"] exclude: - python: "3.11" django: "3.2" + - python: "3.12" + django: "3.2" name: Run the test suite (Python ${{ matrix.python }}, Django ${{ matrix.django }}) steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} @@ -49,10 +51,10 @@ jobs: if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: - python-version: "3.9" + python-version: "3.10" - name: Build sdist and wheel run: | diff --git a/.github/workflows/code_quality.yml b/.github/workflows/code_quality.yml index ee4813e..171f469 100644 --- a/.github/workflows/code_quality.yml +++ b/.github/workflows/code_quality.yml @@ -22,10 +22,10 @@ jobs: matrix: toxenv: [isort, black, flake8, docs] steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: - python-version: "3.9" + python-version: "3.10" - name: Install dependencies run: pip install tox - run: tox diff --git a/setup.cfg b/setup.cfg index 6faf394..63749c2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,7 +19,6 @@ classifiers = Development Status :: 3 - Alpha Framework :: Django Framework :: Django :: 3.2 - Framework :: Django :: 4.1 Framework :: Django :: 4.2 Intended Audience :: Developers Operating System :: Unix @@ -29,6 +28,7 @@ classifiers = Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 Topic :: Software Development :: Libraries :: Python Modules [options] diff --git a/tox.ini b/tox.ini index 202e8c9..b95c0bc 100644 --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,8 @@ [tox] envlist = - py{38,39,310}-django{32,41,42} - py{38,39,310}-django{32,41,42}-celery - py{311}-django{41,42} + py{38,39,310}-django{32,42} + py{38,39,310}-django{32,42}-celery + py{311,312}-django42 celery isort black @@ -16,11 +16,11 @@ python = 3.9: py39 3.10: py310 3.11: py311 + 3.12: py312 [gh-actions:env] DJANGO = 3.2: django32 - 4.1: django41 4.2: django42 [testenv] @@ -38,11 +38,10 @@ extras = coverage deps = django32: Django~=3.2.0 - django41: Django~=4.1.0 django42: Django~=4.2.0 celery: celery commands = - py.test tests \ + pytest tests \ --cov --cov-report xml:reports/coverage-{envname}.xml \ {posargs} @@ -70,6 +69,6 @@ extras = tests docs commands= - py.test check_sphinx.py -v \ + pytest check_sphinx.py -v \ --tb=auto \ {posargs} From 75c5305bd6d2afa58d841150a46cc78bf0c66bef Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Fri, 8 Mar 2024 11:43:52 +0100 Subject: [PATCH 2/2] Use `pyproject.toml` --- .bumpversion.cfg | 10 -- .flake8 | 4 + .github/workflows/ci.yml | 12 +- README.rst | 1 - .../locale/nl/LC_MESSAGES/django.po | 2 +- pyproject.toml | 125 ++++++++++++++++++ setup.cfg | 116 ---------------- setup.py | 3 - tox.ini | 2 +- 9 files changed, 136 insertions(+), 139 deletions(-) delete mode 100644 .bumpversion.cfg create mode 100644 .flake8 create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.bumpversion.cfg b/.bumpversion.cfg deleted file mode 100644 index bf2e103..0000000 --- a/.bumpversion.cfg +++ /dev/null @@ -1,10 +0,0 @@ -[bumpversion] -commit = False -tag = False -current_version = 0.6.1 - -[bumpversion:file:setup.cfg] - -[bumpversion:file:README.rst] - -[bumpversion:file:docs/conf.py] diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..03d67fa --- /dev/null +++ b/.flake8 @@ -0,0 +1,4 @@ +[flake8] +max-line-length=88 +exclude=env,.tox,doc +ignore=E203,W503,E501 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0725591..69560ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,12 +56,10 @@ jobs: with: python-version: "3.10" - - name: Build sdist and wheel + - name: Build wheel run: | - pip install pip setuptools wheel --upgrade - python setup.py sdist bdist_wheel + pip install build --upgrade + python -m build + - name: Publish a Python distribution to PyPI - uses: pypa/gh-action-pypi-publish@v1.5.1 - with: - user: __token__ - password: ${{ secrets.PYPI_TOKEN }} + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/README.rst b/README.rst index 5415e38..fd0906e 100644 --- a/README.rst +++ b/README.rst @@ -4,7 +4,6 @@ django-log-outgoing-requests :Version: 0.6.1 :Source: https://github.com/maykinmedia/django-log-outgoing-requests :Keywords: logging, django, requests -:PythonVersion: 3.8+ |build-status| |code-quality| |black| |coverage| |docs| diff --git a/log_outgoing_requests/locale/nl/LC_MESSAGES/django.po b/log_outgoing_requests/locale/nl/LC_MESSAGES/django.po index 4c332b9..c572f43 100644 --- a/log_outgoing_requests/locale/nl/LC_MESSAGES/django.po +++ b/log_outgoing_requests/locale/nl/LC_MESSAGES/django.po @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: 0.2.0\n" +"Project-Id-Version: 0.6.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-06-09 05:11-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..bf15abb --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,125 @@ +[build-system] +requires = ["setuptools>=61.0.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "django-log-outgoing-requests" +version = "0.6.1" +description = "Log outgoing requests made by the requests python library" +authors = [ + {name = "Maykin Media", email = "support@maykinmedia.nl"} +] +readme = "README.rst" +license = {file = "LICENSE"} +keywords = ["Django", "logging", "requests"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Framework :: Django", + "Framework :: Django :: 3.2", + "Framework :: Django :: 4.2", + "Intended Audience :: Developers", + "Operating System :: Unix", + "Operating System :: MacOS", + "Operating System :: Microsoft :: Windows", + "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", + "Topic :: Software Development :: Libraries :: Python Modules", +] +requires-python = ">=3.8" +dependencies = [ + "django>=3.2", + "requests", + "django-appconf", + "django-solo", +] + +[project.urls] +Homepage = "https://github.com/maykinmedia/django-log-outgoing-requests" +Documentation = "http://django-log-outgoing-requests.readthedocs.io/en/latest/" +"Bug Tracker" = "https://github.com/maykinmedia/django-log-outgoing-requests/issues" +"Source Code" = "https://github.com/maykinmedia/django-log-outgoing-requests" +Changelog = "https://github.com/maykinmedia/django-log-outgoing-requests/blob/main/CHANGELOG.rst" + +[project.optional-dependencies] +celery = [ + "celery", +] +tests = [ + "pytest", + "pytest-django", + "pytest-mock", + "pyquery", + "tox", + "isort", + "black", + "flake8", + "freezegun", + "requests-mock", +] +coverage = [ + "pytest-cov", +] +docs = [ + "sphinx", + "sphinx-rtd-theme", +] +release = [ + "bump-my-version", +] + +[tool.setuptools.packages.find] +include = ["log_outgoing_requests*"] +namespaces = false + +[tool.isort] +profile = "black" +combine_as_imports = true +known_django = "django" +known_first_party="log_outgoing_requests" +sections=["FUTURE", "STDLIB", "DJANGO", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"] +skip = ["env", ".tox", ".history"] + +[tool.pytest.ini_options] +testpaths = ["tests"] +filterwarnings = [ + "error:DateTimeField .* received a naive datetime:RuntimeWarning:django.db.models.fields", +] +DJANGO_SETTINGS_MODULE = "testapp.settings" + +[tool.bumpversion] +current_version = "0.6.1" +files = [ + {filename = "pyproject.toml"}, + {filename = "README.rst"}, + {filename = "log_outgoing_requests/locale/nl/LC_MESSAGES/django.po"}, + {filename = "docs/conf.py"}, +] + +[tool.coverage.run] +branch = true +source = [ + "log_outgoing_requests" +] +omit = [ + "log_outgoing_requests/migrations/*", +] + +[tool.coverage.report] +exclude_also = [ + "if (typing\\.)?TYPE_CHECKING:", + "@(typing\\.)?overload", + "class .*\\(.*Protocol.*\\):", + "@(abc\\.)?abstractmethod", + "raise NotImplementedError", + "\\.\\.\\.", + "pass", +] +omit = [ + "log_outgoing_requests/migrations/*", +] + +[tool.coverage.html] +directory = "cover" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 63749c2..0000000 --- a/setup.cfg +++ /dev/null @@ -1,116 +0,0 @@ -# setuptools config -# see http://setuptools.readthedocs.io/en/latest/setuptools.html#configuring-setup-using-setup-cfg-files -[metadata] -name = django-log-outgoing-requests -version = 0.6.1 -description = Log outgoing requests made by the requests python library -long_description = file: README.rst -url = https://github.com/maykinmedia/django-log-outgoing-requests -project_urls = - Documentation = http://django-log-outgoing-requests.readthedocs.io/en/latest/ - Changelog = https://github.com/maykinmedia/django-log-outgoing-requests/blob/main/CHANGELOG.rst - Bug Tracker = https://github.com/maykinmedia/django-log-outgoing-requests/issues - Source Code = https://github.com/maykinmedia/django-log-outgoing-requests -license = MIT -author = Maykin Media -author_email = support@maykinmedia.nl -keywords = logging -classifiers = - Development Status :: 3 - Alpha - Framework :: Django - Framework :: Django :: 3.2 - Framework :: Django :: 4.2 - Intended Audience :: Developers - Operating System :: Unix - Operating System :: MacOS - Operating System :: Microsoft :: Windows - 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 - Topic :: Software Development :: Libraries :: Python Modules - -[options] -zip_safe = False -include_package_data = True -packages = find: -install_requires = - django >= 3.2 - requests - django-appconf - django-solo -tests_require = - pytest - pytest-django - pytest-mock - tox - isort - black - flake8 - freezegun - requests-mock - pyquery - -[options.packages.find] -include = - log_outgoing_requests - log_outgoing_requests.* - -[options.extras_require] -celery = - celery -tests = - pytest - pytest-django - pytest-mock - pyquery - tox - isort - black - flake8 - freezegun - requests-mock -pep8 = flake8 -coverage = pytest-cov -docs = - sphinx - sphinx-rtd-theme -release = - bump2version - twine - -# 3rd party configuration - -[aliases] -test=pytest - -[isort] -combine_as_imports = true -default_section = THIRDPARTY -include_trailing_comma = true -line_length = 88 -multi_line_output = 3 -force_grid_wrap = 0 -use_parentheses = True -ensure_newline_before_comments = True -skip = env,.tox,.history,.eggs -known_django=django -known_first_party=log_outgoing_requests -sections=FUTURE,STDLIB,DJANGO,THIRDPARTY,FIRSTPARTY,LOCALFOLDER - -[tool:pytest] -testpaths = tests -DJANGO_SETTINGS_MODULE=testapp.settings -filterwarnings = - error:DateTimeField .* received a naive datetime:RuntimeWarning:django.db.models.fields - -[pep8] -[flake8] -max-line-length=88 -exclude=env,.tox,doc -ignore=E203,W503,E501 - -[coverage:run] -branch = True -source = log_outgoing_requests diff --git a/setup.py b/setup.py deleted file mode 100644 index 6068493..0000000 --- a/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -from setuptools import setup - -setup() diff --git a/tox.ini b/tox.ini index b95c0bc..d5772eb 100644 --- a/tox.ini +++ b/tox.ini @@ -53,7 +53,7 @@ commands = isort --check-only --diff . [testenv:black] extras = tests skipsdist = True -commands = black --check log_outgoing_requests docs testapp tests setup.py +commands = black --check log_outgoing_requests docs testapp tests [testenv:flake8] extras = tests