From de96b4ea17fee8fbe6d644fb9b55008aec9723e9 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 27 Jul 2024 14:04:45 +0200 Subject: [PATCH] Migrated project setup to pyproject.toml. --- CHANGELOG.md | 4 ++- __version__.py | 1 - pyproject.toml | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 18 -------------- setup.py | 60 -------------------------------------------- version.py | 1 + 6 files changed, 71 insertions(+), 80 deletions(-) delete mode 100644 __version__.py create mode 100644 version.py diff --git a/CHANGELOG.md b/CHANGELOG.md index b0339ae7fc..5e5b075790 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Changelog -## [1.2.0] - 2024-07-27 +## [Unreleased] - [#419](https://git.platypush.tech/platypush/platypush/issues/419): added support for randomly generated API tokens alongside JWT. @@ -23,6 +23,8 @@ and you install it as a PWA, you'll install a PWA only for that plugin - not for the whole Platypush UI. +- Migrated project setup from `setup.py` to `pyproject.toml`. + - [`70db33b4e`](https://git.platypush.tech/platypush/platypush/commit/70db33b4e): more application resilience in case Redis goes down. diff --git a/__version__.py b/__version__.py deleted file mode 100644 index 7bb021e2f3..0000000000 --- a/__version__.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = '1.1.3' diff --git a/pyproject.toml b/pyproject.toml index a5cd7464e1..0494289a84 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,60 @@ +[project] +name = "platypush" +description = "A general-purpose framework for automation" +dynamic = ["version", "dependencies"] +authors = [ + {name = "Fabio Manganiello", email = "fabio@manganiello.tech"}, +] + +classifiers=[ + "Topic :: Utilities", + "License :: OSI Approved :: MIT License", + "Development Status :: 4 - Beta", +] + +readme = "README.md" +license = {file = "LICENSE.txt"} +requires-python = '>= 3.6' +keywords = [ + "home-automation", "automation", "iot", "mqtt", "websockets", "redis", "dashboard", "notifications" +] + +[tool.setuptools.dynamic] +version = {attr = "version.__version__"} +dependencies = {file = "requirements.txt"} + +[project.urls] +homepage = "https://platypush.tech" +repository = "https://git.platypush.tech/platypush/platypush" +documentation = "https://docs.platypush.tech" +blog = "https://blog.platypush.tech" + +[project.scripts] +platypush = 'platypush:main' +platydock = 'platypush.platydock:main' +platyvenv = 'platypush.platyvenv:main' + +[tool.flit.sdist] +include = [ + 'platypush/backend/http/webapp/dist/*', + 'platypush/components.json.gz', + 'platypush/config/*.yaml', + 'platypush/install/**', + 'platypush/install/docker/*', + 'platypush/install/requirements/*', + 'platypush/install/scripts/*', + 'platypush/install/scripts/**/*', + 'platypush/migrations/alembic.ini', + 'platypush/migrations/alembic/*', + 'platypush/migrations/alembic/**/*', + 'platypush/plugins/http/webpage/mercury-parser.js' +] + +[tool.bumpversion] +current_version = '1.1.3' +commit = true +tag = true + [tool.black] skip-string-normalization = true skip-numeric-underscore-normalization = true @@ -6,3 +63,13 @@ skip-numeric-underscore-normalization = true filterwarnings = [ 'ignore:There is no current event loop:DeprecationWarning', ] + +[[tool.bumpversion.files]] +filename = "CHANGELOG.md" +search = "Unreleased" + +[[tool.bumpversion.files]] +filename = "platypush/__init__.py" + +[[tool.bumpversion.files]] +filename = "version.py" diff --git a/setup.cfg b/setup.cfg index a79ad0dee0..12103c1c18 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,21 +1,3 @@ -[bumpversion] -current_version = 1.1.3 -commit = True -tag = True - -[files] -packages = pbr -data_files = - platypush/backend/http/webapp/dist/* - platypush/install/* - platypush/plugins/http/webpage/mercury-parser.js - platypush/config/*.yaml - -[metadata] -name = platypush -version = attr: __version__.__version__ -description_file = README.md - [flake8] max-line-length = 120 exclude = diff --git a/setup.py b/setup.py index 1a5cfc7932..d3d237b960 100755 --- a/setup.py +++ b/setup.py @@ -6,23 +6,6 @@ import os from setuptools import setup, find_packages -def path(fname=''): - return os.path.abspath(os.path.join(os.path.dirname(__file__), fname)) - - -def readfile(fname): - with open(path(fname)) as f: - return f.read() - - -def pkg_files(dir): - paths = [] - for p, _, files in os.walk(dir): - for file in files: - paths.append(os.path.join('..', p, file)) - return paths - - def scan_manifests(): for root, _, files in os.walk('platypush'): for file in files: @@ -61,51 +44,8 @@ def parse_manifests(): return ret -plugins = pkg_files('platypush/plugins') -backend = pkg_files('platypush/backend') - setup( - name="platypush", - author="Fabio Manganiello", - author_email="fabio@manganiello.tech", - description="Platypush service", - license="MIT", - python_requires='>= 3.6', - keywords="home-automation automation iot mqtt websockets redis dashboard notifications", - url="https://platypush.tech", packages=find_packages(exclude=['tests']), include_package_data=True, - package_data={ - 'platypush': [ - 'migrations/alembic.ini', - 'migrations/alembic/*', - 'migrations/alembic/**/*', - 'install/**', - 'install/scripts/*', - 'install/scripts/**/*', - 'install/requirements/*', - 'install/docker/*', - 'components.json.gz', - ], - }, - entry_points={ - 'console_scripts': [ - 'platypush=platypush:main', - 'platydock=platypush.platydock:main', - 'platyvenv=platypush.platyvenv:main', - ], - }, - long_description=readfile('README.md'), - long_description_content_type='text/markdown', - classifiers=[ - "Topic :: Utilities", - "License :: OSI Approved :: MIT License", - "Development Status :: 4 - Beta", - ], - install_requires=[ - line.split('#')[0].strip() - for line in readfile('requirements.txt').splitlines() - if line.strip().split('#')[0].strip() - ], extras_require=parse_manifests(), ) diff --git a/version.py b/version.py new file mode 100644 index 0000000000..0b2f79dbba --- /dev/null +++ b/version.py @@ -0,0 +1 @@ +__version__ = "1.1.3"