diff --git a/.codacy.yaml b/.codacy.yaml new file mode 100644 index 0000000..257735d --- /dev/null +++ b/.codacy.yaml @@ -0,0 +1,4 @@ +--- +exclude_paths: + - "example_config/**" + - "docs/source/**" diff --git a/pylintrc b/pylintrc new file mode 100644 index 0000000..96c33b3 --- /dev/null +++ b/pylintrc @@ -0,0 +1,22 @@ +[FORMAT] +max-line-length=120 + + +[BASIC] +# Good variable names which should always be accepted, separated by a comma. +good-names=i, + j, + k, + e, + ex, + extra, + f, + fd, + fp, + logger, + Run, + q, + s, + x, + y, + _ diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..b8b5480 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,61 @@ +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "digimarks" +version = "1.1.99" +authors = [ + {name = "Michiel Scholten", email = "michiel@diginaut.net"}, +] +description='Simple bookmarking service, using a SQLite database to store bookmarks, supporting tags, automatic title fetching and REST API calls.' +readme = "README.rst" +requires-python = ">=3.7" +keywords = ["bookmarks", "api"] +license = {text = "Apache"} +classifiers = [ + "Framework :: FastAPI", + "Programming Language :: Python :: 3", + "License :: OSI Approved :: Apache Software License", +] +dependencies = [ + "importlib-metadata; python_version<'3.8'", + "fastapi[all]", + "pydantic>2.0", + "requests", + "strictyaml", + "gitpython", + "rq" +] +# dynamic = ["version"] + +[project.scripts] +my-script = "digimarks:app" + +[project.urls] +"Homepage" = "https://github.com/aquatix/digimarks" +"Bug Tracker" = "https://github.com/aquatix/digimarks/issues" + +[tool.ruff] +exclude = [ + ".git", + "__pycache__", + "docs/source/conf.py", + "build", + "dist", + "example_config/gunicorn_digimarks_conf.py", + "example_config/rq_settings.example.py", + "example_config/settings.py", +] +ignore = ["D203"] +line-length = 120 +select = [ + "C9", + "D", + "E", + "F", + "W", +] + +[tool.ruff.mccabe] +max-complexity = 10 diff --git a/setup.py b/setup.py index 15cfe2a..46d660b 100644 --- a/setup.py +++ b/setup.py @@ -1,43 +1,7 @@ -""" -A setuptools based setup module. -See: -https://packaging.python.org/en/latest/distributing.html -https://github.com/pypa/sampleproject -""" +#!/usr/bin/env python +"""Install script for module installation. Compatibility stub because pyproject.toml is used.""" -from setuptools import setup -# To use a consistent encoding -from codecs import open as codecopen -from os import path +import setuptools -here = path.abspath(path.dirname(__file__)) - -# Get the long description from the relevant file -with codecopen(path.join(here, 'README.rst'), encoding='utf-8') as f: - long_description = f.read() - -setup( - name='digimarks', # pip install digimarks - description='Simple bookmarking service, using a SQLite database to store bookmarks, supporting tags, automatic title fetching and REST API calls.', - #long_description=open('README.md', 'rt').read(), - long_description=long_description, - - # version - # third part for minor release - # second when api changes - # first when it becomes stable someday - version='1.1.99', - author='Michiel Scholten', - author_email='michiel@diginaut.net', - - url='https://github.com/aquatix/digimarks', - license='Apache', - - # as a practice no need to hard code version unless you know program wont - # work unless the specific versions are used - install_requires=['Flask', 'Peewee', 'Flask-Peewee', 'requests', 'bs4'], - - py_modules=['digimarks'], - - zip_safe=True, -) +if __name__ == "__main__": + setuptools.setup() diff --git a/src/digimarks/__init__.py b/src/digimarks/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/digimarks.py b/src/digimarks/main.py similarity index 100% rename from digimarks.py rename to src/digimarks/main.py diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..09b8ad8 --- /dev/null +++ b/tox.ini @@ -0,0 +1,21 @@ +[flake8] +ignore = D203, W503 +exclude = + .git, + __pycache__, + docs/source/conf.py, + build, + dist, + example_config/gunicorn_webhaak_conf.py, + example_config/rq_settings.example.py, + example_config/settings.py, +max-line-length = 120 +max-complexity = 10 + +[pycodestyle] +max_line_length = 120 +ignore = E501, W503 + +[isort] +line_length = 120 +multi_line_output = 3 diff --git a/wsgi.py b/wsgi.py deleted file mode 100644 index 93d4c89..0000000 --- a/wsgi.py +++ /dev/null @@ -1,16 +0,0 @@ -# Activate virtualenv -import settings -activate_this = getattr(settings, 'VENV', None) -# FIXME: python 2 *and* python 3 compatibility -# Python 2 -#if activate_this: -# execfile(activate_this, dict(__file__=activate_this)) -# Python 3 -with open(activate_this) as file_: - exec(file_.read(), dict(__file__=activate_this)) - -from digimarks import app as application - -if __name__ == "__main__": - # application is ran standalone - application.run(debug=settings.DEBUG)