diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..b584995 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + # Check for updates to GitHub Actions every week + interval: "weekly" diff --git a/.github/workflows/ruff-format.yml b/.github/workflows/ruff-format.yml new file mode 100644 index 0000000..60a211e --- /dev/null +++ b/.github/workflows/ruff-format.yml @@ -0,0 +1,15 @@ +name: Ruff-Format +on: [workflow_dispatch, pull_request] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: "3.*" + - uses: astral-sh/ruff-action@v3 + with: + args: "format --check" + continue-on-error: false \ No newline at end of file diff --git a/.github/workflows/ruff-lint.yml b/.github/workflows/ruff-lint.yml new file mode 100644 index 0000000..3399347 --- /dev/null +++ b/.github/workflows/ruff-lint.yml @@ -0,0 +1,15 @@ +name: Ruff-Lint +on: [workflow_dispatch, pull_request] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: "3.*" + - uses: astral-sh/ruff-action@v3 + with: + args: "check --fix" + continue-on-error: false \ No newline at end of file diff --git a/.gitignore b/.gitignore index 0e2fd75..139d02a 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,8 @@ # Python ############################################### +.ruff_cache/ + # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] diff --git a/omdb/__init__.py b/omdb/__init__.py index 0975404..ee1418e 100644 --- a/omdb/__init__.py +++ b/omdb/__init__.py @@ -1,4 +1,4 @@ -""" the omdb module """ +"""the omdb module""" from omdb.exceptions import OMDBException, OMDBLimitReached, OMDBNoResults, OMDBTooManyResults from omdb.omdb import OMDB diff --git a/omdb/exceptions.py b/omdb/exceptions.py index 76bbb24..ffb0122 100644 --- a/omdb/exceptions.py +++ b/omdb/exceptions.py @@ -1,5 +1,4 @@ -""" Exceptions for the pyomdbapi project """ - +"""Exceptions for the pyomdbapi project""" from typing import Dict diff --git a/omdb/omdb.py b/omdb/omdb.py index 44eed7e..5e471e5 100644 --- a/omdb/omdb.py +++ b/omdb/omdb.py @@ -5,19 +5,8 @@ import requests -from omdb.exceptions import ( - OMDBException, - OMDBInvalidAPIKey, - OMDBLimitReached, - OMDBNoResults, - OMDBTooManyResults, -) -from omdb.utilities import ( - camelcase_to_snake_case, - clean_up_strings, - range_inclusive, - to_int, -) +from omdb.exceptions import OMDBException, OMDBInvalidAPIKey, OMDBLimitReached, OMDBNoResults, OMDBTooManyResults +from omdb.utilities import camelcase_to_snake_case, clean_up_strings, range_inclusive, to_int class OMDB: diff --git a/omdb/utilities.py b/omdb/utilities.py index 364aad5..41f4fc5 100644 --- a/omdb/utilities.py +++ b/omdb/utilities.py @@ -1,4 +1,4 @@ -"""A utilitites suite""" +"""A utilities suite""" def camelcase_to_snake_case(_input: str) -> str: diff --git a/pyproject.toml b/pyproject.toml index fbb9bd5..69ce0f4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,6 +62,101 @@ line-length = 120 target-version = ['py36'] include = '\.pyi?$' +############################################ +# Ruff +########################################### +[tool.ruff] +include = ["pyproject.toml", "omdb/**/*.py", "omdb/*.py"] +exclude = [ + ".bzr", + ".direnv", + ".eggs", + ".git", + ".git-rewrite", + ".hg", + ".ipynb_checkpoints", + ".mypy_cache", + ".nox", + ".pants.d", + ".pyenv", + ".pytest_cache", + ".pytype", + ".ruff_cache", + ".svn", + ".tox", + ".venv", + ".vscode", + "__pypackages__", + "_build", + "buck-out", + "build", + "dist", + "node_modules", + "site-packages", + "venv", +] + +# Same as Black. +line-length = 120 +indent-width = 4 + +# Assume Python 3.8 +target-version = "py38" + +[tool.ruff.lint] +# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default. +# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or +# McCabe complexity (`C901`) by default. +select = [ + # pycodestyle + "E", + # Pyflakes + "F", + # pyupgrade + "UP", + # flake8-bugbear + "B", + # flake8-simplify + "SIM", + # isort + "I", +] +ignore = [] + +# Allow fix for all enabled rules (when `--fix`) is provided. +fixable = ["ALL"] +unfixable = [] + +# Allow unused variables when underscore-prefixed. +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" + +[tool.ruff.format] +# Like Black, use double quotes for strings. +quote-style = "double" + +# Like Black, indent with spaces, rather than tabs. +indent-style = "space" + +# Like Black, respect magic trailing commas. +skip-magic-trailing-comma = false + +# Like Black, automatically detect the appropriate line ending. +line-ending = "auto" + +# Enable auto-formatting of code examples in docstrings. Markdown, +# reStructuredText code/literal blocks and doctests are all supported. +# +# This is currently disabled by default, but it is planned for this +# to be opt-out in the future. +docstring-code-format = false + +# Set the line length limit used when formatting code snippets in +# docstrings. +# +# This only has an effect when the `docstring-code-format` setting is +# enabled. +docstring-code-line-length = "dynamic" + [build-system] requires = ["setuptools>=61.2.0", "wheel"] build-backend = "setuptools.build_meta"