diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 484f8ee1..0fbe3d3f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -28,15 +28,14 @@ Please write unit tests for your change. There are two kinds of tests: ### Running all tests ```shell -python setup.py test -cd tests/end2end/ && PYTHONPATH=../.. ./manage.py test +tox ``` The former runs the regular unit tests, the latter runs the Django unit test. -To avoid setting PYTHONPATH every time, you can also run `python -setup.py install`. +To avoid setting PYTHONPATH every time, you can also run `pip install +-e .` ### Running the test Django app diff --git a/README.md b/README.md index 0f2cf659..fc26c6bb 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ pip install django-prometheus Or, if you're using a development version cloned from this repository: ```shell -python path-to-where-you-cloned-django-prometheus/setup.py install +pip install -e path-to-where-you-cloned-django-prometheus/setup.py ``` This will install [prometheus_client](https://github.com/prometheus/client_python) as a dependency. diff --git a/pyproject.toml b/pyproject.toml index d59b21fc..d81c7d8d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,54 @@ +[project] +name = "django-prometheus" +authors = [{name = "Uriel Corfa", email = "uriel@corfa.fr"}] +license = {text = "Apache"} +description = "Django middlewares to monitor your application with Prometheus.io." +keywords = ["django", "monitoring", "prometheus"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Intended Audience :: Information Technology", + "Intended Audience :: System Administrators", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Framework :: Django :: 3.2", + "Framework :: Django :: 4.0", + "Framework :: Django :: 4.1", + "Framework :: Django :: 4.2", + "Topic :: System :: Monitoring", + "License :: OSI Approved :: Apache Software License", +] +dependencies = ["prometheus-client>=0.7"] +dynamic = ["version"] + +[project.readme] +file = "README.md" +content-type = "text/markdown" + +[project.urls] +Homepage = "https://github.com/korfuri/django-prometheus" +Changelog = "https://github.com/korfuri/django-prometheus/blob/master/CHANGELOG.md" +Documentation = "https://github.com/korfuri/django-prometheus/blob/master/README.md" +Source = "https://github.com/korfuri/django-prometheus" +Tracker = "https://github.com/korfuri/django-prometheus/issues" + +[project.optional-dependencies] +testing = ["pytest", "pytest-django"] + +[tool.setuptools] +include-package-data = false + +[tool.setuptools.packages.find] +exclude = ["tests"] +namespaces = false + +[tool.setuptools.dynamic] +version = {attr = "django_prometheus.__version__"} + [build-system] requires = [ "setuptools >= 67.7.2", "wheel >= 0.40.0"] build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg index c86d8633..95016d0c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,3 @@ -[aliases] -test=pytest - [pycodestyle] max-line-length = 110 diff --git a/setup.py b/setup.py deleted file mode 100644 index 471439d9..00000000 --- a/setup.py +++ /dev/null @@ -1,66 +0,0 @@ -import re - -from setuptools import find_packages, setup - -with open("README.md") as fl: - LONG_DESCRIPTION = fl.read() - - -def get_version(): - version_file = open("django_prometheus/__init__.py", "r").read() - version_match = re.search( - r'^__version__ = [\'"]([^\'"]*)[\'"]', version_file, re.MULTILINE - ) - if version_match: - return version_match.group(1) - raise RuntimeError("Unable to find version string.") - - -setup( - name="django-prometheus", - version=get_version(), - author="Uriel Corfa", - author_email="uriel@corfa.fr", - description=("Django middlewares to monitor your application with Prometheus.io."), - license="Apache", - keywords="django monitoring prometheus", - url="http://github.com/korfuri/django-prometheus", - project_urls={ - "Changelog": "https://github.com/korfuri/django-prometheus/blob/master/CHANGELOG.md", - "Documentation": "https://github.com/korfuri/django-prometheus/blob/master/README.md", - "Source": "https://github.com/korfuri/django-prometheus", - "Tracker": "https://github.com/korfuri/django-prometheus/issues", - }, - packages=find_packages( - exclude=[ - "tests", - ] - ), - test_suite="django_prometheus.tests", - long_description=LONG_DESCRIPTION, - long_description_content_type="text/markdown", - tests_require=["pytest", "pytest-django"], - setup_requires=["pytest-runner"], - options={"bdist_wheel": {"universal": "1"}}, - install_requires=[ - "prometheus-client>=0.7", - ], - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "Intended Audience :: Information Technology", - "Intended Audience :: System Administrators", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Framework :: Django :: 3.2", - "Framework :: Django :: 4.0", - "Framework :: Django :: 4.1", - "Framework :: Django :: 4.2", - "Topic :: System :: Monitoring", - "License :: OSI Approved :: Apache Software License", - ], -)