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 cc76742..5ad523a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ on: branches: - main tags: - - "*" + - '*' pull_request: workflow_dispatch: @@ -15,17 +15,14 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: ["3.8", "3.9", "3.10", "3.11"] - django: ["3.2", "4.1", "4.2"] - exclude: - - python: "3.11" - django: "3.2" + python: ['3.10', '3.11', '3.12'] + django: ['4.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 }} @@ -39,27 +36,30 @@ jobs: DJANGO: ${{ matrix.django }} - name: Publish coverage report - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} publish: name: Publish package to PyPI runs-on: ubuntu-latest needs: tests + environment: release + permissions: + id-token: write 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 + - 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/.github/workflows/code_quality.yml b/.github/workflows/code_quality.yml index ee4813e..0433b75 100644 --- a/.github/workflows/code_quality.yml +++ b/.github/workflows/code_quality.yml @@ -6,12 +6,12 @@ on: branches: - main tags: - - "*" + - '*' paths: - - "**.py" + - '**.py' pull_request: paths: - - "**.py" + - '**.py' workflow_dispatch: jobs: @@ -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/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..788e6d1 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,119 @@ +[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 :: 4.2", + "Intended Audience :: Developers", + "Operating System :: Unix", + "Operating System :: MacOS", + "Operating System :: Microsoft :: Windows", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Software Development :: Libraries :: Python Modules", +] +requires-python = ">=3.10" +dependencies = [ + "django>=4.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/*", +] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 6faf394..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.1 - 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 - 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 202e8c9..eaf33ed 100644 --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,7 @@ [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{310,311,312}-django42 + py{310,311,312}-django42-celery celery isort black @@ -12,15 +11,12 @@ skip_missing_interpreters = true [gh-actions] python = - 3.8: py38 - 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] @@ -37,13 +33,11 @@ extras = tests coverage deps = - django32: Django~=3.2.0 - django41: Django~=4.1.0 django42: Django~=4.2.0 celery: celery commands = - py.test tests \ - --cov --cov-report xml:reports/coverage-{envname}.xml \ + pytest tests \ + --cov \ {posargs} [testenv:isort] @@ -54,7 +48,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 @@ -70,6 +64,6 @@ extras = tests docs commands= - py.test check_sphinx.py -v \ + pytest check_sphinx.py -v \ --tb=auto \ {posargs}