Skip to content

Commit d1fd493

Browse files
authored
Cleanup inner project (#28)
1 parent 8a7338b commit d1fd493

17 files changed

+59
-63
lines changed

.github/workflows/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
fail-fast: false
2828
matrix:
2929
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
30-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
30+
python-version: ['3.8', '3.9', '3.10', '3.11']
3131

3232
steps:
3333
- uses: actions/checkout@v2

.pre-commit-config.yaml

+5-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ repos:
4444
hooks:
4545
- id: reorder-python-imports
4646
- repo: https://github.com/asottile/setup-cfg-fmt
47-
rev: v1.20.0
47+
rev: v2.2.0
4848
hooks:
4949
- id: setup-cfg-fmt
5050
exclude: |
@@ -118,6 +118,10 @@ repos:
118118
]
119119
args: [--wrap, "88"]
120120
files: (README\.md)
121+
exclude: |
122+
(?x)^(
123+
{{cookiecutter.project_slug}}/README.md
124+
)$
121125
- repo: https://github.com/executablebooks/mdformat
122126
rev: 0.7.16
123127
hooks:

docs/docs_environment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ channels:
33
- nodefaults
44

55
dependencies:
6-
- python >= 3.7
6+
- python >= 3.8
77
- pip >=21.1
88
- setuptools_scm
99
- toml

docs/source/changes.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@
33
This is a record of all past cookiecutter-pytask-project releases and what went into
44
them in reverse chronological order.
55

6-
## 1.2.2 - 2022-05-31
6+
## 1.3.0 - 2022-11-20
77

88
- {pull}`22` removes sphinx-click and renames docs environment to
99
`docs_environment.yml`.
10+
- {pull}`25` adds docsformatter.
11+
- {pull}`26` uses a better approach to set the initial branch.
12+
- {pull}`27` adds support for Python 3.11.
13+
- {pull}`28` does some cleaning and deprecates support for Python 3.7. Thanks
14+
{user}`timmens`!
1015

1116
## 1.2.1 - 2022-05-13
1217

environment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ channels:
55
- nodefaults
66

77
dependencies:
8-
- python >=3.7
8+
- python >=3.8
99
- pip >=21.1
1010
- setuptools_scm
1111
- toml

hooks/pre_gen_project.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
MODULE_REGEX = r"^[_a-zA-Z][_a-zA-Z0-9]*$"
55
ENVIRON_REGEX = r"^[-_a-zA-Z0-9]*$"
66
PYTHONVERSION_REGEX = r"^(3\.(1[0-9]|[7-9])(\.[0-9]{1,2})?)$"
7-
PYTHONVERSION_MIN = "3.7"
7+
PYTHONVERSION_MIN = "3.8"
88

