From 893e7ae9588098c2a2422c90f0d8d483bacf48e1 Mon Sep 17 00:00:00 2001 From: Daniel Gagnon Date: Sat, 4 Feb 2023 16:06:04 -0500 Subject: [PATCH] Works well on 3.8 so far. --- .gitignore | 1 + .pre-commit-config.yaml | 2 +- CONTRIBUTING.md | 2 +- cookiecutter.json | 2 ++ docs/developing-locally.rst | 2 ++ docs/project-generation-options.rst | 3 +++ tox.ini | 2 +- {{cookiecutter.project_slug}}/.pre-commit-config.yaml | 2 +- {{cookiecutter.project_slug}}/config/settings/base.py | 2 +- {{cookiecutter.project_slug}}/requirements/base.txt | 9 +++++---- {{cookiecutter.project_slug}}/requirements/local.txt | 4 ++-- 11 files changed, 20 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index f753fec91..bb4f771cf 100644 --- a/.gitignore +++ b/.gitignore @@ -215,3 +215,4 @@ tags .idea/ .pytest_cache/ +/out/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 438de52b4..ca62096c3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,7 +12,7 @@ repos: rev: v3.3.1 hooks: - id: pyupgrade - args: [--py310-plus] + args: [--py38-plus] exclude: hooks/ - repo: https://github.com/psf/black diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 69bce6f2e..02621d7d2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -33,7 +33,7 @@ To run all tests using various versions of python in virtualenvs defined in tox. It is possible to test with a specific version of python. To do this, the command is: - $ tox -e py310 + $ tox -e py38 This will run pytest with the python3.10 interpreter, for example. diff --git a/cookiecutter.json b/cookiecutter.json index cf4da9a45..7cf246128 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -17,6 +17,8 @@ "windows": "n", "use_pycharm": "n", "use_docker": "n", + "use_sqlite": "n", + "use_postgresql": "n", "postgresql_version": [ "14", "13", diff --git a/docs/developing-locally.rst b/docs/developing-locally.rst index fb66536fc..43da2d35f 100644 --- a/docs/developing-locally.rst +++ b/docs/developing-locally.rst @@ -14,6 +14,8 @@ Make sure to have the following on your host: * Redis_, if using Celery * Cookiecutter_ +And if using Windows, you will also need the rust compiler. + First things first. #. Create a virtualenv: :: diff --git a/docs/project-generation-options.rst b/docs/project-generation-options.rst index d4ad8a9aa..10036b669 100644 --- a/docs/project-generation-options.rst +++ b/docs/project-generation-options.rst @@ -46,6 +46,9 @@ timezone: windows: Indicates whether the project should be configured for development on Windows. +use_sqlite: + Indicates whether the project should be configured for SQlite. Requires Windows. + use_pycharm: Indicates whether the project should be configured for development with PyCharm_. diff --git a/tox.ini b/tox.ini index 0400e4f91..cecc7435f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] skipsdist = true -envlist = py310,black-template +envlist = py38,black-template [testenv] deps = -rrequirements.txt diff --git a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml index a8cdb1357..39829f133 100644 --- a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml +++ b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml @@ -13,7 +13,7 @@ repos: rev: v3.3.1 hooks: - id: pyupgrade - args: [--py310-plus] + args: [--py38-plus] - repo: https://github.com/psf/black rev: 23.1.0 diff --git a/{{cookiecutter.project_slug}}/config/settings/base.py b/{{cookiecutter.project_slug}}/config/settings/base.py index cc77b864a..fd594a321 100644 --- a/{{cookiecutter.project_slug}}/config/settings/base.py +++ b/{{cookiecutter.project_slug}}/config/settings/base.py @@ -38,7 +38,7 @@ LOCALE_PATHS = [str(BASE_DIR / "locale")] # DATABASES # ------------------------------------------------------------------------------ # https://docs.djangoproject.com/en/dev/ref/settings/#databases -{% if cookiecutter.use_docker == "y" -%} +{% if cookiecutter.use_docker == "y" or cookiecutter.use_sqlite == "y" -%} DATABASES = {"default": env.db("DATABASE_URL")} {%- else %} DATABASES = { diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index 0aa17a5f9..2065cf16d 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -2,11 +2,12 @@ pytz==2022.7.1 # https://github.com/stub42/pytz python-slugify==8.0.0 # https://github.com/un33k/python-slugify Pillow==9.4.0 # https://github.com/python-pillow/Pillow {%- if cookiecutter.frontend_pipeline == 'Django Compressor' %} -{%- if cookiecutter.windows == 'y' and cookiecutter.use_docker == 'n' %} -rcssmin==1.1.0 --install-option="--without-c-extensions" # https://github.com/ndparker/rcssmin -{%- else %} +# BUG: prevents Django Compressor from installing on windows. I was able to install rcssmin==1.1.1 without issues +# {#%- if cookiecutter.windows == 'y' and cookiecutter.use_docker == 'n' %#} +# rcssmin==1.1.0 --install-option="--without-c-extensions" # https://github.com/ndparker/rcssmin +# {%- else %} rcssmin==1.1.1 # https://github.com/ndparker/rcssmin -{%- endif %} +# {#%- endif %#} {%- endif %} argon2-cffi==21.3.0 # https://github.com/hynek/argon2_cffi {%- if cookiecutter.use_whitenoise == 'y' %} diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 8905ddb76..3ab4ca1db 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -2,9 +2,9 @@ Werkzeug[watchdog]==2.2.2 # https://github.com/pallets/werkzeug ipdb==0.13.11 # https://github.com/gotcha/ipdb -{%- if cookiecutter.use_docker == 'y' %} +{%- if cookiecutter.use_docker == 'y' and cookiecutter.use_postgresql == 'y' %} psycopg2==2.9.5 # https://github.com/psycopg/psycopg2 -{%- else %} +{%- elif cookiecutter.use_postgresql == 'y' %} psycopg2-binary==2.9.5 # https://github.com/psycopg/psycopg2 {%- endif %} {%- if cookiecutter.use_async == 'y' or cookiecutter.use_celery == 'y' %}