From 34911586714d9f93ff85238e626beb36d65e584e Mon Sep 17 00:00:00 2001 From: Tobias Kunze Date: Thu, 2 Nov 2023 17:07:59 +0100 Subject: [PATCH] Migrate to pyproject.toml --- .github/workflows/style.yml | 44 +++++----------------------------- pretalx_downstream/__init__.py | 1 + pretalx_downstream/apps.py | 4 +++- pyproject.toml | 40 +++++++++++++++++++++++++++++++ setup.py | 42 -------------------------------- 5 files changed, 50 insertions(+), 81 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index f479efc..b3809a2 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -29,10 +29,8 @@ jobs: key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} restore-keys: | ${{ runner.os }}-pip- - - name: Install pretalx - run: pip3 install pretalx - - name: Install Dependencies - run: pip3 install isort -Ue . + - name: Install isort + run: pip3 install isort - name: Run isort run: isort -c . flake: @@ -50,10 +48,8 @@ jobs: key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} restore-keys: | ${{ runner.os }}-pip- - - name: Install pretalx - run: pip3 install pretalx - name: Install Dependencies - run: pip3 install flake8 flake8-bugbear -Ue . + run: pip3 install flake8 flake8-bugbear - name: Run flake8 run: flake8 . working-directory: . @@ -72,35 +68,11 @@ jobs: key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} restore-keys: | ${{ runner.os }}-pip- - - name: Install pretalx - run: pip3 install pretalx - name: Install Dependencies - run: pip3 install black -Ue . + run: pip3 install black - name: Run black run: black --check . working-directory: . - docformatter: - name: docformatter - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.10 - uses: actions/setup-python@v1 - with: - python-version: "3.10" - - uses: actions/cache@v1 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} - restore-keys: | - ${{ runner.os }}-pip- - - name: Install pretalx - run: pip3 install pretalx - - name: Install Dependencies - run: pip3 install docformatter -Ue . - - name: Run docformatter - run: docformatter --check -r . - working-directory: . djhtml: name: djhtml runs-on: ubuntu-latest @@ -116,10 +88,8 @@ jobs: key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} restore-keys: | ${{ runner.os }}-pip- - - name: Install pretalx - run: pip3 install pretalx - name: Install Dependencies - run: pip3 install djhtml -Ue . + run: pip3 install djhtml - name: Run docformatter run: find -name "*.html" | xargs djhtml -c working-directory: . @@ -138,15 +108,13 @@ jobs: key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} restore-keys: | ${{ runner.os }}-pip- - - name: Install pretalx - run: pip3 install pretalx - name: Install Dependencies run: pip3 install twine check-manifest -Ue . - name: Run check-manifest run: check-manifest . working-directory: . - name: Build package - run: python setup.py sdist + run: python -m build working-directory: . - name: Check package run: twine check dist/* diff --git a/pretalx_downstream/__init__.py b/pretalx_downstream/__init__.py index e69de29..9b102be 100644 --- a/pretalx_downstream/__init__.py +++ b/pretalx_downstream/__init__.py @@ -0,0 +1 @@ +__version__ = "1.1.5" diff --git a/pretalx_downstream/apps.py b/pretalx_downstream/apps.py index 4f17f06..5655144 100644 --- a/pretalx_downstream/apps.py +++ b/pretalx_downstream/apps.py @@ -1,6 +1,8 @@ from django.apps import AppConfig from django.utils.translation import gettext_lazy +from pretalx_downstream import __version__ + class PluginApp(AppConfig): name = "pretalx_downstream" @@ -13,7 +15,7 @@ class PretalxPluginMeta: "This plugin allows you to use pretalx passively, by letting it import another event's schedule." ) visible = True - version = "1.1.5" + version = __version__ category = "FEATURE" def ready(self): diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..c90043f --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,40 @@ +[project] +name = "pretalx-downstream" +dynamic = ["version"] +description = "Use pretalx passively by importing another event's schedule." +readme = "README.rst" +license = {text = "Apache Software License"} +keywords = ["pretalx"] +authors = [ + {name = "Tobias Kunze", email = "r@rixx.de"}, +] +maintainers = [ + {name = "Tobias Kunze", email = "r@rixx.de"}, +] + +dependencies = [] + +[project.urls] +homepage = "https://github.com/pretalx/pretalx-downstream" +repository = "https://github.com/pretalx/pretalx-downstream.git" + +[project.entry-points."pretalx.plugin"] +pretalx_downstream = "pretalx_downstream:PretalxPluginMeta" + +[build-system] +build-backend = "setuptools.build_meta" +requires = ["setuptools", "wheel"] + +[tool.setuptools] +include-package-data = true + +[tool.setuptools.dynamic] +version = {attr = "pretalx_downstream.__version__"} + +[tool.setuptools.packages.find] +include = ["pretalx*"] + +[tool.check-manifest] +ignore = [ + ".*", +] diff --git a/setup.py b/setup.py deleted file mode 100644 index d1e226f..0000000 --- a/setup.py +++ /dev/null @@ -1,42 +0,0 @@ -import os -from distutils.command.build import build - -from django.core import management -from setuptools import find_packages, setup - -try: - with open( - os.path.join(os.path.dirname(__file__), "README.rst"), encoding="utf-8" - ) as f: - long_description = f.read() -except Exception: - long_description = "" - - -class CustomBuild(build): - def run(self): - management.call_command("compilemessages", verbosity=1) - build.run(self) - - -cmdclass = {"build": CustomBuild} - - -setup( - name="pretalx-downstream", - version="1.1.5", - description="This plugin allows you to use pretalx passively, by letting it import another event's schedule.", - long_description=long_description, - url="https://github.com/pretalx/pretalx-downstream", - author="Tobias Kunze", - author_email="r@rixx.de", - license="Apache Software License", - install_requires=[], - packages=find_packages(exclude=["tests", "tests.*"]), - include_package_data=True, - cmdclass=cmdclass, - entry_points=""" -[pretalx.plugin] -pretalx_downstream=pretalx_downstream:PretalxPluginMeta -""", -)