Skip to content

Commit

Permalink
Merge branch 'pre_commit_additions' of github.com:CyclingNinja/packag…
Browse files Browse the repository at this point in the history
…e-template into pre_commit_additions
  • Loading branch information
CyclingNinja committed Mar 4, 2024
2 parents 9a506ab + b9b1275 commit 2c16485
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 34 deletions.
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ repos:
exclude: "{{ cookiecutter.package_name }}"
- id: debug-statements
exclude: "{{ cookiecutter.package_name }}"
ci:
autofix_prs: false
3 changes: 3 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

# Treat everything in single ` as a Python reference.
default_role = 'py:obj'

# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
Expand Down
3 changes: 3 additions & 0 deletions {{ cookiecutter.package_name }}/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ jobs:
submodules: false
pytest: false
toxdeps: tox-pypi-filter
libraries: |
apt:
- graphviz
envs: |
- linux: build_docs
Expand Down
4 changes: 2 additions & 2 deletions {{ cookiecutter.package_name }}/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repos:
# This should be before any formatting hooks like isort
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.2.1"
rev: "v0.2.2"
hooks:
- id: ruff
args: ["--fix"]
Expand Down Expand Up @@ -34,4 +34,4 @@ repos:
args: [ "--write-changes" ]
ci:
autofix_prs: false
autoupdate_schedule: quarterly
autoupdate_schedule: "quarterly"
12 changes: 4 additions & 8 deletions {{ cookiecutter.package_name }}/.ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,16 @@ extend-ignore = [
"PT023", # Always use () on pytest decorators
]

[lint.flake8-tidy-imports]
[lint.flake8-tidy-imports.banned-api]
"warnings.warn".msg = "Use sunpy specific warning helpers warn_* from sunpy.utils.exceptions"

[lint.per-file-ignores]
# Part of configuration, not a package.
"setup.py" = ["INP001"]
"conftest.py" = ["INP001"]
# Implicit-namespace-package. The examples are not a package.
"docs/*.py" = ["INP001"]
"docs/*.py" = [
"INP001", # Implicit-namespace-package. The examples are not a package.
"E402", # Module imports not at top of file
]
"__init__.py" = ["E402", "F401", "F403"]
"test_*.py" = ["B011", "D", "E402", "PGH001", "S101"]
# Need to import clients to register them, but don't use them in file
"{{ cookiecutter.package_name }}/net/__init__.py" = ["F811"]

[lint.pydocstyle]
convention = "numpy"
3 changes: 2 additions & 1 deletion {{ cookiecutter.package_name }}/docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{ '*' * (cookiecutter.package_name + " Documentation")|length }}
{{ cookiecutter.package_name }} Documentation
{{ '-' * (cookiecutter.package_name + " Documentation")|length }}
{{ '*' * (cookiecutter.package_name + " Documentation")|length }}

This is the documentation for {{ cookiecutter.package_name }}.

Expand Down
42 changes: 21 additions & 21 deletions {{ cookiecutter.package_name }}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ build-backend = "setuptools.build_meta"
[project]
name = "{{ cookiecutter.module_name }}"
description = "{{ cookiecutter.short_description }}"
readme = "README.rst"
requires-python = ">={{ cookiecutter.minimum_python_version }}"
readme = { file = "README.rst", content-type = "text/x-rst" }
license = { file = "licenses/LICENSE.rst", content-type = "text/plain" }
{%- if cookiecutter.author_name and cookiecutter.author_email %}
authors = [
Expand All @@ -34,14 +34,14 @@ open_astronomy_package_template_example = "{{ cookiecutter.module_name }}.exampl
{% endif -%}
[project.optional-dependencies]
tests = [
"pytest",
"pytest-doctestplus",
"pytest-cov"
"pytest",
"pytest-doctestplus",
"pytest-cov"
]
docs = [
"sphinx",
"sphinx-automodapi",
"tomli; python_version <\"3.11\"",
"sphinx",
"sphinx-automodapi",
"tomli; python_version <\"3.11\"",
]

{% if cookiecutter.project_url -%}
Expand Down Expand Up @@ -73,20 +73,20 @@ addopts = "--doctest-rst"

[tool.coverage.run]
omit = [
"{{ cookiecutter.module_name }}/_{{ cookiecutter._parent_project }}_init*",
"{{ cookiecutter.module_name }}/conftest.py",
"{{ cookiecutter.module_name }}/*setup_package*",
"{{ cookiecutter.module_name }}/tests/*",
"{{ cookiecutter.module_name }}/*/tests/*",
"{{ cookiecutter.module_name }}/extern/*",
"{{ cookiecutter.module_name }}/version*",
"*/{{ cookiecutter.module_name }}/_{{ cookiecutter._parent_project }}_init*",
"*/{{ cookiecutter.module_name }}/conftest.py",
"*/{{ cookiecutter.module_name }}/*setup_package*",
"*/{{ cookiecutter.module_name }}/tests/*",
"*/{{ cookiecutter.module_name }}/*/tests/*",
"*/{{ cookiecutter.module_name }}/extern/*",
"*/{{ cookiecutter.module_name }}/version*",
"{{ cookiecutter.module_name }}/_{{ cookiecutter._parent_project }}_init*",
"{{ cookiecutter.module_name }}/conftest.py",
"{{ cookiecutter.module_name }}/*setup_package*",
"{{ cookiecutter.module_name }}/tests/*",
"{{ cookiecutter.module_name }}/*/tests/*",
"{{ cookiecutter.module_name }}/extern/*",
"{{ cookiecutter.module_name }}/version*",
"*/{{ cookiecutter.module_name }}/_{{ cookiecutter._parent_project }}_init*",
"*/{{ cookiecutter.module_name }}/conftest.py",
"*/{{ cookiecutter.module_name }}/*setup_package*",
"*/{{ cookiecutter.module_name }}/tests/*",
"*/{{ cookiecutter.module_name }}/*/tests/*",
"*/{{ cookiecutter.module_name }}/extern/*",
"*/{{ cookiecutter.module_name }}/version*",
]

[tool.coverage.report]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{%- if cookiecutter.include_example_code == 'y' -%}
from .example_mod import do_primes
{%- endif %}
from .version import version as __version__

{% if cookiecutter.include_example_code == 'y' -%}
# Then you can be explicit to control what ends up in the namespace,
__all__ = ['do_primes']
{% else %}
{% else -%}
__all__ = []
{%- endif -%}
{% endif -%}

0 comments on commit 2c16485

Please sign in to comment.