From 8080d19d53d1a771d8dbb8dda0b84b477316cf56 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Thu, 7 Dec 2023 20:04:13 +0100 Subject: [PATCH] Replace setup.py by pyproject.toml --- .coveragerc | 3 -- .github/workflows/release.yml | 13 ++++---- .github/workflows/test.yml | 4 +-- MANIFEST.in | 5 --- docs/installation.rst | 2 +- pyproject.toml | 56 ++++++++++++++++++++++++++++++++- setup.cfg | 2 -- setup.py | 58 ----------------------------------- 8 files changed, 64 insertions(+), 79 deletions(-) delete mode 100644 .coveragerc delete mode 100644 MANIFEST.in delete mode 100644 setup.cfg delete mode 100755 setup.py diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index fad63e2c..00000000 --- a/.coveragerc +++ /dev/null @@ -1,3 +0,0 @@ -[run] -source = tinymce -branch = True diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 12cf1941..b86ee529 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,14 +11,14 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: - python-version: 3.8 + python-version: 3.11 - name: Get pip cache dir id: pip-cache @@ -29,19 +29,18 @@ jobs: uses: actions/cache@v3 with: path: ${{ steps.pip-cache.outputs.dir }} - key: release-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/tox.ini') }} + key: release-${{ hashFiles('**/pyproject.toml') }}-${{ hashFiles('**/tox.ini') }} restore-keys: | release- - name: Install dependencies run: | python -m pip install -U pip - python -m pip install -U setuptools twine wheel + python -m pip install -U setuptools build twine - name: Build package run: | - python setup.py --version - python setup.py sdist --format=gztar bdist_wheel + python -m build twine check dist/* - name: Upload packages to Jazzband diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 44fcb6fa..f165497c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -40,14 +40,14 @@ jobs: with: path: ${{ steps.pip-cache.outputs.dir }} key: - ${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/tox.ini') }} + ${{ matrix.python-version }}-v1-${{ hashFiles('**/pyproject.toml') }}-${{ hashFiles('**/tox.ini') }} restore-keys: | ${{ matrix.python-version }}-v1- - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install --upgrade tox tox-gh-actions + python -m pip install --upgrade coverage[toml] tox tox-gh-actions - name: Tox tests run: | diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index cc6584e5..00000000 --- a/MANIFEST.in +++ /dev/null @@ -1,5 +0,0 @@ -include *.txt *.py *.rst setup.cfg -include docs/*.rst -exclude *.pyc -recursive-include tests * -recursive-include tinymce * diff --git a/docs/installation.rst b/docs/installation.rst index e9d04508..f353f7b2 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -38,7 +38,7 @@ editor itself and 'django-tinymce' (lower case) to refer to the Django applicati Installation ------------ -#. Install django-tinymce using `pip`_ (or any other way to install python package) from `PyPI`_. If you need to use a different way to install django-tinymce you can place the ``tinymce`` module on your Python path. You can put it into your Django project directory or run ``python setup.py install`` from a shell. :: +#. Install django-tinymce using `pip`_ (or any other way to install python package) from `PyPI`_. If you need to use a different way to install django-tinymce you can place the ``tinymce`` module on your Python path. :: pip install django-tinymce diff --git a/pyproject.toml b/pyproject.toml index 7a7acb89..88e9ee23 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,53 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "django-tinymce" +version = "3.6.1" +description = """ +A Django application that contains a widget to render a +form field as a TinyMCE editor.""" +readme = "README.rst" +authors = [ + {name = "Aljosa Mohorovic", email = "aljosa.mohorovic@gmail.com"}, +] +maintainers = [ + {name = "Rémy Hubscher", email = "hubscher.remy@gmail.com"}, + {name = "Claude Paroz", email = "claude@2xlibre.net"}, +] +license = {text = "MIT License"} +requires-python = ">=3.8" +dependencies = [ + "django>=3.2", +] +keywords = ["django", "widget", "tinymce"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Web Environment", + "Framework :: Django", + "Framework :: Django :: 3.2", + "Framework :: Django :: 4.2", + "Framework :: Django :: 5.0", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "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.12", + "Topic :: Software Development :: Libraries :: Application Frameworks", + "Topic :: Software Development :: Libraries :: Python Modules", +] + +[project.urls] +Homepage = "https://github.com/jazzband/django-tinymce" +Documentation = "https://django-tinymce.readthedocs.org/" +Changelog = "https://github.com/jazzband/django-tinymce/blob/master/CHANGELOG.rst" + [tool.black] line-length = 99 skip-numeric-underscore-normalization = true @@ -17,7 +67,7 @@ exclude = ''' force_grid_wrap = 0 include_trailing_comma = true known_first_party = 'lib,model,presenters' -known_third_party = ["django", "setuptools"] +known_third_party = ["django"] line_length = 99 multi_line_output = 3 skip_glob = '' @@ -26,3 +76,7 @@ combine_as_imports = true # If set, imports will be sorted within their section independent to the import_type. force_sort_within_sections = true + +[tool.coverage.run] +source = ["tinymce"] +branch = true diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 81049c3a..00000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[zest.releaser] -create-wheel = yes diff --git a/setup.py b/setup.py deleted file mode 100755 index 8423b0a6..00000000 --- a/setup.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python -import codecs -import os - -from setuptools import find_packages, setup - -here = os.path.abspath(os.path.dirname(__file__)) - - -def read_file(filename): - """Open a related file and return its content.""" - with codecs.open(os.path.join(here, filename), encoding="utf-8") as f: - content = f.read() - return content - - -README = read_file("README.rst") -CHANGELOG = read_file("CHANGELOG.rst") - - -setup( - name="django-tinymce", - version="3.6.1", - packages=find_packages(exclude=["tests*"]), - include_package_data=True, - author="Aljosa Mohorovic", - author_email="aljosa.mohorovic@gmail.com", - description=( - "A Django application that contains a widget to render a " - "form field as a TinyMCE editor." - ), - long_description=README + "\n\n" + CHANGELOG, - license="MIT License", - keywords="django widget tinymce", - zip_safe=False, - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Environment :: Web Environment", - "Framework :: Django", - "Framework :: Django :: 3.2", - "Framework :: Django :: 4.2", - "Framework :: Django :: 5.0", - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "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.12", - "Topic :: Software Development :: Libraries :: Application Frameworks", - "Topic :: Software Development :: Libraries :: Python Modules", - ], - platforms=["any"], - url="https://github.com/jazzband/django-tinymce", -)