diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 3e00556..07c608a 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -51,6 +51,23 @@ jobs: steps: + # Clone the base template + - name: Clone base template + uses: actions/checkout@v3 + with: + repository: 'ADACS-Australia/adacs_template_python_base' + path: __adacs_template_python_base + + # Set the path where the base template will be stored and move it there + - name: Set temporary path + run: echo "TEMP_DIR=$(mktemp -d)" >> $GITHUB_ENV + + - name: Move base template + run: mv __adacs_template_python_base $TEMP_DIR + + - name: Set path to new base template location + run: echo "BASE_TEMPLATE_PATH=$(echo $TEMP_DIR/__adacs_template_python_base )" >> $GITHUB_ENV + # Set-up dependencies - name: Check-out repo uses: actions/checkout@v3 @@ -90,7 +107,7 @@ jobs: # note: --config is needed to prevent ruff from using a version elsewhere in the project. # This is important for template projects, for example. - name: Enforce linting - run: poetry run ruff --config pyproject.toml . + run: poetry run ruff check --config pyproject.toml . - name: Enforce formating run: poetry run black . @@ -101,6 +118,12 @@ jobs: poetry check poetry lock --check + # Set-up some dummy git credentials so the tests (which use git) will run + - name: Set-up git credentials + run: | + git config --global user.email "git@user.org" + git config --global user.name "Git, User" + # Run tests - name: Generate build run: poetry build diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 81ab20b..a95246d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ repos: # Some minor quality of life things - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.6.0 hooks: - id: check-merge-conflict - id: check-added-large-files @@ -18,28 +18,28 @@ repos: # Ensure that revisions for tools such as ruff, black, etc. can be # managed by Poetry but synced here before commiting code - repo: https://github.com/floatingpurr/sync_with_poetry - rev: 0.4.0 + rev: 1.1.0 hooks: - id: sync_with_poetry args: ['--db','.pre-commit-db.json'] # Format code - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 24.4.2 hooks: - id: black exclude: "{{cookiecutter.repo_name}}|hooks" # Lint code - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.243 + rev: v0.5.0 hooks: - id: ruff exclude: "{{cookiecutter.repo_name}}|hooks" # Make sure the Poetry project is properly maintained - repo: https://github.com/python-poetry/poetry - rev: 1.3.2 + rev: 1.8.0 hooks: - id: poetry-check - id: poetry-lock diff --git a/docs/conf.py b/docs/conf.py index caa493c..147151c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -15,7 +15,7 @@ def format_authors(authors): - if type(authors) == list: + if type(authors) is list: result = "" for i_author, author in enumerate(authors): if i_author == 0: @@ -24,7 +24,7 @@ def format_authors(authors): result = result + f", {author}" else: result = result + f", and {author}" - elif type(authors) == str: + elif type(authors) is str: result = authors return result @@ -124,6 +124,7 @@ def format_authors(authors): # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = True + # Handler for excluding modules, classes, etc from documentation # Presently, this just passes through the default behavior def autodoc_skip_member_handler(app, what, name, obj, skip, options): diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 48bca87..527580f 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -122,7 +122,8 @@ def print_instructions() -> None: # Render the file as Markdown with Rich print() console = Console() - console.print(Markdown(lines)) + if not {{ cookiecutter.__test }}: + console.print(Markdown(lines)) if __name__ == "__main__": @@ -131,5 +132,4 @@ def print_instructions() -> None: # venv("{{ cookiecutter.virtual_environment }}") # install("{{ cookiecutter.virtual_environment }}") {% endraw %} - if not {{ cookiecutter.__test }}: - print_instructions() + print_instructions() diff --git a/poetry.lock b/poetry.lock index e479ca4..fad258e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,10 +1,9 @@ -# This file is automatically @generated by Poetry and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. [[package]] name = "alabaster" version = "0.7.16" description = "A light, configurable Sphinx theme" -category = "main" optional = true python-versions = ">=3.9" files = [ @@ -16,7 +15,6 @@ files = [ name = "arrow" version = "1.3.0" description = "Better dates & times for Python" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -30,13 +28,12 @@ types-python-dateutil = ">=2.8.10" [package.extras] doc = ["doc8", "sphinx (>=7.0.0)", "sphinx-autobuild", "sphinx-autodoc-typehints", "sphinx_rtd_theme (>=1.3.0)"] -test = ["dateparser (>=1.0.0,<2.0.0)", "pre-commit", "pytest", "pytest-cov", "pytest-mock", "pytz (==2021.1)", "simplejson (>=3.0.0,<4.0.0)"] +test = ["dateparser (==1.*)", "pre-commit", "pytest", "pytest-cov", "pytest-mock", "pytz (==2021.1)", "simplejson (==3.*)"] [[package]] name = "babel" version = "2.15.0" description = "Internationalization utilities" -category = "main" optional = true python-versions = ">=3.8" files = [ @@ -51,7 +48,6 @@ dev = ["freezegun (>=1.0,<2.0)", "pytest (>=6.0)", "pytest-cov"] name = "binaryornot" version = "0.4.4" description = "Ultra-lightweight pure Python package to check if a file is binary or text." -category = "main" optional = false python-versions = "*" files = [ @@ -64,35 +60,45 @@ chardet = ">=3.0.2" [[package]] name = "black" -version = "22.12.0" +version = "24.4.2" description = "The uncompromising code formatter." -category = "main" optional = true -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "black-22.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9eedd20838bd5d75b80c9f5487dbcb06836a43833a37846cf1d8c1cc01cef59d"}, - {file = "black-22.12.0-cp310-cp310-win_amd64.whl", hash = "sha256:159a46a4947f73387b4d83e87ea006dbb2337eab6c879620a3ba52699b1f4351"}, - {file = "black-22.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d30b212bffeb1e252b31dd269dfae69dd17e06d92b87ad26e23890f3efea366f"}, - {file = "black-22.12.0-cp311-cp311-win_amd64.whl", hash = "sha256:7412e75863aa5c5411886804678b7d083c7c28421210180d67dfd8cf1221e1f4"}, - {file = "black-22.12.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c116eed0efb9ff870ded8b62fe9f28dd61ef6e9ddd28d83d7d264a38417dcee2"}, - {file = "black-22.12.0-cp37-cp37m-win_amd64.whl", hash = "sha256:1f58cbe16dfe8c12b7434e50ff889fa479072096d79f0a7f25e4ab8e94cd8350"}, - {file = "black-22.12.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:77d86c9f3db9b1bf6761244bc0b3572a546f5fe37917a044e02f3166d5aafa7d"}, - {file = "black-22.12.0-cp38-cp38-win_amd64.whl", hash = "sha256:82d9fe8fee3401e02e79767016b4907820a7dc28d70d137eb397b92ef3cc5bfc"}, - {file = "black-22.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:101c69b23df9b44247bd88e1d7e90154336ac4992502d4197bdac35dd7ee3320"}, - {file = "black-22.12.0-cp39-cp39-win_amd64.whl", hash = "sha256:559c7a1ba9a006226f09e4916060982fd27334ae1998e7a38b3f33a37f7a2148"}, - {file = "black-22.12.0-py3-none-any.whl", hash = "sha256:436cc9167dd28040ad90d3b404aec22cedf24a6e4d7de221bec2730ec0c97bcf"}, - {file = "black-22.12.0.tar.gz", hash = "sha256:229351e5a18ca30f447bf724d007f890f97e13af070bb6ad4c0a441cd7596a2f"}, + {file = "black-24.4.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:dd1b5a14e417189db4c7b64a6540f31730713d173f0b63e55fabd52d61d8fdce"}, + {file = "black-24.4.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8e537d281831ad0e71007dcdcbe50a71470b978c453fa41ce77186bbe0ed6021"}, + {file = "black-24.4.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eaea3008c281f1038edb473c1aa8ed8143a5535ff18f978a318f10302b254063"}, + {file = "black-24.4.2-cp310-cp310-win_amd64.whl", hash = "sha256:7768a0dbf16a39aa5e9a3ded568bb545c8c2727396d063bbaf847df05b08cd96"}, + {file = "black-24.4.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:257d724c2c9b1660f353b36c802ccece186a30accc7742c176d29c146df6e474"}, + {file = "black-24.4.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:bdde6f877a18f24844e381d45e9947a49e97933573ac9d4345399be37621e26c"}, + {file = "black-24.4.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e151054aa00bad1f4e1f04919542885f89f5f7d086b8a59e5000e6c616896ffb"}, + {file = "black-24.4.2-cp311-cp311-win_amd64.whl", hash = "sha256:7e122b1c4fb252fd85df3ca93578732b4749d9be076593076ef4d07a0233c3e1"}, + {file = "black-24.4.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:accf49e151c8ed2c0cdc528691838afd217c50412534e876a19270fea1e28e2d"}, + {file = "black-24.4.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:88c57dc656038f1ab9f92b3eb5335ee9b021412feaa46330d5eba4e51fe49b04"}, + {file = "black-24.4.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:be8bef99eb46d5021bf053114442914baeb3649a89dc5f3a555c88737e5e98fc"}, + {file = "black-24.4.2-cp312-cp312-win_amd64.whl", hash = "sha256:415e686e87dbbe6f4cd5ef0fbf764af7b89f9057b97c908742b6008cc554b9c0"}, + {file = "black-24.4.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:bf10f7310db693bb62692609b397e8d67257c55f949abde4c67f9cc574492cc7"}, + {file = "black-24.4.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:98e123f1d5cfd42f886624d84464f7756f60ff6eab89ae845210631714f6db94"}, + {file = "black-24.4.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:48a85f2cb5e6799a9ef05347b476cce6c182d6c71ee36925a6c194d074336ef8"}, + {file = "black-24.4.2-cp38-cp38-win_amd64.whl", hash = "sha256:b1530ae42e9d6d5b670a34db49a94115a64596bc77710b1d05e9801e62ca0a7c"}, + {file = "black-24.4.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:37aae07b029fa0174d39daf02748b379399b909652a806e5708199bd93899da1"}, + {file = "black-24.4.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:da33a1a5e49c4122ccdfd56cd021ff1ebc4a1ec4e2d01594fef9b6f267a9e741"}, + {file = "black-24.4.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ef703f83fc32e131e9bcc0a5094cfe85599e7109f896fe8bc96cc402f3eb4b6e"}, + {file = "black-24.4.2-cp39-cp39-win_amd64.whl", hash = "sha256:b9176b9832e84308818a99a561e90aa479e73c523b3f77afd07913380ae2eab7"}, + {file = "black-24.4.2-py3-none-any.whl", hash = "sha256:d36ed1124bb81b32f8614555b34cc4259c3fbc7eec17870e8ff8ded335b58d8c"}, + {file = "black-24.4.2.tar.gz", hash = "sha256:c872b53057f000085da66a19c55d68f6f8ddcac2642392ad3a355878406fbd4d"}, ] [package.dependencies] click = ">=8.0.0" mypy-extensions = ">=0.4.3" +packaging = ">=22.0" pathspec = ">=0.9.0" platformdirs = ">=2" [package.extras] colorama = ["colorama (>=0.4.3)"] -d = ["aiohttp (>=3.7.4)"] +d = ["aiohttp (>=3.7.4)", "aiohttp (>=3.7.4,!=3.9.0)"] jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] uvloop = ["uvloop (>=0.15.2)"] @@ -100,7 +106,6 @@ uvloop = ["uvloop (>=0.15.2)"] name = "certifi" version = "2024.6.2" description = "Python package for providing Mozilla's CA Bundle." -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -112,7 +117,6 @@ files = [ name = "cfgv" version = "3.4.0" description = "Validate configuration and produce human readable error messages." -category = "main" optional = true python-versions = ">=3.8" files = [ @@ -124,7 +128,6 @@ files = [ name = "chardet" version = "5.2.0" description = "Universal encoding detector for Python 3" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -136,7 +139,6 @@ files = [ name = "charset-normalizer" version = "3.3.2" description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." -category = "main" optional = false python-versions = ">=3.7.0" files = [ @@ -236,7 +238,6 @@ files = [ name = "click" version = "8.1.7" description = "Composable command line interface toolkit" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -251,7 +252,6 @@ colorama = {version = "*", markers = "platform_system == \"Windows\""} name = "colorama" version = "0.4.6" description = "Cross-platform colored terminal text." -category = "main" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" files = [ @@ -263,7 +263,6 @@ files = [ name = "cookiecutter" version = "2.6.0" description = "A command-line utility that creates projects from project templates, e.g. creating a Python package project from a Python package project template." -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -285,7 +284,6 @@ rich = "*" name = "distlib" version = "0.3.8" description = "Distribution utilities" -category = "main" optional = true python-versions = "*" files = [ @@ -297,7 +295,6 @@ files = [ name = "docutils" version = "0.18.1" description = "Docutils -- Python Documentation Utilities" -category = "main" optional = true python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" files = [ @@ -309,7 +306,6 @@ files = [ name = "filelock" version = "3.15.4" description = "A platform independent file lock." -category = "main" optional = true python-versions = ">=3.8" files = [ @@ -326,7 +322,6 @@ typing = ["typing-extensions (>=4.8)"] name = "identify" version = "2.5.36" description = "File identification library for Python" -category = "main" optional = true python-versions = ">=3.8" files = [ @@ -341,7 +336,6 @@ license = ["ukkonen"] name = "idna" version = "3.7" description = "Internationalized Domain Names in Applications (IDNA)" -category = "main" optional = false python-versions = ">=3.5" files = [ @@ -353,7 +347,6 @@ files = [ name = "imagesize" version = "1.4.1" description = "Getting image size from png/jpeg/jpeg2000/gif file" -category = "main" optional = true python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" files = [ @@ -365,7 +358,6 @@ files = [ name = "iniconfig" version = "2.0.0" description = "brain-dead simple config-ini parsing" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -377,7 +369,6 @@ files = [ name = "jinja2" version = "3.1.4" description = "A very fast and expressive template engine." -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -395,7 +386,6 @@ i18n = ["Babel (>=2.7)"] name = "markdown-it-py" version = "2.2.0" description = "Python port of markdown-it. Markdown parsing, done right!" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -420,7 +410,6 @@ testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"] name = "markupsafe" version = "2.1.5" description = "Safely add untrusted strings to HTML/XML markup." -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -490,7 +479,6 @@ files = [ name = "mdit-py-plugins" version = "0.3.5" description = "Collection of plugins for markdown-it-py" -category = "main" optional = true python-versions = ">=3.7" files = [ @@ -510,7 +498,6 @@ testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"] name = "mdurl" version = "0.1.2" description = "Markdown URL utilities" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -522,7 +509,6 @@ files = [ name = "mypy" version = "1.10.1" description = "Optional static typing for Python" -category = "main" optional = true python-versions = ">=3.8" files = [ @@ -569,7 +555,6 @@ reports = ["lxml"] name = "mypy-extensions" version = "1.0.0" description = "Type system extensions for programs checked with the mypy type checker." -category = "main" optional = true python-versions = ">=3.5" files = [ @@ -581,7 +566,6 @@ files = [ name = "myst-parser" version = "1.0.0" description = "An extended [CommonMark](https://spec.commonmark.org/) compliant parser," -category = "main" optional = true python-versions = ">=3.7" files = [ @@ -608,7 +592,6 @@ testing-docutils = ["pygments", "pytest (>=7,<8)", "pytest-param-files (>=0.3.4, name = "nodeenv" version = "1.9.1" description = "Node.js virtual environment builder" -category = "main" optional = true python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" files = [ @@ -620,7 +603,6 @@ files = [ name = "packaging" version = "24.1" description = "Core utilities for Python packages" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -632,7 +614,6 @@ files = [ name = "pathspec" version = "0.12.1" description = "Utility library for gitignore style pattern matching of file paths." -category = "main" optional = true python-versions = ">=3.8" files = [ @@ -644,7 +625,6 @@ files = [ name = "platformdirs" version = "4.2.2" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`." -category = "main" optional = true python-versions = ">=3.8" files = [ @@ -661,7 +641,6 @@ type = ["mypy (>=1.8)"] name = "pluggy" version = "1.5.0" description = "plugin and hook calling mechanisms for python" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -677,7 +656,6 @@ testing = ["pytest", "pytest-benchmark"] name = "pre-commit" version = "3.7.1" description = "A framework for managing and maintaining multi-language pre-commit hooks." -category = "main" optional = true python-versions = ">=3.9" files = [ @@ -696,7 +674,6 @@ virtualenv = ">=20.10.0" name = "pygments" version = "2.18.0" description = "Pygments is a syntax highlighting package written in Python." -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -711,7 +688,6 @@ windows-terminal = ["colorama (>=0.4.6)"] name = "pytest" version = "7.4.4" description = "pytest: simple powerful testing with Python" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -732,7 +708,6 @@ testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "no name = "pytest-cookies" version = "0.7.0" description = "The pytest plugin for your Cookiecutter templates. 🍪" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -748,7 +723,6 @@ pytest = ">=3.9.0" name = "pytest-mock" version = "3.14.0" description = "Thin-wrapper around the mock package for easier use with pytest" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -766,7 +740,6 @@ dev = ["pre-commit", "pytest-asyncio", "tox"] name = "python-dateutil" version = "2.9.0.post0" description = "Extensions to the standard Python datetime module" -category = "main" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" files = [ @@ -781,7 +754,6 @@ six = ">=1.5" name = "python-slugify" version = "8.0.4" description = "A Python slugify application that also handles Unicode" -category = "main" optional = false python-versions = ">=3.7" files = [ @@ -799,7 +771,6 @@ unidecode = ["Unidecode (>=1.1.1)"] name = "pyyaml" version = "6.0.1" description = "YAML parser and emitter for Python" -category = "main" optional = false python-versions = ">=3.6" files = [ @@ -860,7 +831,6 @@ files = [ name = "requests" version = "2.32.3" description = "Python HTTP for Humans." -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -882,7 +852,6 @@ use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] name = "rich" version = "13.7.1" description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" -category = "main" optional = false python-versions = ">=3.7.0" files = [ @@ -899,35 +868,35 @@ jupyter = ["ipywidgets (>=7.5.1,<9)"] [[package]] name = "ruff" -version = "0.0.243" -description = "An extremely fast Python linter, written in Rust." -category = "main" +version = "0.5.0" +description = "An extremely fast Python linter and code formatter, written in Rust." optional = true python-versions = ">=3.7" files = [ - {file = "ruff-0.0.243-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:242571d79d3d7a1e441e88b0cf2814b24bfc4e3a073e5d82df81aa52ad829e4c"}, - {file = "ruff-0.0.243-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:4fd0ef0dddd7ccce6457cca556baf51504c11f7deaaa5944a47c5e0c6c3b1425"}, - {file = "ruff-0.0.243-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a9e2e6632e2d07e6e7257a44592e0fade0d5df23004a3b180efd0d3bbb581a09"}, - {file = "ruff-0.0.243-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:9a70c7810453f6c5120887fc22fcbcf8a4987e767f45270a9aad5e6e9b0a26ff"}, - {file = "ruff-0.0.243-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0cb8ef4a5cbb219ed344286b07795c0b88f277bc860207e0a6bce0fd8e4c5f8e"}, - {file = "ruff-0.0.243-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:f75c11940cc6b374ba070b5dc154c85c2b8753d03cbb53f182438404bae52d31"}, - {file = "ruff-0.0.243-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:919075726724d62b60caedd286317ca0c77cb67ba4291b9067feafdac2506872"}, - {file = "ruff-0.0.243-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a0f5bdb14a2a2f9a63f6f0979fb0501e426e2bd8e6499ade41e1311b379a4d92"}, - {file = "ruff-0.0.243-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b8ffdbf62d72db5ab5d3b51abe5b4dfb53cf3f330af7f57e0101f36ff7176449"}, - {file = "ruff-0.0.243-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:081b70f1dd2d16d9f60079cf95215d9095ca16032c02118cfc88b0b53e406b9c"}, - {file = "ruff-0.0.243-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:d8f1d26c0a3b51a4b5c493c29536112c61ec6ff7a66c5b673b2af37b7859d6f1"}, - {file = "ruff-0.0.243-py3-none-musllinux_1_2_i686.whl", hash = "sha256:5f432e745f6b38e2a643ae9c05ae30345196a435a23d844b61a50d1808acba82"}, - {file = "ruff-0.0.243-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:f38b6b6470b468271e283ecc7bc169465b3f3cdb6df199abe69aff0c3c17c756"}, - {file = "ruff-0.0.243-py3-none-win32.whl", hash = "sha256:2707e2c32ace855afad3e06bddf2280d1fc15e303dea2de3ccd0e308a5b395ae"}, - {file = "ruff-0.0.243-py3-none-win_amd64.whl", hash = "sha256:be44aff098fd424b9a9218eedef80d7125222ea86c3cd62e15f6f587455c99f3"}, - {file = "ruff-0.0.243.tar.gz", hash = "sha256:d5847e75038b51801f45b31a93c3526114d3aac59acea3493bb06ebc7783b004"}, + {file = "ruff-0.5.0-py3-none-linux_armv6l.whl", hash = "sha256:ee770ea8ab38918f34e7560a597cc0a8c9a193aaa01bfbd879ef43cb06bd9c4c"}, + {file = "ruff-0.5.0-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:38f3b8327b3cb43474559d435f5fa65dacf723351c159ed0dc567f7ab735d1b6"}, + {file = "ruff-0.5.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:7594f8df5404a5c5c8f64b8311169879f6cf42142da644c7e0ba3c3f14130370"}, + {file = "ruff-0.5.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:adc7012d6ec85032bc4e9065110df205752d64010bed5f958d25dbee9ce35de3"}, + {file = "ruff-0.5.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d505fb93b0fabef974b168d9b27c3960714d2ecda24b6ffa6a87ac432905ea38"}, + {file = "ruff-0.5.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9dc5cfd3558f14513ed0d5b70ce531e28ea81a8a3b1b07f0f48421a3d9e7d80a"}, + {file = "ruff-0.5.0-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:db3ca35265de239a1176d56a464b51557fce41095c37d6c406e658cf80bbb362"}, + {file = "ruff-0.5.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b1a321c4f68809fddd9b282fab6a8d8db796b270fff44722589a8b946925a2a8"}, + {file = "ruff-0.5.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2c4dfcd8d34b143916994b3876b63d53f56724c03f8c1a33a253b7b1e6bf2a7d"}, + {file = "ruff-0.5.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:81e5facfc9f4a674c6a78c64d38becfbd5e4f739c31fcd9ce44c849f1fad9e4c"}, + {file = "ruff-0.5.0-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:e589e27971c2a3efff3fadafb16e5aef7ff93250f0134ec4b52052b673cf988d"}, + {file = "ruff-0.5.0-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:d2ffbc3715a52b037bcb0f6ff524a9367f642cdc5817944f6af5479bbb2eb50e"}, + {file = "ruff-0.5.0-py3-none-musllinux_1_2_i686.whl", hash = "sha256:cd096e23c6a4f9c819525a437fa0a99d1c67a1b6bb30948d46f33afbc53596cf"}, + {file = "ruff-0.5.0-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:46e193b36f2255729ad34a49c9a997d506e58f08555366b2108783b3064a0e1e"}, + {file = "ruff-0.5.0-py3-none-win32.whl", hash = "sha256:49141d267100f5ceff541b4e06552e98527870eafa1acc9dec9139c9ec5af64c"}, + {file = "ruff-0.5.0-py3-none-win_amd64.whl", hash = "sha256:e9118f60091047444c1b90952736ee7b1792910cab56e9b9a9ac20af94cd0440"}, + {file = "ruff-0.5.0-py3-none-win_arm64.whl", hash = "sha256:ed5c4df5c1fb4518abcb57725b576659542bdbe93366f4f329e8f398c4b71178"}, + {file = "ruff-0.5.0.tar.gz", hash = "sha256:eb641b5873492cf9bd45bc9c5ae5320648218e04386a5f0c264ad6ccce8226a1"}, ] [[package]] name = "six" version = "1.16.0" description = "Python 2 and 3 compatibility utilities" -category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" files = [ @@ -939,7 +908,6 @@ files = [ name = "snowballstemmer" version = "2.2.0" description = "This package provides 29 stemmers for 28 languages generated from Snowball algorithms." -category = "main" optional = true python-versions = "*" files = [ @@ -951,7 +919,6 @@ files = [ name = "sphinx" version = "6.2.1" description = "Python documentation generator" -category = "main" optional = true python-versions = ">=3.8" files = [ @@ -986,7 +953,6 @@ test = ["cython", "filelock", "html5lib", "pytest (>=4.6)"] name = "sphinx-click" version = "4.4.0" description = "Sphinx extension that automatically documents click applications" -category = "main" optional = true python-versions = ">=3.7" files = [ @@ -1003,7 +969,6 @@ sphinx = ">=2.0" name = "sphinx-copybutton" version = "0.5.2" description = "Add a copy button to each of your code cells." -category = "main" optional = true python-versions = ">=3.7" files = [ @@ -1020,20 +985,19 @@ rtd = ["ipython", "myst-nb", "sphinx", "sphinx-book-theme", "sphinx-examples"] [[package]] name = "sphinx-rtd-theme" -version = "1.2.0" +version = "1.3.0" description = "Read the Docs theme for Sphinx" -category = "main" optional = true python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7" files = [ - {file = "sphinx_rtd_theme-1.2.0-py2.py3-none-any.whl", hash = "sha256:f823f7e71890abe0ac6aaa6013361ea2696fc8d3e1fa798f463e82bdb77eeff2"}, - {file = "sphinx_rtd_theme-1.2.0.tar.gz", hash = "sha256:a0d8bd1a2ed52e0b338cbe19c4b2eef3c5e7a048769753dac6a9f059c7b641b8"}, + {file = "sphinx_rtd_theme-1.3.0-py2.py3-none-any.whl", hash = "sha256:46ddef89cc2416a81ecfbeaceab1881948c014b1b6e4450b815311a89fb977b0"}, + {file = "sphinx_rtd_theme-1.3.0.tar.gz", hash = "sha256:590b030c7abb9cf038ec053b95e5380b5c70d61591eb0b552063fbe7c41f0931"}, ] [package.dependencies] docutils = "<0.19" -sphinx = ">=1.6,<7" -sphinxcontrib-jquery = {version = ">=2.0.0,<3.0.0 || >3.0.0", markers = "python_version > \"3\""} +sphinx = ">=1.6,<8" +sphinxcontrib-jquery = ">=4,<5" [package.extras] dev = ["bump2version", "sphinxcontrib-httpdomain", "transifex-client", "wheel"] @@ -1042,7 +1006,6 @@ dev = ["bump2version", "sphinxcontrib-httpdomain", "transifex-client", "wheel"] name = "sphinxcontrib-applehelp" version = "1.0.8" description = "sphinxcontrib-applehelp is a Sphinx extension which outputs Apple help books" -category = "main" optional = true python-versions = ">=3.9" files = [ @@ -1059,7 +1022,6 @@ test = ["pytest"] name = "sphinxcontrib-devhelp" version = "1.0.6" description = "sphinxcontrib-devhelp is a sphinx extension which outputs Devhelp documents" -category = "main" optional = true python-versions = ">=3.9" files = [ @@ -1076,7 +1038,6 @@ test = ["pytest"] name = "sphinxcontrib-htmlhelp" version = "2.0.5" description = "sphinxcontrib-htmlhelp is a sphinx extension which renders HTML help files" -category = "main" optional = true python-versions = ">=3.9" files = [ @@ -1093,7 +1054,6 @@ test = ["html5lib", "pytest"] name = "sphinxcontrib-jquery" version = "4.1" description = "Extension to include jQuery on newer Sphinx releases" -category = "main" optional = true python-versions = ">=2.7" files = [ @@ -1108,7 +1068,6 @@ Sphinx = ">=1.8" name = "sphinxcontrib-jsmath" version = "1.0.1" description = "A sphinx extension which renders display math in HTML via JavaScript" -category = "main" optional = true python-versions = ">=3.5" files = [ @@ -1123,7 +1082,6 @@ test = ["flake8", "mypy", "pytest"] name = "sphinxcontrib-qthelp" version = "1.0.7" description = "sphinxcontrib-qthelp is a sphinx extension which outputs QtHelp documents" -category = "main" optional = true python-versions = ">=3.9" files = [ @@ -1140,7 +1098,6 @@ test = ["pytest"] name = "sphinxcontrib-serializinghtml" version = "1.1.10" description = "sphinxcontrib-serializinghtml is a sphinx extension which outputs \"serialized\" HTML files (json and pickle)" -category = "main" optional = true python-versions = ">=3.9" files = [ @@ -1157,7 +1114,6 @@ test = ["pytest"] name = "text-unidecode" version = "1.3" description = "The most basic Text::Unidecode port" -category = "main" optional = false python-versions = "*" files = [ @@ -1169,7 +1125,6 @@ files = [ name = "types-python-dateutil" version = "2.9.0.20240316" description = "Typing stubs for python-dateutil" -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -1181,7 +1136,6 @@ files = [ name = "typing-extensions" version = "4.12.2" description = "Backported and Experimental Type Hints for Python 3.8+" -category = "main" optional = true python-versions = ">=3.8" files = [ @@ -1193,7 +1147,6 @@ files = [ name = "urllib3" version = "2.2.2" description = "HTTP library with thread-safe connection pooling, file post, and more." -category = "main" optional = false python-versions = ">=3.8" files = [ @@ -1211,7 +1164,6 @@ zstd = ["zstandard (>=0.18.0)"] name = "virtualenv" version = "20.26.3" description = "Virtual Python Environment builder" -category = "main" optional = true python-versions = ">=3.7" files = [ @@ -1229,10 +1181,10 @@ docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.2,!=7.3)", "s test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.4)", "pytest-env (>=0.8.2)", "pytest-freezer (>=0.4.8)", "pytest-mock (>=3.11.1)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=68)", "time-machine (>=2.10)"] [extras] -dev = ["pre-commit", "pytest", "mypy", "black", "ruff"] -docs = ["Sphinx", "sphinx-rtd-theme", "myst-parser", "sphinx-click", "sphinx-copybutton"] +dev = ["black", "mypy", "pre-commit", "pytest", "ruff"] +docs = ["Sphinx", "myst-parser", "sphinx-click", "sphinx-copybutton", "sphinx-rtd-theme"] [metadata] lock-version = "2.0" python-versions = " >=3.11" -content-hash = "c601c777fd0613def539ab42b97b8d379e3aeba163fb730c19b33dfc9087ef5d" +content-hash = "ed6d43e4416162e6eec3d4a71ede85f2af8e3c8001e69086c2713a6b7617e58b" diff --git a/pyproject.toml b/pyproject.toml index f910be9..f919e14 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,21 +13,21 @@ documentation = "https://adacs_template_python_base.readthedocs.io/en/latest/" [tool.poetry.dependencies] python = " >=3.11" -click = "^8.1.3" -Sphinx = { version = "^6.1.3", optional = true } -sphinx-rtd-theme = { version = "1.2.0", optional = true } -myst-parser = { version = "^1.0.0", optional = true } -pre-commit = { version = "^3.0.4", optional = true } -pytest = { version = "^7.0", optional = true } -black = { version = "^22.10.0", optional = true } -ruff = { version = "^0.0.243", optional = true} -sphinx-click = { version = "^4.4.0", optional = true } -mypy = { version = "^1.1.1", optional = true } -sphinx-copybutton = { version = "^0.5.1", optional = true } -pytest-mock = "^3.11.1" -rich = "^13.5.2" -cookiecutter = "^2.5.0" -pytest-cookies = "^0.7.0" +click = "^8" +Sphinx = { version = "^6", optional = true } +sphinx-rtd-theme = { version = "^1", optional = true } +myst-parser = { version = "^1", optional = true } +pre-commit = { version = "^3", optional = true } +pytest = { version = "^7", optional = true } +black = { version = "^24", optional = true } +ruff = { version = "^0", optional = true} +sphinx-click = { version = "^4", optional = true } +mypy = { version = "^1", optional = true } +sphinx-copybutton = { version = "^0", optional = true } +pytest-mock = "^3" +rich = "^13" +cookiecutter = "^2" +pytest-cookies = "^0" [tool.poetry.extras] docs = [ @@ -60,13 +60,21 @@ ignore_missing_imports = true mypy_path = "$MYPY_CONFIG_FILE_DIR/tests" [tool.black] +extend-exclude = ''' +^/( + {{cookiecutter.repo_name}} # checked by pytest + | hooks # These files are treated as Jinja2 templates and may have invalid Python code +) +''' + +[tool.ruff] +line-length = 88 # to match Black extend-exclude = [ '\{\{cookiecutter.repo_name\}\}', # checked by pytest 'hooks' # These files are treated as Jinja2 templates and may have invalid Python code ] -[tool.ruff] -line-length = 88 # to match Black +[tool.ruff.lint] select = [ "E", "F", @@ -75,17 +83,12 @@ select = [ ignore = [ "E501", # line length violations (let Black handle this) ] -extend-exclude = [ - '\{\{cookiecutter.repo_name\}\}', # checked by pytest - 'hooks' # These files are treated as Jinja2 templates and may have invalid Python code -] - # Ignore `E402` (import violations) in all `__init__.py` files, and in `path/to/file.py`. [tool.ruff.per-file-ignores] "__init__.py" = ["E402"] -[tool.ruff.pydocstyle] +[tool.ruff.lint.pydocstyle] convention = "numpy" [build-system] diff --git a/tests/test_template.py b/tests/test_template.py index cc05a0d..d46ce04 100644 --- a/tests/test_template.py +++ b/tests/test_template.py @@ -36,4 +36,4 @@ def test_template_run_black(bake_path): def test_template_run_ruff(bake_path): - run_inside_dir("ruff .", bake_path) == 0 + run_inside_dir("ruff check .", bake_path) == 0 diff --git a/{{cookiecutter.repo_name}}/.pre-commit-config.yaml b/{{cookiecutter.repo_name}}/.pre-commit-config.yaml index 5fb06a3..be7545d 100644 --- a/{{cookiecutter.repo_name}}/.pre-commit-config.yaml +++ b/{{cookiecutter.repo_name}}/.pre-commit-config.yaml @@ -8,10 +8,9 @@ repos: # Some minor quality of life things - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.6.0 hooks: - id: check-merge-conflict - - id: check-yaml - id: check-added-large-files - id: no-commit-to-branch args: ['--branch', 'main'] # Commits to main only allowed VIA PR for this project @@ -19,26 +18,26 @@ repos: # Ensure that revisions for tools such as ruff, black, etc. can be # managed by Poetry but synced here before commiting code - repo: https://github.com/floatingpurr/sync_with_poetry - rev: 0.4.0 + rev: 1.1.0 hooks: - id: sync_with_poetry args: ['--db','.pre-commit-db.json'] # Format code - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 24.4.2 hooks: - id: black # Lint code - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.243 + rev: v0.5.0 hooks: - id: ruff # Make sure the Poetry project is properly maintained - repo: https://github.com/python-poetry/poetry - rev: 1.3.2 + rev: 1.8.0 hooks: - id: poetry-check - id: poetry-lock diff --git a/{{cookiecutter.repo_name}}/docs/conf.py b/{{cookiecutter.repo_name}}/docs/conf.py index 408254f..26df2c7 100644 --- a/{{cookiecutter.repo_name}}/docs/conf.py +++ b/{{cookiecutter.repo_name}}/docs/conf.py @@ -15,7 +15,7 @@ def format_authors(authors): - if type(authors) == list: + if type(authors) is list: result = "" for i_author, author in enumerate(authors): if i_author == 0: @@ -24,7 +24,7 @@ def format_authors(authors): result = result + f", {author}" else: result = result + f", and {author}" - elif type(authors) == str: + elif type(authors) is str: result = authors return result @@ -124,6 +124,7 @@ def format_authors(authors): # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = True + # Handler for excluding modules, classes, etc from documentation # Presently, this just passes through the default behavior def autodoc_skip_member_handler(app, what, name, obj, skip, options): diff --git a/{{cookiecutter.repo_name}}/pyproject.toml b/{{cookiecutter.repo_name}}/pyproject.toml index 895ff75..50e1652 100644 --- a/{{cookiecutter.repo_name}}/pyproject.toml +++ b/{{cookiecutter.repo_name}}/pyproject.toml @@ -13,19 +13,22 @@ documentation = "https://{{cookiecutter.rtd_project_name}}.readthedocs.io/en/lat [tool.poetry.dependencies] python = " >=3.11" -click = "^8.1.3" -Sphinx = { version = "^6.1.3", optional = true } -sphinx-rtd-theme = { version = "1.2.0", optional = true } -myst-parser = { version = "^1.0.0", optional = true } -pre-commit = { version = "^3.0.4", optional = true } -pytest = { version = "^7.0", optional = true } -pytest-cov = { version = "^4.1.0", optional = true } -black = { version = "^22.10.0", optional = true } -ruff = { version = "^0.0.243", optional = true} -sphinx-click = { version = "^4.4.0", optional = true } -mypy = { version = "^1.1.1", optional = true } -sphinx-copybutton = { version = "^0.5.1", optional = true } -pytest-mock = "^3.11.1" +click = "^8" +Sphinx = { version = "^6", optional = true } +sphinx-rtd-theme = { version = "^1", optional = true } +myst-parser = { version = "^1", optional = true } +pre-commit = { version = "^3", optional = true } +pytest = { version = "^7", optional = true } +pytest-cov = { version = "^5", optional = true } +black = { version = "^24", optional = true } +ruff = { version = "^0", optional = true} +sphinx-click = { version = "^4", optional = true } +mypy = { version = "^1", optional = true } +sphinx-copybutton = { version = "^0", optional = true } +pytest-mock = "^3" +rich = "^13" +cookiecutter = "^2" +pytest-cookies = "^0" [tool.poetry.extras] docs = [ @@ -85,6 +88,8 @@ exclude_lines = [ [tool.ruff] line-length = 88 # to match Black + +[tool.ruff.lint] select = [ "E", "F", @@ -94,11 +99,12 @@ ignore = [ "E501", # line length violations (let Black handle this) ] + # Ignore `E402` (import violations) in all `__init__.py` files, and in `path/to/file.py`. -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "__init__.py" = ["E402"] -[tool.ruff.pydocstyle] +[tool.ruff.lint.pydocstyle] convention = "numpy" [build-system]