From 0aed2350042e8329571aa01938d64edd137658ca Mon Sep 17 00:00:00 2001 From: github-actions Date: Thu, 5 May 2022 02:37:43 +0000 Subject: [PATCH 1/8] Release 2022.05.04 --- CHANGELOG.md | 5 +++++ setup.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a64e17948..f9a80cf15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ All enhancements and patches to Cookiecutter Django will be documented in this f +## 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/setup.py b/setup.py index 6910cf9a4..f9d21191b 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.04" with open("README.rst") as readme_file: long_description = readme_file.read() From 964f08db43f5408572a2fe84b9dfd105b8d37d7f Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Fri, 6 May 2022 01:01:07 -0700 Subject: [PATCH 2/8] Update pre-commit to 2.19.0 (#3697) * Update pre-commit from 2.18.1 to 2.19.0 * Update pre-commit from 2.18.1 to 2.19.0 --- requirements.txt | 2 +- {{cookiecutter.project_slug}}/requirements/local.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 3f480418c..289c3e5c9 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 # ------------------------------------------------------------------------------ diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 34daaf134..6cb5e3ced 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -36,7 +36,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 # ------------------------------------------------------------------------------ From 7c2476d847096b7accf186c6461028d3b2b7a6f2 Mon Sep 17 00:00:00 2001 From: github-actions Date: Sat, 7 May 2022 02:34:39 +0000 Subject: [PATCH 3/8] Release 2022.05.06 --- CHANGELOG.md | 5 +++++ setup.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f9a80cf15..10631012e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ All enhancements and patches to Cookiecutter Django will be documented in this f +## 2022.05.06 + +### Updated +- Update pre-commit to 2.19.0 ([#3697](https://github.com/cookiecutter/cookiecutter-django/pull/3697)) + ## 2022.05.04 ### Updated diff --git a/setup.py b/setup.py index f9d21191b..f8ab4371b 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.04" +version = "2022.05.06" with open("README.rst") as readme_file: long_description = readme_file.read() From e0c04fa0d30884e3387e32724068d66360451a22 Mon Sep 17 00:00:00 2001 From: Naveen <172697+naveensrinivasan@users.noreply.github.com> Date: Sat, 7 May 2022 07:49:24 -0500 Subject: [PATCH 4/8] Set permissions for GitHub actions (#3698) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: Set permissions for GitHub actions Restrict the GitHub token permissions only to the required ones; this way, even if the attackers will succeed in compromising your workflow, they won’t be able to do much. - Included permissions for the action. https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs [Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/) Signed-off-by: naveen <172697+naveensrinivasan@users.noreply.github.com> * Leave comment close to code Co-authored-by: Bruno Alla --- .github/workflows/pre-commit-autoupdate.yml | 6 ++++++ .github/workflows/update-contributors.yml | 5 +++++ 2 files changed, 11 insertions(+) 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: From 66d1d010e8a16806f39868af920804484ff4d65a Mon Sep 17 00:00:00 2001 From: browniebroke Date: Sat, 7 May 2022 12:49:50 +0000 Subject: [PATCH 5/8] Update Contributors --- .github/contributors.json | 5 +++++ CONTRIBUTORS.md | 7 +++++++ 2 files changed, 12 insertions(+) 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/CONTRIBUTORS.md b/CONTRIBUTORS.md index c33bf9e12..90db6689f 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -1349,6 +1349,13 @@ Listed in alphabetical order. + + Naveen + + naveensrinivasan + + snaveen + Nico Stefani From 337bbd282019df805159d69eb9b252db41b67ba4 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Sat, 7 May 2022 06:22:25 -0700 Subject: [PATCH 6/8] Update jinja2 from 3.1.1 to 3.1.2 (#3700) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 289c3e5c9..f5364be53 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 From 96b9b95af70f14afd976ac673f5571fa3a77bb25 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Sat, 7 May 2022 19:21:15 +0100 Subject: [PATCH 7/8] Add pyupgrade to pre-commit config (#3702) * Add pyupgrade to pre-commit config * Exclude hooks folder from pyupgrade * Autofix: run pyupgrade * Autofix: run pyupgrade on template files --- .pre-commit-config.yaml | 7 +++++++ docs/conf.py | 2 +- tests/test_cookiecutter_generation.py | 10 +++++----- {{cookiecutter.project_slug}}/.pre-commit-config.yaml | 6 ++++++ .../merge_production_dotenvs_in_dotenv.py | 6 +++--- .../{{cookiecutter.project_slug}}/__init__.py | 6 ++---- 6 files changed, 24 insertions(+), 13 deletions(-) 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/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/tests/test_cookiecutter_generation.py b/tests/test_cookiecutter_generation.py index 9c30aeedd..63b4fc97c 100755 --- a/tests/test_cookiecutter_generation.py +++ b/tests/test_cookiecutter_generation.py @@ -138,7 +138,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}" @@ -203,7 +203,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"] @@ -230,7 +230,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"] @@ -257,7 +257,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 @@ -308,6 +308,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}}/{{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(".") ) From 5acde4875fbe38a8966f640249a6ba4bf7678ba0 Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 8 May 2022 02:41:22 +0000 Subject: [PATCH 8/8] Release 2022.05.07 --- CHANGELOG.md | 8 ++++++++ setup.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10631012e..db0a47975 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,14 @@ 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 diff --git a/setup.py b/setup.py index f8ab4371b..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.06" +version = "2022.05.07" with open("README.rst") as readme_file: long_description = readme_file.read()