Skip to content

Commit

Permalink
migate from setup.py to pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
Mogost committed Jul 1, 2024
1 parent 5f262fc commit f3e5e7f
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 84 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 0 additions & 2 deletions constance/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from django.utils.functional import LazyObject

__version__ = '3.1.0'


class LazyConfig(LazyObject):
def _setup(self):
Expand Down
23 changes: 14 additions & 9 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -22,15 +32,10 @@
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
Expand Down
55 changes: 55 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
[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 = "[email protected]" },
]
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 :: 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*"]
68 changes: 0 additions & 68 deletions setup.py

This file was deleted.

8 changes: 4 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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 =
Expand All @@ -27,8 +27,8 @@ 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}
DJANGO_SETTINGS_MODULE = tests.settings

[gh-actions]
python =
Expand Down

0 comments on commit f3e5e7f

Please sign in to comment.