From 34f3324a4e167b81060d8d930854b5b108f0cf9e Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Sat, 25 Sep 2021 17:43:20 +0300 Subject: [PATCH] Setup the Python project. - Let's try using PEP 621 and PDM (also PEP 582 while I'm at it). - Setup pre-commit hooks. - Setup GitLab CI (just pre-commit for now). --- .gitignore | 1 + .gitlab-ci.yml | 4 ++ .pre-commit-config.yaml | 108 ++++++++++++++++++++++++++++++++ README.rst | 6 ++ pyproject.toml | 36 +++++++++++ transmission_feeder/__init__.py | 12 ++++ 6 files changed, 167 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100644 .pre-commit-config.yaml create mode 100644 pyproject.toml create mode 100644 transmission_feeder/__init__.py diff --git a/.gitignore b/.gitignore index 31ee437..d1a8368 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ *.py[cod] .DS_Store __pycache__/ +__pypackages__/ .vagrant/ vendor/ Thumbs.db diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..f92da7b --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,4 @@ +--- +include: + - project: shore/ci-templates + file: templates/pre-commit.yml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..4c64421 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,108 @@ +--- +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks.git + rev: v4.0.1 + hooks: + - id: check-added-large-files + - id: check-json + - id: check-merge-conflict + - id: check-shebang-scripts-are-executable + - id: check-symlinks + - id: check-toml + - id: check-xml + - id: check-yaml + - id: detect-private-key + - id: end-of-file-fixer + - id: trailing-whitespace + exclude: \.diff$ + + - repo: https://github.com/codespell-project/codespell.git + rev: v2.1.0 + hooks: + - id: codespell + + - repo: https://github.com/Yelp/detect-secrets.git + rev: v1.1.0 + hooks: + - id: detect-secrets + + - repo: https://gitlab.com/devopshq/gitlab-ci-linter.git + rev: v1.0.4 + hooks: + - id: gitlab-ci-linter + args: + - "--server" + - https://git.shore.co.il + + - repo: https://github.com/amperser/proselint.git + rev: 0.10.2 + hooks: + - id: proselint + types: [plain-text] + exclude: LICENSE + + - repo: https://github.com/adrienverge/yamllint.git + rev: v1.26.3 + hooks: + - id: yamllint + + - repo: https://github.com/ambv/black.git + rev: 21.9b0 + hooks: + - id: black + args: + - | + --line-length=79 + + - repo: https://github.com/Lucas-C/pre-commit-hooks-markup.git + rev: v1.0.1 + hooks: + - id: rst-linter + + - repo: https://github.com/myint/rstcheck.git + rev: master + hooks: + - id: rstcheck + + - repo: https://github.com/PyCQA/prospector.git + rev: 1.5.1 + hooks: + - id: prospector + args: + - |- + --max-line-length=79 + - |- + --with-tool=pyroma + - |- + --with-tool=bandit + - |- + --without-tool=pep257 + - |- + --doc-warnings + - |- + --test-warnings + - |- + --full-pep8 + - |- + --strictness=high + - |- + --no-autodetect + additional_dependencies: + - bandit + - pyroma + + - repo: https://gitlab.com/pycqa/flake8.git + rev: 3.9.2 + hooks: + - id: flake8 + args: + - |- + --doctests + additional_dependencies: + - flake8-bugbear + + - repo: https://github.com/asottile/pyupgrade + rev: v2.23.2 + hooks: + - id: pyupgrade + args: [--py36-plus] diff --git a/README.rst b/README.rst index f24b3d7..8bc54a7 100644 --- a/README.rst +++ b/README.rst @@ -1,6 +1,12 @@ Transmission feeder ################### +.. image:: https://git.shore.co.il/nimrod/transmission-feeder/badges/master/pipeline.svg + :target: https://git.shore.co.il/nimrod/transmission-feeder/-/commits/master + :alt: pipeline status + +Add torrent to Transmission from RSS or Atom feeds. + License ------- diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..ed38c4a --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,36 @@ +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools:build_meta" + +[project] +name = "transmission_feeder" +authors = [{name = "Nimrod Adar", email = "nimrod@shore.co.il"}] +readme = "README.rst" +dynamic = ["version", "description"] +license = {"file" = "LICENSE.txt"} +requires-python = ">=3.6" +keywords = ["torrent", "rss", "atom", "transmission"] +dependencies = [ + "feedparser>=6.0.0", + "transmission-rpc>=3.2.0", + "ruamel.yaml>=0.17.0", +] +classifiers = [ + "Development Status :: 3 - Alpha", + "Environment :: Console", + "Intended Audience :: End Users/Desktop", + "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Topic :: Communications :: File Sharing", + "Topic :: Internet", + "Topic :: Utilities", +] + +[project.urls] +Home = "https://git.shore.co.il/nimrod/transmission-feeder" + +[project.scripts] +transmission-feeder = "transmission_feeder:main" diff --git a/transmission_feeder/__init__.py b/transmission_feeder/__init__.py new file mode 100644 index 0000000..6f8856d --- /dev/null +++ b/transmission_feeder/__init__.py @@ -0,0 +1,12 @@ +"Add torrent to Transmission from RSS or Atom feeds." +import sys + +__version__ = "0.0.1" + + +def main(): + """Main entrypoint.""" + + +if __name__ == "__main__": + sys.exit(main()) -- GitLab