Skip to content

Commit

Permalink
Merge pull request #27 from maykinmedia/312
Browse files Browse the repository at this point in the history
Add support for Python `3.12`, update metadata
  • Loading branch information
sergei-maertens authored Feb 20, 2024
2 parents 63f6566 + f600c89 commit 5448f8c
Show file tree
Hide file tree
Showing 14 changed files with 181 additions and 175 deletions.
6 changes: 0 additions & 6 deletions .bumpversion.cfg

This file was deleted.

20 changes: 0 additions & 20 deletions .coveragerc

This file was deleted.

3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length=88
ignore=E501
24 changes: 12 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ 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.10', '3.11', '3.12']
django: ['3.2', '4.2']
exclude:
- python: '3.11'
- python: ['3.11', '3.12']
django: '3.2'

services:
Expand All @@ -35,8 +35,8 @@ jobs:
name: Run the test suite (Python ${{ matrix.python }}, Django ${{ matrix.django }})

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

Expand All @@ -54,7 +54,7 @@ jobs:
PGHOST: localhost

- name: Publish coverage report
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3

publish:
name: Publish package to PyPI
Expand All @@ -64,18 +64,18 @@ jobs:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8'
python-version: '3.10'

- name: Build sdist and 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.4.1
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
7 changes: 4 additions & 3 deletions .github/workflows/code_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- master
- develop
tags:
- '*'
paths:
- "**.py"
pull_request:
Expand All @@ -20,10 +21,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
toxenv: [isort, black, docs]
toxenv: [isort, black, flake8, docs]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
Expand Down
20 changes: 20 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

version: 2

build:
os: ubuntu-22.04
tools:
python: "3.10"

sphinx:
configuration: docs/conf.py

python:
install:
- method: pip
path: .
extra_requirements:
- docs
18 changes: 6 additions & 12 deletions demo/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,10 @@
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is really that Django is missing to avoid masking other
# exceptions on Python 2.
try:
import django
except ImportError:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
)
raise
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
)

execute_from_command_line(sys.argv)
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
from pkg_resources import get_distribution
from importlib.metadata import version as get_version

FULL_VERSION = get_distribution("django-timeline-logger").version
FULL_VERSION = get_version("django-timeline-logger")

# -- General configuration ------------------------------------------------

Expand Down Expand Up @@ -53,7 +53,7 @@

# General information about the project.
project = "Django Timeline Logger"
copyright = "2016-2018, Maykin Media"
copyright = "2016, Maykin Media"
author = "Maykin Media"

# The version info for the project you're documenting, acts as replacement for
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ To run the tests in your (virtual) environment, simple execute

.. code-block:: sh
python setup.py test
pytest
This will run the tests with the current python version and Django version
installed in your virtual environment.
Expand Down
121 changes: 121 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
[build-system]
requires = ["setuptools>=61.0.0"]
build-backend = "setuptools.build_meta"

[project]
name = "django-timeline-logger"
version = "3.0.0"
description = "Generic event logger for Django models."
authors = [
{name = "Maykin Media", email = "[email protected]"}
]
readme = "README.rst"
license = {file = "LICENSE"}
keywords = ["django", "generic logging"]
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.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Software Development :: Libraries :: Python Modules",
]
requires-python = ">=3.10"
dependencies = [
"django>=3.2",
"django-appconf",
]

[project.urls]
Homepage = "https://github.com/maykinmedia/django-timeline-logger"
Documentation = "http://django-timeline-logger.readthedocs.io/en/latest/"
"Bug Tracker" = "https://github.com/maykinmedia/django-timeline-logger/issues"
"Source Code" = "https://github.com/maykinmedia/django-timeline-logger"
Changelog = "https://github.com/maykinmedia/django-timeline-logger/blob/master/docs/changelog.rst"

[project.optional-dependencies]
tests = [
"factory-boy",
"psycopg2",
"pytest",
"pytest-cov",
"pytest-django",
"pytest-pep8",
"pytest-pylint",
"pytest-pythonpath",
"pytest-runner",
"tox",
"black",
"isort",
"flake8",
]
coverage = [
"pytest-cov",
]
docs = [
"sphinx",
"sphinx-rtd-theme",
]
release = [
"bump-my-version",
"twine",
]

[tool.setuptools.packages.find]
include = ["timeline_logger*"]
namespaces = false

[tool.isort]
profile = "black"
combine_as_imports = true
known_django = "django"
known_first_party="timeline_logger"
sections=["FUTURE", "STDLIB", "DJANGO", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]

[tool.pytest.ini_options]
testpaths = ["tests"]
DJANGO_SETTINGS_MODULE = "tests.settings_pg"

[tool.bumpversion]
current_version = "3.0.0"
files = [
{filename = "pyproject.toml"},
{filename = "README.rst"},
{filename = "docs/changelog.rst"},
]

[tool.coverage.run]
branch = true
source = [
"timeline_logger"
]
omit = [
"demo/*",
"*/migrations/*",
"*/tests/*",
]

[tool.coverage.report]
exclude_also = [
"if (typing\\.)?TYPE_CHECKING:",
"@(typing\\.)?overload",
"class .*\\(.*Protocol.*\\):",
"@(abc\\.)?abstractmethod",
"raise NotImplementedError",
"\\.\\.\\.",
"pass",
]
omit = [
"demo/*",
"*/migrations/*",
"*/tests/*",
]

[tool.coverage.html]
directory = "cover"
Loading

0 comments on commit 5448f8c

Please sign in to comment.