Skip to content

Deprecate Python 3.6, add support for Python 3.10 and add mypy optionally. #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Feb 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
python-version: ['3.7', '3.8', '3.9']
python-version: ['3.7', '3.8', '3.9', '3.10']

steps:
- uses: actions/checkout@v2
Expand All @@ -39,7 +39,7 @@ jobs:
run: tox -e pytest -- 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.8'
if: runner.os == 'Linux' && matrix.python-version == '3.9'
shell: bash -l {0}
run: bash <(curl -s https://codecov.io/bash) -F end_to_end -c

Expand Down
14 changes: 12 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ repos:
- id: check-merge-conflict
- id: check-vcs-permalinks
- id: check-yaml
exclude: "{{cookiecutter.project_slug}}/environment.yml"
exclude: |
(?x)^(
{{cookiecutter.project_slug}}/environment.yml|
{{cookiecutter.project_slug}}/.pre-commit-config.yaml
)$
- id: debug-statements
- id: end-of-file-fixer
- id: fix-byte-order-marker
Expand Down Expand Up @@ -74,7 +78,13 @@ repos:
rev: 1.5.0
hooks:
- id: interrogate
args: [-v, --fail-under=40, "{{cookiecutter.project_slug}}"]
args: [
-v,
--fail-under=40,
--config,
pyproject.toml,
"{{cookiecutter.project_slug}}"
]
pass_filenames: false
- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
Expand Down
1 change: 1 addition & 0 deletions cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"python_version": "3.8",
"add_tox": ["yes", "no"],
"add_github_actions": ["yes", "no"],
"add_mypy": ["yes", "no"],
"add_readthedocs": ["yes", "no"],
"add_codecov": ["yes", "no"],
"create_changelog": ["yes", "no"],
Expand Down
1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""
# -- Project information -----------------------------------------------------


project = "cookiecutter-pytask-project"
author = "Tobias Raabe"
copyright = f"2021, {author}" # noqa: A001
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies:

# Package dependencies
- cookiecutter
- pytask
- pytask >=0.1.7

# Misc
- black
Expand Down
4 changes: 2 additions & 2 deletions hooks/pre_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

MODULE_REGEX = r"^[-_a-zA-Z0-9]*$"
ENVIRON_REGEX = r"^[-_a-zA-Z0-9]*$"
PYTHONVERSION_REGEX = r"^(3)\.[6-9]$"
PYTHONVERSION_REGEX = r"^(3\.(10|[7-9])(\.[0-9]{1,2})?)$"

EXCEPTION_MSG_MODULE_NAME = """
ERROR: The project slug ({module_name}) is not a valid Python module name.
Expand Down Expand Up @@ -33,7 +33,7 @@ def main():
python_version = "{{ cookiecutter.python_version }}"

if not re.match(PYTHONVERSION_REGEX, python_version):
raise ValueError("ERROR: The python version must be >= 3.6") # noqa: TC003
raise ValueError("ERROR: The python version must be >= 3.7") # noqa: TC003


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"""This file is necessary to apply custom mypy configurations for the tests."""
"""This module is necessary to configure mypy's behavior for the tests."""
8 changes: 4 additions & 4 deletions {{cookiecutter.project_slug}}/.github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
python-version: ['3.7', '3.8', '3.9']
python-version: ['3.7', '3.8', '3.9', '3.10']

steps:
- uses: actions/checkout@v2
Expand All @@ -45,7 +45,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.8'
if: runner.os == 'Linux' && matrix.python-version == '3.9'
shell: bash -l {0}
run: bash <(curl -s https://codecov.io/bash) -F unit -c

Expand All @@ -54,7 +54,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.8'
if: runner.os == 'Linux' && matrix.python-version == '3.9'
shell: bash -l {0}
run: bash <(curl -s https://codecov.io/bash) -F integration -c

Expand All @@ -63,7 +63,7 @@ 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.8'
if: runner.os == 'Linux' && matrix.python-version == '3.9'
shell: bash -l {0}
run: bash <(curl -s https://codecov.io/bash) -F end_to_end -c

Expand Down
7 changes: 4 additions & 3 deletions {{cookiecutter.project_slug}}/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ repos:
- repo: https://github.com/asottile/reorder_python_imports
rev: v2.7.1
hooks:
- id: reorder-python-imports
- id: reorder-python-imports{% if cookiecutter.add_mypy == "yes" %}
args: [--py37-plus, --add-import, 'from __future__ import annotations']{% endif %}
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.20.0
hooks:
Expand Down Expand Up @@ -86,7 +87,7 @@ repos:
rev: v1.0.1
hooks:
- id: tryceratops
- repo: https://github.com/pre-commit/mirrors-mypy
{% if cookiecutter.add_mypy == "yes" %}- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v0.931'
hooks:
- id: mypy
Expand All @@ -95,7 +96,7 @@ repos:
--ignore-missing-imports,
]
pass_filenames: false
- repo: meta
{% endif %}- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes
Expand Down
3 changes: 1 addition & 2 deletions {{cookiecutter.project_slug}}/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -758,5 +758,4 @@ into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
{% endif %}
<https://www.gnu.org/licenses/why-not-lgpl.html>.{% endif %}
4 changes: 2 additions & 2 deletions {{cookiecutter.project_slug}}/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ Credits
-------

This project was created with `cookiecutter <https://github.com/audreyr/cookiecutter>`_
and the `cookiecutter-pytask-project <https://github.com/pytask-dev/cookiecutter-pytask-project>`_
template.
and the `cookiecutter-pytask-project
<https://github.com/pytask-dev/cookiecutter-pytask-project>`_ template.
3 changes: 2 additions & 1 deletion {{cookiecutter.project_slug}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.0"]
[tool.setuptools_scm]
write_to = "src/{{ cookiecutter.project_slug }}/_version.py"


{% if cookiecutter.add_mypy == "yes" %}
[tool.mypy]
files = ["src", "tests"]
check_untyped_defs = true
Expand All @@ -21,3 +21,4 @@ warn_unused_ignores = true
module = "tests.*"
disallow_untyped_defs = false
ignore_errors = true
{% endif %}
3 changes: 1 addition & 2 deletions {{cookiecutter.project_slug}}/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ classifiers =
Operating System :: POSIX
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Expand All @@ -32,7 +31,7 @@ project_urls =
packages = find:
install_requires =
pytask
python_requires = >=3.6.1
python_requires = >=3.7
include_package_data = True
package_dir =
=src
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
try:
from ._version import version as __version__
except ImportError:
# broken installation, we don't even try unknown only works because we do poor mans
# version compare
__version__ = "unknown"


Expand Down
1 change: 1 addition & 0 deletions {{cookiecutter.project_slug}}/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""This module is necessary to configure mypy's behavior for the tests."""