migate from setup.py to pyproject.toml & bump tox & declare support for python 3.12 (#557)

* migate from setup.py to pyproject.toml
* bump tox
* declare support for python 3.12
This commit is contained in:
Alexandr Artemyev 2024-07-03 13:30:29 +05:00 committed by GitHub
parent 451386aca0
commit 554eedc7c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 77 additions and 85 deletions

View file

@ -9,7 +9,7 @@ jobs:
fail-fast: false
max-parallel: 5
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11'] # '3.12' does not work with tox@3
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
@ -23,7 +23,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade 'tox<4' tox-gh-actions
python -m pip install --upgrade tox tox-gh-actions
- name: Tox tests
run: |

View file

@ -1,7 +1,5 @@
from django.utils.functional import LazyObject
__version__ = '3.1.0'
class LazyConfig(LazyObject):
def _setup(self):

View file

@ -3,10 +3,20 @@
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import re
import sys
import os
from datetime import datetime
def get_version():
with open('../pyproject.toml') as f:
for line in f:
match = re.match(r'version = "(.*)"', line)
if match:
return match.group(1)
return '0.0.0'
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tests.settings')
# If extensions (or modules to document with autodoc) are in another directory,
@ -22,15 +32,10 @@ project = 'django-constance'
project_copyright = datetime.now().year.__str__() + ', Jazzband'
# author = ''
# Use current version.
try:
from constance import __version__
# The short X.Y version.
version = '.'.join(__version__.split('.')[:2])
# The full version, including alpha/beta/rc tags.
release = __version__
except ImportError:
version = release = 'dev'
# The full version, including alpha/beta/rc tags
release = get_version()
# The short X.Y version
version = ".".join(release.split(".")[:3])
# -- General configuration ------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

56
pyproject.toml Normal file
View file

@ -0,0 +1,56 @@
[build-system]
requires = ["setuptools>=42", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "django-constance"
version = "3.1.0"
description = "Django live settings with pluggable backends, including Redis."
readme = "README.rst"
license = { text = "BSD" }
requires-python = ">=3.8"
authors = [
{ name = "Jannis Leidel", email = "jannis@leidel.info" },
]
keywords = ["django", "libraries", "redis", "settings"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"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 :: Implementation :: CPython",
"Topic :: Utilities",
]
dependencies = [
"django-picklefield",
]
[project.optional-dependencies]
redis = [
"redis",
]
[project.entry-points.pytest11]
pytest-django-constance = "constance.test.pytest"
[project.urls]
homepage = "https://github.com/jazzband/django-constance/"
documentation = "https://django-constance.readthedocs.io/en/latest/"
repository = "https://github.com/jazzband/django-constance/"
changelog = "https://github.com/jazzband/django-constance/releases/"
[tool.setuptools.packages.find]
include = ["constance*"]

View file

@ -1,68 +0,0 @@
import os
import re
import codecs
from setuptools import setup, find_packages
def read(*parts):
filename = os.path.join(os.path.dirname(__file__), *parts)
with codecs.open(filename, encoding='utf-8') as fp:
return fp.read()
def find_version(*file_paths):
version_file = read(*file_paths)
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.')
setup(
name='django-constance',
version=find_version('constance', '__init__.py'),
url='https://github.com/jazzband/django-constance',
description='Django live settings with pluggable backends, including Redis.',
long_description=read('README.rst'),
author='Jannis Leidel',
author_email='jannis@leidel.info',
license='BSD',
keywords='django libraries settings redis'.split(),
platforms=['any'],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Framework :: Django',
'Framework :: Django :: 4.2',
'Framework :: Django :: 5.0',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'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 :: Only',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Utilities',
],
packages=find_packages(exclude=['tests', 'tests.*']),
include_package_data=True,
zip_safe=False,
python_requires='>=3.8',
install_requires=[
'django-picklefield',
],
extras_require={
'redis': ['redis'],
},
entry_points={
'pytest11': [
'pytest-django-constance = constance.test.pytest',
],
},
)

View file

@ -1,10 +1,10 @@
[tox]
requires =
tox<4
isolated_build = true
envlist =
py{38,39,310,311,312}-dj{42}-{unittest,pytest}
py{310,311,312}-dj{50}-{unittest,pytest}
py{310,311,312}-dj{main}-{unittest,pytest}
skip_missing_interpreters = True
[testenv]
deps =
@ -27,8 +27,9 @@ commands =
unittest: coverage xml
pytest: pytest --cov=. --ignore=.tox --disable-pytest-warnings --cov-report=xml --cov-append {toxinidir}
setenv =
PYTHONDONTWRITEBYTECODE=1
DJANGO_SETTINGS_MODULE=tests.settings
PYTHONPATH = {toxinidir}
PYTHONDONTWRITEBYTECODE = 1
DJANGO_SETTINGS_MODULE = tests.settings
[gh-actions]
python =