99
EXCEPTION_MSG_MODULE_NAME = """
1010
ERROR: The project slug ({module_name}) is not a valid Python module name.

setup.cfg

+1-5
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ classifiers =
1919
Operating System :: POSIX
2020
Programming Language :: Python :: 3
2121
Programming Language :: Python :: 3 :: Only
22-
Programming Language :: Python :: 3.7
23-
Programming Language :: Python :: 3.8
24-
Programming Language :: Python :: 3.9
25-
Programming Language :: Python :: 3.10
2622
Topic :: Scientific/Engineering
2723
Topic :: Software Development :: Build Tools
2824
project_urls =
@@ -32,7 +28,7 @@ project_urls =
3228
Tracker = https://github.com/pytask-dev/cookiecutter-pytask-project/issues
3329

3430
[options]
35-
python_requires = >=3.7
31+
python_requires = >=3.8
3632

3733
[check-manifest]
3834
ignore =

tests/test_cookie.py

+23-8
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
import pytest
66

77

8+
_PYTHON_VERSION = ".".join(map(str, sys.version_info[:2]))
9+
10+
811
@pytest.mark.end_to_end
912
def test_bake_project(cookies):
10-
major, minor = sys.version_info[:2]
11-
python_version = f"{major}.{minor}"
12-
1313
result = cookies.bake(
14-
extra_context={"project_slug": "helloworld", "python_version": python_version}
14+
extra_context={"project_slug": "helloworld", "python_version": _PYTHON_VERSION}
1515
)
1616

1717
assert result.exit_code == 0
@@ -22,7 +22,12 @@ def test_bake_project(cookies):
2222

2323
@pytest.mark.end_to_end
2424
def test_remove_readthedocs(cookies):
25-
result = cookies.bake(extra_context={"add_readthedocs": "no"})
25+
result = cookies.bake(
26+
extra_context={
27+
"add_readthedocs": "no",
28+
"python_version": ".".join(map(str, sys.version_info[:2])),
29+
}
30+
)
2631

2732
rtd_config = result.project_path.joinpath(".readthedocs.yaml")
2833
readme = result.project_path.joinpath("README.md").read_text()
@@ -36,7 +41,9 @@ def test_remove_readthedocs(cookies):
3641

3742
@pytest.mark.end_to_end
3843
def test_remove_github_actions(cookies):
39-
result = cookies.bake(extra_context={"add_github_actions": "no"})
44+
result = cookies.bake(
45+
extra_context={"add_github_actions": "no", "python_version": _PYTHON_VERSION}
46+
)
4047

4148
ga_config = result.project_path.joinpath(".github", "workflows", "main.yml")
4249
readme = result.project_path.joinpath("README.md").read_text()
@@ -50,7 +57,9 @@ def test_remove_github_actions(cookies):
5057

5158
@pytest.mark.end_to_end
5259
def test_remove_tox(cookies):
53-
result = cookies.bake(extra_context={"add_tox": "no"})
60+
result = cookies.bake(
61+
extra_context={"add_tox": "no", "python_version": _PYTHON_VERSION}
62+
)
5463

5564
ga_config = result.project_path.joinpath(".github", "workflows", "main.yml")
5665
tox = result.project_path.joinpath("tox.ini")
@@ -64,7 +73,12 @@ def test_remove_tox(cookies):
6473

6574
@pytest.mark.end_to_end
6675
def test_remove_license(cookies):
67-
result = cookies.bake(extra_context={"open_source_license": "Not open source"})
76+
result = cookies.bake(
77+
extra_context={
78+
"open_source_license": "Not open source",
79+
"python_version": _PYTHON_VERSION,
80+
}
81+
)
6882

6983
license_ = result.project_path.joinpath("LICENSE")
7084

@@ -83,6 +97,7 @@ def test_check_conda_environment_creation_and_run_all_checks(cookies):
8397
"conda_environment_name": "__test__",
8498
"make_initial_commit": "yes",
8599
"create_conda_environment_at_finish": "yes",
100+
"python_version": _PYTHON_VERSION,
86101
}
87102
)
88103

tox.ini

-10
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,6 @@ commands =
3232
sphinx-build -T -b html -d {envtmpdir}/doctrees . {envtmpdir}/html
3333
- sphinx-build -T -b linkcheck -d {envtmpdir}/doctrees . {envtmpdir}/linkcheck
3434

35-
36-
[doc8]
37-
ignore = D004
38-
ignore-path =
39-
docs/build
40-
ignore-path-errors =
41-
{{cookiecutter.project_slug}}/README.rst;D000,
42-
{{cookiecutter.project_slug}}/docs/source/changes.rst;D000
43-
max-line-length = 88
44-
4535
[flake8]
4636
docstring-convention = numpy
4737
ignore =

{{cookiecutter.project_slug}}/.github/workflows/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
fail-fast: false
2828
matrix:
2929
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
30-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
30+
python-version: ['3.8', '3.9', '3.10', '3.11']
3131

3232
steps:
3333
- uses: actions/checkout@v2

{{cookiecutter.project_slug}}/.pre-commit-config.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ repos:
3535
- id: reorder-python-imports{% if cookiecutter.add_mypy == "yes" %}
3636
args: [--py37-plus, --add-import, 'from __future__ import annotations']{% endif %}
3737
- repo: https://github.com/asottile/setup-cfg-fmt
38-
rev: v1.20.0
38+
rev: v2.2.0
3939
hooks:
4040
- id: setup-cfg-fmt
4141
- repo: https://github.com/psf/black
@@ -67,12 +67,12 @@ repos:
6767
pydocstyle,
6868
Pygments,
6969
]
70-
- repo: https://github.com/dosisod/refurb
70+
{% if cookiecutter.python_version in ["3.10", "3.11", "3.12"] %}- repo: https://github.com/dosisod/refurb
7171
rev: v1.5.0
7272
hooks:
7373
- id: refurb
7474
args: [--ignore, FURB126]
75-
- repo: https://github.com/guilatrova/tryceratops
75+
{% endif %}- repo: https://github.com/guilatrova/tryceratops
7676
rev: v1.1.0
7777
hooks:
7878
- id: tryceratops

{{cookiecutter.project_slug}}/README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# {{ cookiecutter.project_name }}
22

33
{% if cookiecutter.add_github_actions == "yes"
4-
%}\[!\[image\](https://img.shields.io/github/workflow/status/{{
4+
%}[![image](https://img.shields.io/github/workflow/status/{{
55
cookiecutter.github_username }}/{{ cookiecutter.project_slug
6-
}}/main/main)\](https://github.com/{{ cookiecutter.github_username }}/{{
6+
}}/main/main)](https://github.com/{{ cookiecutter.github_username }}/{{
77
cookiecutter.project_slug }}/actions?query=branch%3Amain) {% endif %} {% if
8-
cookiecutter.add_readthedocs == "yes" %}\[!\[image\](https://readthedocs.org/projects/{{
9-
cookiecutter.project_slug | replace("_", "-") }}/badge/?version=stable)\](https://{{
8+
cookiecutter.add_readthedocs == "yes" %}[![image](https://readthedocs.org/projects/{{
9+
cookiecutter.project_slug | replace("_", "-") }}/badge/?version=stable)](https://{{
1010
cookiecutter.project_slug | replace("_", "-") }}.readthedocs.io/en/stable/?badge=stable)
1111
{% endif %} {% if cookiecutter.add_codecov == "yes"
12-
%}\[!\[image\](https://codecov.io/gh/{{ cookiecutter.github_username }}/{{
13-
cookiecutter.project_slug }}/branch/main/graph/badge.svg)\](https://codecov.io/gh/{{
12+
%}[![image](https://codecov.io/gh/{{ cookiecutter.github_username }}/{{
13+
cookiecutter.project_slug }}/branch/main/graph/badge.svg)](https://codecov.io/gh/{{
1414
cookiecutter.github_username }}/{{ cookiecutter.project_slug }}) {% endif %}
15-
\[!\[pre-commit.ci status\](https://results.pre-commit.ci/badge/github/{{
15+
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/{{
1616
cookiecutter.github_username }}/{{ cookiecutter.project_slug
17-
}}/main.svg)\](https://results.pre-commit.ci/latest/github/{{
17+
}}/main.svg)](https://results.pre-commit.ci/latest/github/{{
1818
cookiecutter.github_username }}/{{ cookiecutter.project_slug }}/main)
1919
[![image](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
2020

{{cookiecutter.project_slug}}/docs/docs_environment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ channels:
33
- nodefaults
44

55
dependencies:
6-
- python >= 3.7
6+
- python >= 3.8
77
- pip
88
- setuptools_scm
99
- toml

{{cookiecutter.project_slug}}/environment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ channels:
55
- nodefaults
66

77
dependencies:
8-
- python >=3.7
8+
- python =={{ cookiecutter.python_version }}
99
- pip >=21.1
1010
- setuptools_scm
1111
- toml

{{cookiecutter.project_slug}}/pyproject.toml

+4
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,7 @@ module = "tests.*"
2222
disallow_untyped_defs = false
2323
ignore_errors = true
2424
{% endif %}
25+
26+
27+
[tool.pytask.ini_options]
28+
paths = "./src/{{ cookiecutter.project_slug }}"

{{cookiecutter.project_slug}}/setup.cfg

+1-5
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ classifiers =
1717
Operating System :: POSIX
1818
Programming Language :: Python :: 3
1919
Programming Language :: Python :: 3 :: Only
20-
Programming Language :: Python :: 3.7
21-
Programming Language :: Python :: 3.8
22-
Programming Language :: Python :: 3.9
23-
Programming Language :: Python :: 3.10
2420
project_urls =
2521
Changelog = https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}
2622
Documentation = hhttps://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}
@@ -31,7 +27,7 @@ project_urls =
3127
packages = find:
3228
install_requires =
3329
pytask
34-
python_requires = >=3.7
30+
python_requires = >=3.8
3531
include_package_data = True
3632
package_dir =
3733
=src

{{cookiecutter.project_slug}}/tox.ini

+1-15
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
[tox]
22
envlist = pytest, sphinx
3-
skipsdist = True
4-
skip_missing_interpreters = True
5-
whitelist_externals = python
63

74
[testenv]
8-
basepython = python
5+
usedevelop = true
96

107
[testenv:pytest]
118
conda_channels =
@@ -24,13 +21,6 @@ conda_deps =
2421
commands =
2522
pytest {posargs}
2623

27-
[pytask]
28-
paths = ./src/{{ cookiecutter.project_slug }}
29-
30-
[doc8]
31-
ignore = D004
32-
max-line-length = 88
33-
3424
[flake8]
3525
docstring-convention = numpy
3626
ignore =
@@ -39,10 +29,6 @@ ignore =
3929
W503 ; ignore linebreak before binary operator which is enforced by Black.
4030
PT006 ; ignore that parametrizing tests with tuple argument names is preferred.
4131
max-line-length = 88
42-
per-file-ignores =
43-
src/_pytask/hookspecs.py: U100
44-
src/_pytask/outcomes.py: N818
45-
tests/test_capture.py: T000, T001, N802, PT011
4632
pytest-mark-no-parentheses = true
4733
warn-symbols =
4834
pytest.mark.wip = Remove 'wip' mark for tests.

0 commit comments

Comments
 (0)