From 53ed2d9d1a984794a51432c858ead49402e778ac Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Sat, 18 Dec 2021 01:46:35 +0100 Subject: [PATCH] chore(package): Only use setup.cfg, drop setup.py --- flaschengeist/flaschengeist.toml | 5 ++- pyproject.toml | 3 ++ setup.cfg | 42 +++++++++++++++++ setup.py | 77 -------------------------------- 4 files changed, 48 insertions(+), 79 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/flaschengeist/flaschengeist.toml b/flaschengeist/flaschengeist.toml index d8a32f0..77af5b4 100644 --- a/flaschengeist/flaschengeist.toml +++ b/flaschengeist/flaschengeist.toml @@ -23,10 +23,11 @@ secret_key = "V3ryS3cr3t" # # Logging level, possible: DEBUG INFO WARNING ERROR level = "DEBUG" -# Uncomment to enable logging to a file +# Logging to a file is simple, just add the path # file = "/tmp/flaschengeist-debug.log" +file = false # Uncomment to disable console logging -# console = False +# console = false [DATABASE] # engine = "mysql" (default) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..9787c3b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg index 957dff3..b5347c8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,6 +17,48 @@ classifiers = License :: OSI Approved :: MIT License Operating System :: OS Independent +[options] +include_package_data = True +python_requires = >=3.7 +packages = find: +install_requires = + Flask >= 2.0 + Pillow>=8.4.0 + flask_cors + flask_sqlalchemy>=2.5 + sqlalchemy>=1.4.26 + toml + werkzeug + PyMySQL;platform_system=='Windows' + mysqlclient;platform_system!='Windows' + +[options.extras_require] +argon = argon2-cffi +ldap = flask_ldapconn; ldap3 +test = pytest; coverage + +[options.package_data] +* = *.toml + +[options.entry_points] +console_scripts = + flaschengeist = flaschengeist.cli:cli +flask.commands = + ldap = flaschengeist.plugins.auth_ldap.cli:ldap + users = flaschengeist.plugins.users.cli:users +flaschengeist.plugins = + # Authentication providers + auth_plain = flaschengeist.plugins.auth_plain:AuthPlain + auth_ldap = flaschengeist.plugins.auth_ldap:AuthLDAP [ldap] + # Route providers (and misc) + auth = flaschengeist.plugins.auth:AuthRoutePlugin + users = flaschengeist.plugins.users:UsersPlugin + roles = flaschengeist.plugins.roles:RolesPlugin + balance = flaschengeist.plugins.balance:BalancePlugin + mail = flaschengeist.plugins.message_mail:MailMessagePlugin + pricelist = flaschengeist.plugins.pricelist:PriceListPlugin + scheduler = flaschengeist.plugins.scheduler:SchedulerPlugin + [bdist_wheel] universal = True diff --git a/setup.py b/setup.py deleted file mode 100644 index f57a18b..0000000 --- a/setup.py +++ /dev/null @@ -1,77 +0,0 @@ -from setuptools import setup, find_packages, Command -import subprocess -import os - -mysql_driver = "PyMySQL" if os.name == "nt" else "mysqlclient" - - -class DocsCommand(Command): - description = "Generate and export API documentation using pdoc3" - user_options = [ - # The format is (long option, short option, description). - ("output=", "o", "Documentation output path"), - ] - - def initialize_options(self): - self.output = "./docs" - - def finalize_options(self): - pass - - def run(self): - """Run command.""" - command = [ - "python", - "-m", - "pdoc", - "--skip-errors", - "--html", - "--output-dir", - self.output, - "flaschengeist", - ] - self.announce( - "Running command: %s" % str(command), - ) - subprocess.check_call(command) - - -setup( - packages=find_packages(), - package_data={"": ["*.toml"]}, - scripts=["run_flaschengeist"], - python_requires=">=3.7", - install_requires=[ - "Flask >= 2.0", - "toml", - "sqlalchemy>=1.4.26", - "flask_sqlalchemy>=2.5", - "flask_cors", - "Pillow>=8.4.0", - "werkzeug", - mysql_driver, - ], - extras_require={ - "ldap": ["flask_ldapconn", "ldap3"], - "argon": ["argon2-cffi"], - "test": ["pytest", "coverage"], - }, - entry_points={ - "flaschengeist.plugins": [ - # Authentication providers - "auth_plain = flaschengeist.plugins.auth_plain:AuthPlain", - "auth_ldap = flaschengeist.plugins.auth_ldap:AuthLDAP [ldap]", - # Route providers (and misc) - "auth = flaschengeist.plugins.auth:AuthRoutePlugin", - "users = flaschengeist.plugins.users:UsersPlugin", - "roles = flaschengeist.plugins.roles:RolesPlugin", - "balance = flaschengeist.plugins.balance:BalancePlugin", - "mail = flaschengeist.plugins.message_mail:MailMessagePlugin", - "pricelist = flaschengeist.plugins.pricelist:PriceListPlugin", - "scheduler = flaschengeist.plugins.scheduler:SchedulerPlugin", - ], - }, - cmdclass={ - "docs": DocsCommand, - }, -)