diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 67c338d..27413a5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,26 +27,22 @@ jobs: fail-fast: false matrix: os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] steps: - - uses: actions/checkout@v3 - - uses: mamba-org/provision-with-micromamba@main + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 with: - environment-file: false - environment-name: gha-testing - channels: conda-forge,nodefaults - extra-specs: | - python=${{ matrix.python-version }} - mamba - tox-conda - cache-downloads: true - - - name: Run end-to-end tests. + python-version: ${{ matrix.python-version }} + cache: pip + allow-prereleases: true + - run: pip install tox + + - name: Run tests. shell: bash -l {0} - run: tox -e pytest -- tests -m end_to_end --cov=./ --cov-report=xml -n auto + run: tox -e test -- --cov=./ --cov-report=xml - - name: Upload coverage reports of end-to-end tests. - if: runner.os == 'Linux' && matrix.python-version == '3.9' + - name: Upload coverage reports of tests. + if: runner.os == 'Linux' && matrix.python-version == '3.10' shell: bash -l {0} - run: bash <(curl -s https://codecov.io/bash) -F end_to_end -c + run: bash <(curl -s https://codecov.io/bash) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 74e785d..668bff7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ exclude: | repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: check-added-large-files args: ['--maxkb=25'] @@ -38,46 +38,26 @@ repos: rev: v3.9.0 hooks: - id: reorder-python-imports -- repo: https://github.com/asottile/setup-cfg-fmt - rev: v2.2.0 +- repo: https://github.com/aio-libs/sort-all + rev: v1.2.0 hooks: - - id: setup-cfg-fmt - exclude: | - (?x)^( - {{cookiecutter.project_slug}}/setup.cfg - )$ -- repo: https://github.com/psf/black - rev: 23.1.0 - hooks: - - id: black -- repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.241 + - id: sort-all +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.1.6 hooks: - id: ruff - args: [hooks, tests] + args: [--config, pyproject.toml, hooks, tests] pass_filenames: false + - id: ruff-format + args: [--config, pyproject.toml] - repo: https://github.com/dosisod/refurb - rev: v1.10.0 + rev: v1.24.0 hooks: - id: refurb args: [--ignore, FURB126] exclude: ({{cookiecutter.project_slug}}) -- repo: https://github.com/econchick/interrogate - rev: 1.5.0 - hooks: - - id: interrogate - args: [ - -v, - --fail-under=40, - --config, - pyproject.toml, - "{{cookiecutter.project_slug}}", - --exclude, - "{{cookiecutter.project_slug}}/tests/test_import.py" - ] - pass_filenames: false - repo: https://github.com/executablebooks/mdformat - rev: 0.7.16 + rev: 0.7.17 hooks: - id: mdformat additional_dependencies: [ @@ -91,7 +71,7 @@ repos: {{cookiecutter.project_slug}}/README.md )$ - repo: https://github.com/executablebooks/mdformat - rev: 0.7.16 + rev: 0.7.17 hooks: - id: mdformat additional_dependencies: [ @@ -106,18 +86,14 @@ repos: # path/to/file.py # )$ - repo: https://github.com/codespell-project/codespell - rev: v2.2.2 + rev: v2.2.6 hooks: - id: codespell additional_dependencies: [tomli] - repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v0.991' + rev: 'v1.7.0' hooks: - id: mypy - args: [ - --no-strict-optional, - --ignore-missing-imports, - ] pass_filenames: false - repo: meta hooks: diff --git a/.readthedocs.yaml b/.readthedocs.yaml index c0065fa..1478786 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -1,10 +1,17 @@ version: 2 build: - image: latest + os: ubuntu-22.04 + tools: + python: "3.10" -python: - version: 3.8 +sphinx: + configuration: docs/source/conf.py + fail_on_warning: true -conda: - environment: docs/docs_environment.yml +python: + install: + - method: pip + path: . + extra_requirements: + - docs diff --git a/docs/docs_environment.yml b/docs/docs_environment.yml deleted file mode 100644 index 06269f1..0000000 --- a/docs/docs_environment.yml +++ /dev/null @@ -1,23 +0,0 @@ -channels: - - conda-forge - - nodefaults - -dependencies: - - python >= 3.8 - - pip >=21.1 - - setuptools_scm - - toml - - # Documentation - - furo - - ipython - - nbsphinx - - myst-parser - - sphinx - - sphinx-autoapi - - sphinx-copybutton - - sphinx-panels - - - pip: - - ../ - - sphinxext-opengraph diff --git a/docs/source/api.md b/docs/source/api.md deleted file mode 100644 index c63fd9c..0000000 --- a/docs/source/api.md +++ /dev/null @@ -1,12 +0,0 @@ -# API Reference - -The following documents are auto-generated and not carefully edited. They provide direct -access to the source code and the docstrings. - -```{toctree} ---- -titlesonly: true ---- -/autoapi/pre_gen_project/index -/autoapi/post_gen_project/index -``` diff --git a/docs/source/changes.md b/docs/source/changes.md index 2ce32cc..ccc10d9 100644 --- a/docs/source/changes.md +++ b/docs/source/changes.md @@ -3,6 +3,10 @@ This is a record of all past cookiecutter-pytask-project releases and what went into them in reverse chronological order. +## 1.6.0 - 2023-11-23 + +- {pull}`35` modernizes the template. + ## 1.5.0 - 2023-02-04 - {pull}`33` fixes some small things. (Thanks to @hmgaudecker!) diff --git a/docs/source/conf.py b/docs/source/conf.py index 53bf489..d57a7a9 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -35,9 +35,8 @@ "sphinxext.opengraph", "sphinx.ext.viewcode", "sphinx_copybutton", - "sphinx_panels", - "autoapi.extension", "myst_parser", + "sphinx_design", ] # Add any paths that contain templates here, relative to this directory. @@ -48,12 +47,6 @@ # html_extra_path. exclude_patterns = ["build", "Thumbs.db", ".DS_Store", "**.ipynb_checkpoints"] -# Configuration for autoapi to generate and API page. -autoapi_type = "python" -autoapi_dirs = ["../../hooks"] -autoapi_keep_files = False -autoapi_add_toctree_entry = False - # Remove prefixed $ for bash, >>> for Python prompts, and In [1]: for IPython prompts. copybutton_prompt_text = r"\$ |>>> |In \[\d\]: " copybutton_prompt_is_regexp = True @@ -61,10 +54,10 @@ # Use these roles to create links to github users and pull requests. _repo = "https://github.com/pytask-dev/cookiecutter-pytask-project" extlinks = { - "pypi": ("https://pypi.org/project/%s/", ""), - "issue": (f"{_repo}/issues/%s", "issue #"), - "pull": (f"{_repo}/pull/%s", "pull request #"), - "user": ("https://github.com/%s", "@"), + "pypi": ("https://pypi.org/project/%s/", "%s"), + "issue": (f"{_repo}/issues/%s", "issue #%s"), + "pull": (f"{_repo}/pull/%s", "pull request #%s"), + "user": ("https://github.com/%s", "@%s"), } # Link objects to other documentations. @@ -85,8 +78,3 @@ pygments_style = "sphinx" pygments_dark_style = "monokai" - -# Add any paths that contain custom static files (such as style sheets) here, relative -# to this directory. They are copied after the builtin static files, so a file named -# "default.css" will overwrite the builtin "default.css". -html_static_path = ["_static"] diff --git a/docs/source/index.md b/docs/source/index.md index ffb6e99..0093590 100644 --- a/docs/source/index.md +++ b/docs/source/index.md @@ -47,5 +47,4 @@ maxdepth: 1 --- faq changes -api ``` diff --git a/environment.yml b/environment.yml index eee9c8a..6090cbf 100644 --- a/environment.yml +++ b/environment.yml @@ -30,7 +30,6 @@ dependencies: - myst-parser - nbsphinx - sphinx - - sphinx-autoapi - sphinx-copybutton - sphinx-panels diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index efe9511..ba7511a 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -1,4 +1,4 @@ -"""This module contains hooks which are executed after the template is rendered.""" +"""Contains hooks which are executed after the template is rendered.""" from __future__ import annotations import shutil @@ -39,7 +39,9 @@ def main() -> None: remove_file(project_path, ".readthedocs.yaml") subprocess.run( - ("git", "init", "--initial-branch", "main"), check=True, capture_output=True + ("git", "init", "--initial-branch", "main"), + check=True, + capture_output=True, ) if "{{ cookiecutter.make_initial_commit }}" == "yes": @@ -78,10 +80,35 @@ def main() -> None: check=True, capture_output=True, ) + # Install pre-commit hooks and run them. + subprocess.run( # noqa: PLW1510 + ( + conda_exe, + "run", + "-n", + "{{ cookiecutter.conda_environment_name }}", + "pre-commit", + "install", + ), + capture_output=True, + ) + subprocess.run( # noqa: PLW1510 + ( + conda_exe, + "run", + "-n", + "{{ cookiecutter.conda_environment_name }}", + "pre-commit", + "run", + "--all-files", + ), + capture_output=True, + ) else: warnings.warn( "conda environment could not be created since no conda or mamba " - "executable was found." + "executable was found.", + stacklevel=1, ) diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py index 66e93ac..803aa36 100644 --- a/hooks/pre_gen_project.py +++ b/hooks/pre_gen_project.py @@ -1,4 +1,4 @@ -"""This module contains hooks which are executed before the template is rendered.""" +"""Contains hooks which are executed before the template is rendered.""" import re MODULE_REGEX = r"^[_a-zA-Z][_a-zA-Z0-9]*$" @@ -36,7 +36,7 @@ def main() -> None: if not re.match(ENVIRON_REGEX, environment_name): raise ValueError( - EXCEPTION_MSG_ENVIRON_NAME.format(environment_name=environment_name) + EXCEPTION_MSG_ENVIRON_NAME.format(environment_name=environment_name), ) python_version = "{{ cookiecutter.python_version }}" @@ -44,7 +44,8 @@ def main() -> None: if not re.match(PYTHONVERSION_REGEX, python_version): raise ValueError( EXCEPTION_MSG_PYTHONVERSION.format( - min_python_version=PYTHONVERSION_MIN, python_version=python_version + min_python_version=PYTHONVERSION_MIN, + python_version=python_version, ), ) diff --git a/pyproject.toml b/pyproject.toml index 0d65a3a..9e94d80 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,6 +7,53 @@ build-backend = "setuptools.build_meta" write_to = "version.py" +[project] +name = "cookiecutter_pytask_project" +description = "A minimal cookiecutter template for a project with pytask." +classifiers = [ "Development Status :: 3 - Alpha", "Environment :: Console", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", "Topic :: Scientific/Engineering", "Topic :: Software Development :: Build Tools",] +requires-python = ">=3.8" +dynamic = ["version"] +dependencies = ["cookiecutter"] + +[[project.authors]] +name = "Tobias Raabe" +email = "raabe@posteo.de" + +[project.optional-dependencies] +docs = [ + "furo", + "ipython", + "myst-parser", + "nbsphinx", + "sphinx", + "sphinx-click", + "sphinx-copybutton", + "sphinx-design>=0.3", + "sphinx-toolbox", + "sphinxext-opengraph", +] +test = ["pytest", "pytest-cookies", "pytest-cov"] + +[project.readme] +file = "README.md" +content-type = "text/markdown" + +[project.license] +text = "MIT" + +[project.urls] +Homepage = "https://cookiecutter-pytask-project.readthedocs.io/en/latest" +Changelog = "https://cookiecutter-pytask-project.readthedocs.io/en/latest/changes.html" +Documentation = "https://cookiecutter-pytask-project.readthedocs.io/en/latest" +Github = "https://github.com/pytask-dev/cookiecutter-pytask-project" +Tracker = "https://github.com/pytask-dev/cookiecutter-pytask-project/issues" + +[tool.setuptools] +platforms = [ "unix", "linux", "osx", "cygwin", "win32",] +license-files = [ "LICENSE"] +include-package-data = false + + [tool.mypy] files = ["hooks", "tests"] exclude = "{{cookiecutter.project_slug}}" @@ -26,7 +73,7 @@ ignore_errors = true [tool.ruff] -target-version = "py37" +target-version = "py38" select = ["ALL"] fix = true extend-ignore = [ @@ -41,26 +88,34 @@ extend-ignore = [ "D416", "D417", # Others. - "D404", # Do not start module docstring with "This". - "RET504", # unnecessary variable assignment before return. - "S101", # raise errors for asserts. - "B905", # strict parameter for zip that was implemented in py310. "I", # ignore isort - "ANN101", # type annotating self - "ANN102", # type annotating cls - "FBT", # flake8-boolean-trap - "EM", # flake8-errmsg - "ANN401", # flake8-annotate typing.Any - "PD", # pandas-vet - "COM812", # trailing comma missing, but black takes care of that + "COM812", # Comply with ruff-format. + "ISC001", # Comply with ruff-format. ] [tool.ruff.per-file-ignores] -"tests/*" = ["D", "ANN"] -"hooks/post_gen_project.py" = ["PLR0133"] "hooks/*" = ["INP001"] +"tests/*" = ["D", "ANN", "S101", "S603"] +"hooks/post_gen_project.py" = ["PLR0133", "S603"] [tool.ruff.pydocstyle] convention = "numpy" + + +[tool.pytest.ini_options] +addopts = ["--doctest-modules"] +testpaths = ["tests"] +filterwarnings = [ + "ignore: the imp module is deprecated in favour of importlib", + "ignore: Using or importing the ABCs from 'collections' instead of from", + "ignore: The (parser|symbol) module is deprecated and will be removed in future", +] +markers = [ + "wip: Tests that are work-in-progress.", + "unit: Flag for unit tests which target mainly a single function.", + "integration: Flag for integration tests which may comprise of multiple unit tests.", + "end_to_end: Flag for tests that cover the whole program.", +] +norecursedirs = [".idea", ".tox"] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index de71e78..0000000 --- a/setup.cfg +++ /dev/null @@ -1,35 +0,0 @@ -[metadata] -name = cookiecutter_pytask_project -description = A minimal cookiecutter template for a project with pytask. -long_description = file: README.md -long_description_content_type = text/markdown -url = https://cookiecutter-pytask-project.readthedocs.io/en/latest -author = Tobias Raabe -author_email = raabe@posteo.de -license = MIT -license_file = LICENSE -platforms = unix, linux, osx, cygwin, win32 -classifiers = - Development Status :: 3 - Alpha - Environment :: Console - Intended Audience :: Science/Research - License :: OSI Approved :: MIT License - Operating System :: MacOS :: MacOS X - Operating System :: Microsoft :: Windows - Operating System :: POSIX - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - Topic :: Scientific/Engineering - Topic :: Software Development :: Build Tools -project_urls = - Changelog = https://cookiecutter-pytask-project.readthedocs.io/en/latest/changes.html - Documentation = https://cookiecutter-pytask-project.readthedocs.io/en/latest - Github = https://github.com/pytask-dev/cookiecutter-pytask-project - Tracker = https://github.com/pytask-dev/cookiecutter-pytask-project/issues - -[options] -python_requires = >=3.8 - -[check-manifest] -ignore = - version.py diff --git a/tox.ini b/tox.ini index 470470c..dd200b0 100644 --- a/tox.ini +++ b/tox.ini @@ -1,50 +1,20 @@ [tox] -envlist = pytest, sphinx +envlist = test, docs [testenv] usedevelop = true passenv = CI -[testenv:pytest] -conda_channels = - conda-forge - nodefaults -conda_deps = - # pytest - pytest - ; pytest-cookies>=0.6.2 - pytest-cov - pytest-xdist - - # Package dependencies - cookiecutter - -deps = - git+https://github.com/andriihomiak/pytest-cookies.git@fix/quotes_in_user_config +[testenv:test] +allowlist_externals = pytest +extras = test commands = pytest {posargs} -[testenv:sphinx] +[testenv:docs] +extras = docs changedir = docs/source -conda_env = docs/docs_environment.yml commands = sphinx-build -T -b html -d {envtmpdir}/doctrees . {envtmpdir}/html - sphinx-build -T -b linkcheck -d {envtmpdir}/doctrees . {envtmpdir}/linkcheck - -[pytest] -addopts = --doctest-modules -testpaths = - tests -filterwarnings = - ignore: the imp module is deprecated in favour of importlib - ignore: Using or importing the ABCs from 'collections' instead of from - ignore: The (parser|symbol) module is deprecated and will be removed in future -markers = - wip: Tests that are work-in-progress. - unit: Flag for unit tests which target mainly a single function. - integration: Flag for integration tests which may comprise of multiple unit tests. - end_to_end: Flag for tests that cover the whole program. -norecursedirs = - .idea - .tox diff --git a/{{cookiecutter.project_slug}}/.github/workflows/main.yml b/{{cookiecutter.project_slug}}/.github/workflows/main.yml index d38e20e..45adfcc 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/main.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/main.yml @@ -27,7 +27,7 @@ jobs: fail-fast: false matrix: os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] steps: - uses: actions/checkout@v3 @@ -49,7 +49,7 @@ jobs: run: tox -e pytest -- src tests -m "unit or (not integration and not end_to_end)" --cov=./ --cov-report=xml -n auto - name: Upload coverage report for unit tests and doctests. - if: runner.os == 'Linux' && matrix.python-version == '3.9' + if: runner.os == 'Linux' && matrix.python-version == '3.10' shell: bash -l {0} run: bash <(curl -s https://codecov.io/bash) -F unit -c @@ -58,7 +58,7 @@ jobs: run: tox -e pytest -- src tests -m integration --cov=./ --cov-report=xml -n auto - name: Upload coverage reports of integration tests. - if: runner.os == 'Linux' && matrix.python-version == '3.9' + if: runner.os == 'Linux' && matrix.python-version == '3.10' shell: bash -l {0} run: bash <(curl -s https://codecov.io/bash) -F integration -c @@ -67,6 +67,6 @@ jobs: run: tox -e pytest -- src tests -m end_to_end --cov=./ --cov-report=xml -n auto - name: Upload coverage reports of end-to-end tests. - if: runner.os == 'Linux' && matrix.python-version == '3.9' + if: runner.os == 'Linux' && matrix.python-version == '3.10' shell: bash -l {0} run: bash <(curl -s https://codecov.io/bash) -F end_to_end -c diff --git a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml index 4d341aa..073e902 100644 --- a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml +++ b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: check-added-large-files args: ['--maxkb=25'] @@ -16,7 +16,7 @@ repos: args: [--branch, main] - id: trailing-whitespace - repo: https://github.com/pre-commit/pygrep-hooks - rev: v1.9.0 + rev: v1.10.0 hooks: - id: python-check-blanket-noqa - id: python-check-mock-methods @@ -24,46 +24,31 @@ repos: - id: python-no-log-warn - id: python-use-type-annotations - id: text-unicode-replacement-char -- repo: https://github.com/asottile/pyupgrade - rev: v3.3.1 - hooks: - - id: pyupgrade - args: [--py37-plus] - repo: https://github.com/asottile/reorder_python_imports rev: v3.9.0 hooks: - id: reorder-python-imports{% if cookiecutter.add_mypy == "yes" %} - args: [--py37-plus, --add-import, 'from __future__ import annotations']{% endif %} + args: [--py38-plus, --add-import, 'from __future__ import annotations']{% endif %} - repo: https://github.com/asottile/setup-cfg-fmt rev: v2.2.0 hooks: - id: setup-cfg-fmt -- repo: https://github.com/psf/black - rev: 23.1.0 - hooks: - - id: black -- repo: https://github.com/PyCQA/docformatter - rev: v1.5.1 +- repo: https://github.com/aio-libs/sort-all + rev: v1.2.0 hooks: - - id: docformatter - args: [--in-place, --wrap-summaries, "88", --wrap-descriptions, "88", --blank] -{% if cookiecutter.python_version in ["3.10", "3.11", "3.12"] %}- repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.241 + - id: sort-all +- repo: https://github.com/charliermarsh/ruff-pre-commit + rev: v0.1.6 hooks: - id: ruff -- repo: https://github.com/dosisod/refurb - rev: v1.10.0 + - id: ruff-format +{% if cookiecutter.python_version in ["3.10", "3.11", "3.12"] %}- repo: https://github.com/dosisod/refurb + rev: v1.24.0 hooks: - id: refurb - args: [--ignore, FURB126] {% endif %} -- repo: https://github.com/econchick/interrogate - rev: 1.5.0 - hooks: - - id: interrogate - args: [-v, --fail-under=40] - repo: https://github.com/executablebooks/mdformat - rev: 0.7.16 + rev: 0.7.17 hooks: - id: mdformat additional_dependencies: [ @@ -73,7 +58,7 @@ repos: args: [--wrap, "88"] files: (README\.md) - repo: https://github.com/executablebooks/mdformat - rev: 0.7.16 + rev: 0.7.17 hooks: - id: mdformat additional_dependencies: [ @@ -88,7 +73,7 @@ repos: # path/to/file.py # )$ {% if cookiecutter.add_mypy == "yes" %}- repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v0.991' + rev: 'v1.7.0' hooks: - id: mypy args: [ @@ -97,7 +82,7 @@ repos: ] pass_filenames: false {% endif %}- repo: https://github.com/codespell-project/codespell - rev: v2.2.2 + rev: v2.2.6 hooks: - id: codespell - repo: meta diff --git a/{{cookiecutter.project_slug}}/.readthedocs.yaml b/{{cookiecutter.project_slug}}/.readthedocs.yaml index c0065fa..b508b44 100644 --- a/{{cookiecutter.project_slug}}/.readthedocs.yaml +++ b/{{cookiecutter.project_slug}}/.readthedocs.yaml @@ -4,7 +4,7 @@ build: image: latest python: - version: 3.8 + version: 3.10 conda: environment: docs/docs_environment.yml diff --git a/{{cookiecutter.project_slug}}/docs/docs_environment.yml b/{{cookiecutter.project_slug}}/docs/docs_environment.yml index d1b83ca..690a754 100644 --- a/{{cookiecutter.project_slug}}/docs/docs_environment.yml +++ b/{{cookiecutter.project_slug}}/docs/docs_environment.yml @@ -3,7 +3,7 @@ channels: - nodefaults dependencies: - - python >= 3.8 + - python >= 3.10 - pip - setuptools_scm - toml @@ -14,9 +14,8 @@ dependencies: - nbsphinx - myst-parser - sphinx - - sphinx-autoapi + - sphinx-design - sphinx-copybutton - - sphinx-panels - pip: - ../ diff --git a/{{cookiecutter.project_slug}}/docs/source/api.md b/{{cookiecutter.project_slug}}/docs/source/api.md deleted file mode 100644 index 929543a..0000000 --- a/{{cookiecutter.project_slug}}/docs/source/api.md +++ /dev/null @@ -1,11 +0,0 @@ -# API Reference - -The following documents are auto-generated and not carefully edited. They provide direct -access to the source code and the docstrings. - -```{toctree} ---- -titlesonly: true ---- -/autoapi/{{ cookiecutter.project_slug }}/index -``` diff --git a/{{cookiecutter.project_slug}}/docs/source/conf.py b/{{cookiecutter.project_slug}}/docs/source/conf.py index 2dddfa3..6f3c8dc 100644 --- a/{{cookiecutter.project_slug}}/docs/source/conf.py +++ b/{{cookiecutter.project_slug}}/docs/source/conf.py @@ -12,7 +12,8 @@ project = "{{ cookiecutter.project_name }}" project_slug = "{{ cookiecutter.project_slug }}" author = "{{ cookiecutter.author }}" -copyright = f"2022, {author}" # noqa: A001 +year = "{% now 'utc', '%Y' %}" +copyright = f"{year}, {author}" # noqa: A001 # The version, including alpha/beta/rc tags, but not commit hash and datestamps release = version(project_slug) @@ -36,7 +37,6 @@ "sphinx.ext.viewcode", "sphinx_copybutton", "sphinx_panels", - "autoapi.extension", "myst_parser", ] @@ -48,12 +48,6 @@ # html_extra_path. exclude_patterns = ["build", "Thumbs.db", ".DS_Store", "**.ipynb_checkpoints"] -# Configuration for autoapi to generate and API page. -autoapi_type = "python" -autoapi_dirs = ["../../src"] -autoapi_keep_files = False -autoapi_add_toctree_entry = False - # Remove prefixed $ for bash, >>> for Python prompts, and In [1]: for IPython prompts. copybutton_prompt_text = r"\$ |>>> |In \[\d\]: " copybutton_prompt_is_regexp = True @@ -61,10 +55,10 @@ # Use these roles to create links to github users and pull requests. _repo = "https://github.com/{{ cookiecutter.github_username }}/" + project_slug extlinks = { - "pypi": ("https://pypi.org/project/%s/", ""), - "issue": (f"{_repo}/issues/%s", "issue #"), - "pull": (f"{_repo}/pull/%s", "pull request #"), - "user": ("https://github.com/%s", "@"), + "pypi": ("https://pypi.org/project/%s/", "%s"), + "issue": (f"{_repo}/issues/%s", "issue #%s"), + "pull": (f"{_repo}/pull/%s", "pull request #%s"), + "user": ("https://github.com/%s", "@%s"), } # Link objects to other documentations. @@ -85,8 +79,3 @@ pygments_style = "sphinx" pygments_dark_style = "monokai" - -# Add any paths that contain custom static files (such as style sheets) here, relative -# to this directory. They are copied after the builtin static files, so a file named -# "default.css" will overwrite the builtin "default.css". -html_static_path = ["_static"] diff --git a/{{cookiecutter.project_slug}}/docs/source/index.md b/{{cookiecutter.project_slug}}/docs/source/index.md index de2601b..0880e27 100644 --- a/{{cookiecutter.project_slug}}/docs/source/index.md +++ b/{{cookiecutter.project_slug}}/docs/source/index.md @@ -6,5 +6,4 @@ caption: 'Contents:' maxdepth: 1 --- changes -api ``` diff --git a/{{cookiecutter.project_slug}}/environment.yml b/{{cookiecutter.project_slug}}/environment.yml index 8bd4daa..ff1f71c 100644 --- a/{{cookiecutter.project_slug}}/environment.yml +++ b/{{cookiecutter.project_slug}}/environment.yml @@ -30,7 +30,6 @@ dependencies: - myst-parser - nbsphinx - sphinx - - sphinx-autoapi - sphinx-copybutton - sphinx-panels diff --git a/{{cookiecutter.project_slug}}/pyproject.toml b/{{cookiecutter.project_slug}}/pyproject.toml index 05f08af..6894f22 100644 --- a/{{cookiecutter.project_slug}}/pyproject.toml +++ b/{{cookiecutter.project_slug}}/pyproject.toml @@ -44,25 +44,33 @@ extend-ignore = [ "D416", "D417", # Others. - "D404", # Do not start module docstring with "This". - "RET504", # unnecessary variable assignment before return. - "S101", # raise errors for asserts. - "B905", # strict parameter for zip that was implemented in py310. "I", # ignore isort - "ANN101", # type annotating self - "ANN102", # type annotating cls - "FBT", # flake8-boolean-trap - "EM", # flake8-errmsg - "ANN401", # flake8-annotate typing.Any - "PD", # pandas-vet - "COM812", # trailing comma missing, but black takes care of that + "COM812", # Comply with ruff-format. + "ISC001", # Comply with ruff-format. ] [tool.ruff.per-file-ignores] -"tests/*" = ["D", "ANN"] +"tests/*" = ["D", "ANN", "S101"] "docs/source/conf.py" = ["INP001"] [tool.ruff.pydocstyle] convention = "numpy" + + +[tool.pytest.ini_options] +addopts = ["--doctest-modules"] +testpaths = ["tests"] +filterwarnings = [ + "ignore: the imp module is deprecated in favour of importlib", + "ignore: Using or importing the ABCs from 'collections' instead of from", + "ignore: The (parser|symbol) module is deprecated and will be removed in future", +] +markers = [ + "wip: Tests that are work-in-progress.", + "unit: Flag for unit tests which target mainly a single function.", + "integration: Flag for integration tests which may comprise of multiple unit tests.", + "end_to_end: Flag for tests that cover the whole program.", +] +norecursedirs = [".idea", ".tox"] diff --git a/{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/__init__.py b/{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/__init__.py index 075592e..6e5ee2d 100644 --- a/{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/__init__.py +++ b/{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/__init__.py @@ -1,4 +1,4 @@ -"""This module contains the main namespace of {{ cookiecutter.project_slug }}.""" +"""Contains the main namespace of {{ cookiecutter.project_slug }}.""" # Import the version from _version.py which is dynamically created by setuptools-scm # when the project is installed with ``pip install -e .``. Do not put it into version # control! diff --git a/{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/config.py b/{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/config.py index cb77e44..20862ce 100644 --- a/{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/config.py +++ b/{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/config.py @@ -1,4 +1,4 @@ -"""This module contains the general configuration of the project.""" +"""Contains the general configuration of the project.""" from pathlib import Path diff --git a/{{cookiecutter.project_slug}}/tests/__init__.py b/{{cookiecutter.project_slug}}/tests/__init__.py index 4045499..c3dc044 100644 --- a/{{cookiecutter.project_slug}}/tests/__init__.py +++ b/{{cookiecutter.project_slug}}/tests/__init__.py @@ -1 +1 @@ -"""This module is necessary to configure mypy's behavior for the tests.""" +"""Is module is necessary to configure mypy's behavior for the tests.""" diff --git a/{{cookiecutter.project_slug}}/tox.ini b/{{cookiecutter.project_slug}}/tox.ini index a39f6d0..1f2169e 100644 --- a/{{cookiecutter.project_slug}}/tox.ini +++ b/{{cookiecutter.project_slug}}/tox.ini @@ -11,7 +11,6 @@ conda_channels = conda_deps = # pytest pytest - pytest-cookies pytest-cov pytest-xdist @@ -20,18 +19,3 @@ conda_deps = commands = pytest {posargs} - -[pytest] -addopts = --doctest-modules -filterwarnings = - ignore: the imp module is deprecated in favour of importlib - ignore: Using or importing the ABCs from 'collections' instead of from - ignore: The (parser|symbol) module is deprecated and will be removed in future -markers = - wip: Tests that are work-in-progress. - unit: Flag for unit tests which target mainly a single function. - integration: Flag for integration tests which may comprise of multiple unit tests. - end_to_end: Flag for tests that cover the whole program. -norecursedirs = - .idea - .tox