diff --git a/.github/contributors.json b/.github/contributors.json
index ad83662dd..6ee792c5b 100644
--- a/.github/contributors.json
+++ b/.github/contributors.json
@@ -1257,5 +1257,10 @@
"name": "innicoder",
"github_login": "innicoder",
"twitter_username": ""
+ },
+ {
+ "name": "Naveen",
+ "github_login": "naveensrinivasan",
+ "twitter_username": "snaveen"
}
]
\ No newline at end of file
diff --git a/.github/workflows/pre-commit-autoupdate.yml b/.github/workflows/pre-commit-autoupdate.yml
index df4ea1f9a..789c13b43 100644
--- a/.github/workflows/pre-commit-autoupdate.yml
+++ b/.github/workflows/pre-commit-autoupdate.yml
@@ -8,10 +8,16 @@ on:
- cron: "15 2 * * *"
workflow_dispatch: # to trigger manually
+permissions:
+ contents: read
+
jobs:
auto-update:
# Disables this workflow from running in a repository that is not part of the indicated organization/user
if: github.repository_owner == 'cookiecutter'
+ permissions:
+ contents: write # for peter-evans/create-pull-request to create branch
+ pull-requests: write # for peter-evans/create-pull-request to create a PR
runs-on: ubuntu-latest
steps:
diff --git a/.github/workflows/update-contributors.yml b/.github/workflows/update-contributors.yml
index 16c5c6226..2e690d329 100644
--- a/.github/workflows/update-contributors.yml
+++ b/.github/workflows/update-contributors.yml
@@ -5,10 +5,15 @@ on:
branches:
- master
+permissions:
+ contents: read
+
jobs:
build:
# Disables this workflow from running in a repository that is not part of the indicated organization/user
if: github.repository_owner == 'cookiecutter'
+ permissions:
+ contents: write # for stefanzweifel/git-auto-commit-action to push code in repo
runs-on: ubuntu-latest
steps:
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index da839860e..f9559ffa0 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -8,6 +8,13 @@ repos:
- id: trailing-whitespace
- id: check-yaml
+ - repo: https://github.com/asottile/pyupgrade
+ rev: v2.32.1
+ hooks:
+ - id: pyupgrade
+ args: [--py39-plus]
+ exclude: hooks/
+
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a64e17948..db0a47975 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,24 @@ All enhancements and patches to Cookiecutter Django will be documented in this f
+## 2022.05.07
+
+### Changed
+- Add pyupgrade to pre-commit config ([#3702](https://github.com/cookiecutter/cookiecutter-django/pull/3702))
+- Set permissions for GitHub actions ([#3698](https://github.com/cookiecutter/cookiecutter-django/pull/3698))
+### Updated
+- Update jinja2 to 3.1.2 ([#3700](https://github.com/cookiecutter/cookiecutter-django/pull/3700))
+
+## 2022.05.06
+
+### Updated
+- Update pre-commit to 2.19.0 ([#3697](https://github.com/cookiecutter/cookiecutter-django/pull/3697))
+
+## 2022.05.04
+
+### Updated
+- Update django-coverage-plugin to 2.0.3 ([#3695](https://github.com/cookiecutter/cookiecutter-django/pull/3695))
+
## 2022.05.03
### Updated
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index c33bf9e12..90db6689f 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -1349,6 +1349,13 @@ Listed in alphabetical order.
Nico Stefani |
diff --git a/docs/conf.py b/docs/conf.py
index f55bcb819..b53e6a7e7 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -39,7 +39,7 @@ master_doc = "index"
# General information about the project.
project = "Cookiecutter Django"
-copyright = "2013-{}, Daniel Roy Greenfeld".format(now.year)
+copyright = f"2013-{now.year}, Daniel Roy Greenfeld"
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
diff --git a/requirements.txt b/requirements.txt
index 3f480418c..f5364be53 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -8,7 +8,7 @@ black==22.3.0
isort==5.10.1
flake8==4.0.1
flake8-isort==4.1.1
-pre-commit==2.18.1
+pre-commit==2.19.0
# Testing
# ------------------------------------------------------------------------------
@@ -22,5 +22,5 @@ pyyaml==6.0
# ------------------------------------------------------------------------------
PyGithub==1.55
gitpython==3.1.27
-jinja2==3.1.1
+jinja2==3.1.2
requests==2.27.1
diff --git a/setup.py b/setup.py
index 6910cf9a4..245681e27 100644
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@ except ImportError:
from distutils.core import setup
# We use calendar versioning
-version = "2022.05.03"
+version = "2022.05.07"
with open("README.rst") as readme_file:
long_description = readme_file.read()
diff --git a/tests/test_cookiecutter_generation.py b/tests/test_cookiecutter_generation.py
index 8ef8d11bd..8dd58d284 100755
--- a/tests/test_cookiecutter_generation.py
+++ b/tests/test_cookiecutter_generation.py
@@ -149,7 +149,7 @@ def check_paths(paths):
if is_binary(path):
continue
- for line in open(path, "r"):
+ for line in open(path):
match = RE_OBJ.search(line)
assert match is None, f"cookiecutter variable not replaced in {path}"
@@ -214,7 +214,7 @@ def test_travis_invokes_pytest(cookies, context, use_docker, expected_test_scrip
assert result.project_path.name == context["project_slug"]
assert result.project_path.is_dir()
- with open(f"{result.project_path}/.travis.yml", "r") as travis_yml:
+ with open(f"{result.project_path}/.travis.yml") as travis_yml:
try:
yml = yaml.safe_load(travis_yml)["jobs"]["include"]
assert yml[0]["script"] == ["flake8"]
@@ -241,7 +241,7 @@ def test_gitlab_invokes_flake8_and_pytest(
assert result.project_path.name == context["project_slug"]
assert result.project_path.is_dir()
- with open(f"{result.project_path}/.gitlab-ci.yml", "r") as gitlab_yml:
+ with open(f"{result.project_path}/.gitlab-ci.yml") as gitlab_yml:
try:
gitlab_config = yaml.safe_load(gitlab_yml)
assert gitlab_config["flake8"]["script"] == ["flake8"]
@@ -268,7 +268,7 @@ def test_github_invokes_linter_and_pytest(
assert result.project_path.name == context["project_slug"]
assert result.project_path.is_dir()
- with open(f"{result.project_path}/.github/workflows/ci.yml", "r") as github_yml:
+ with open(f"{result.project_path}/.github/workflows/ci.yml") as github_yml:
try:
github_config = yaml.safe_load(github_yml)
linter_present = False
@@ -319,6 +319,6 @@ def test_pycharm_docs_removed(cookies, context, use_pycharm, pycharm_docs_exist)
context.update({"use_pycharm": use_pycharm})
result = cookies.bake(extra_context=context)
- with open(f"{result.project_path}/docs/index.rst", "r") as f:
+ with open(f"{result.project_path}/docs/index.rst") as f:
has_pycharm_docs = "pycharm/configuration" in f.read()
assert has_pycharm_docs is pycharm_docs_exist
diff --git a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml
index dd663231e..5b22d0dc9 100644
--- a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml
+++ b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml
@@ -9,6 +9,12 @@ repos:
- id: end-of-file-fixer
- id: check-yaml
+ - repo: https://github.com/asottile/pyupgrade
+ rev: v2.32.1
+ hooks:
+ - id: pyupgrade
+ args: [--py39-plus]
+
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
diff --git a/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py b/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py
index d1170eff6..09fedbb3f 100644
--- a/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py
+++ b/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py
@@ -18,7 +18,7 @@ def merge(
) -> None:
with open(output_file_path, "w") as output_file:
for merged_file_path in merged_file_paths:
- with open(merged_file_path, "r") as merged_file:
+ with open(merged_file_path) as merged_file:
merged_file_content = merged_file.read()
output_file.write(merged_file_content)
if append_linesep:
@@ -41,7 +41,7 @@ def test_merge(tmpdir_factory, merged_file_count: int, append_linesep: bool):
for i in range(merged_file_count):
merged_file_ord = i + 1
- merged_filename = ".service{}".format(merged_file_ord)
+ merged_filename = f".service{merged_file_ord}"
merged_file_path = tmp_dir_path / merged_filename
merged_file_content = merged_filename * merged_file_ord
@@ -57,7 +57,7 @@ def test_merge(tmpdir_factory, merged_file_count: int, append_linesep: bool):
merge(output_file_path, merged_file_paths, append_linesep)
- with open(output_file_path, "r") as output_file:
+ with open(output_file_path) as output_file:
actual_output_file_content = output_file.read()
assert actual_output_file_content == expected_output_file_content
diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt
index 70c7001be..1979026ae 100644
--- a/{{cookiecutter.project_slug}}/requirements/local.txt
+++ b/{{cookiecutter.project_slug}}/requirements/local.txt
@@ -41,7 +41,7 @@ pylint-django==2.5.3 # https://github.com/PyCQA/pylint-django
{%- if cookiecutter.use_celery == 'y' %}
pylint-celery==0.3 # https://github.com/PyCQA/pylint-celery
{%- endif %}
-pre-commit==2.18.1 # https://github.com/pre-commit/pre-commit
+pre-commit==2.19.0 # https://github.com/pre-commit/pre-commit
# Django
# ------------------------------------------------------------------------------
diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/__init__.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/__init__.py
index b4056707a..fb6532709 100644
--- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/__init__.py
+++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/__init__.py
@@ -1,7 +1,5 @@
__version__ = "{{ cookiecutter.version }}"
__version_info__ = tuple(
- [
- int(num) if num.isdigit() else num
- for num in __version__.replace("-", ".", 1).split(".")
- ]
+ int(num) if num.isdigit() else num
+ for num in __version__.replace("-", ".", 1).split(".")
)
|