From 31906c2795ce3860a60fbc41019fed0e67e5de68 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Tue, 28 Feb 2023 11:21:33 +0100 Subject: [PATCH] Switch to rtx instead of pyenv --- hooks/post_gen_project.py | 4 +--- {{cookiecutter.project_slug}}/.envrc | 1 + .../.github/workflows/update-dependencies.yaml | 6 +++--- {{cookiecutter.project_slug}}/.gitignore | 2 ++ {{cookiecutter.project_slug}}/.tool-versions | 1 + {{cookiecutter.project_slug}}/README.md | 2 -- .../src/common/migrations/0001_initial.py | 1 - .../src/{{cookiecutter.project_slug}}/settings.py | 12 ++++++------ 8 files changed, 14 insertions(+), 15 deletions(-) create mode 100644 {{cookiecutter.project_slug}}/.tool-versions diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 0331fb2..7532c97 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -7,7 +7,7 @@ COMMANDS_TO_RUN = [ "pre-commit install", "pre-commit autoupdate", "pre-commit run --all-files", - "git add ./*.txt", + "git add .", "git commit -m 'Freeze dependencies'", "pycharm .", "inv test", @@ -21,8 +21,6 @@ def main(): os.system("git init") os.system("git add .") os.system("git commit -m 'Initial commit'") - os.system("pyenv virtualenv {{cookiecutter.python_version}} {{cookiecutter.project_slug}}") - os.system("pyenv local {{cookiecutter.project_slug}}") print("\nWe created a virtualenv using {{cookiecutter.python_version}} for you.") print("Run the following commands:") print("cd {{cookiecutter.project_slug}} && direnv allow") diff --git a/{{cookiecutter.project_slug}}/.envrc b/{{cookiecutter.project_slug}}/.envrc index 434712c..f1bcb18 100644 --- a/{{cookiecutter.project_slug}}/.envrc +++ b/{{cookiecutter.project_slug}}/.envrc @@ -1,2 +1,3 @@ +layout python3 export ENV_FILE="$(realpath ./envs/local-envs.env)" export DATABASE_URL="sqlite:///$(realpath ./db/db.sqlite3)" diff --git a/{{cookiecutter.project_slug}}/.github/workflows/update-dependencies.yaml b/{{cookiecutter.project_slug}}/.github/workflows/update-dependencies.yaml index 7ec9004..acb5d5c 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/update-dependencies.yaml +++ b/{{cookiecutter.project_slug}}/.github/workflows/update-dependencies.yaml @@ -30,13 +30,13 @@ jobs: uses: tibdex/github-app-token@v1 id: generate-token with: - app_id: ${{ secrets.PR_APP_ID }} - private_key: ${{ secrets.PR_APP_PRIVATE_KEY }} + app_id: {% raw %}${{ secrets.PR_APP_ID }}{% endraw %} + private_key: {% raw %}${{ secrets.PR_APP_PRIVATE_KEY }}{% endraw %} - name: Create Pull Request uses: peter-evans/create-pull-request@v4 id: create-pull-request with: - token: ${{ steps.generate-token.outputs.token }} + token: {% raw %}${{ steps.generate-token.outputs.token }}{% endraw %} commit-message: Update dependencies base: master branch: update-dependencies diff --git a/{{cookiecutter.project_slug}}/.gitignore b/{{cookiecutter.project_slug}}/.gitignore index 1b6612c..5498e1f 100644 --- a/{{cookiecutter.project_slug}}/.gitignore +++ b/{{cookiecutter.project_slug}}/.gitignore @@ -1,3 +1,5 @@ +.direnv/ + ### Django ### *.log *.pot diff --git a/{{cookiecutter.project_slug}}/.tool-versions b/{{cookiecutter.project_slug}}/.tool-versions new file mode 100644 index 0000000..9a51a28 --- /dev/null +++ b/{{cookiecutter.project_slug}}/.tool-versions @@ -0,0 +1 @@ +python {{ cookiecutter.python_version }} diff --git a/{{cookiecutter.project_slug}}/README.md b/{{cookiecutter.project_slug}}/README.md index 5f34d8e..49f5c3a 100644 --- a/{{cookiecutter.project_slug}}/README.md +++ b/{{cookiecutter.project_slug}}/README.md @@ -3,8 +3,6 @@ ## Quick start Clone, then ```shell -pyenv virtualenv {{cookiecutter.python_version}} {{cookiecutter.project_slug}} -pyenv local {{cookiecutter.project_slug}} pip install pip-tools pip-sync requirements.txt requirements-dev.txt pre-commit install --install-hooks diff --git a/{{cookiecutter.project_slug}}/src/common/migrations/0001_initial.py b/{{cookiecutter.project_slug}}/src/common/migrations/0001_initial.py index ec88ab9..65ec892 100644 --- a/{{cookiecutter.project_slug}}/src/common/migrations/0001_initial.py +++ b/{{cookiecutter.project_slug}}/src/common/migrations/0001_initial.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/settings.py b/{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/settings.py index 89e667e..05a3163 100644 --- a/{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/settings.py +++ b/{{cookiecutter.project_slug}}/src/{{cookiecutter.project_slug}}/settings.py @@ -238,15 +238,15 @@ APP = { try: with Path("/app/git/build-date").open() as f: APP["build"]["date"] = f.read().strip() -except Exception: - pass # noqa: S110 +except Exception: # noqa: S110 + pass try: with Path("/app/git/git-commit").open() as f: APP["build"]["commit"] = f.read().strip() -except Exception: - pass # noqa: S110 +except Exception: # noqa: S110 + pass try: with Path("/app/git/git-describe").open() as f: APP["build"]["describe"] = f.read().strip() -except Exception: - pass # noqa: S110 +except Exception: # noqa: S110 + pass