From b2a6b9a511979448a3a86d4ec83f17518846e268 Mon Sep 17 00:00:00 2001 From: Nikita Shupeyko Date: Fri, 9 Mar 2018 12:57:32 +0300 Subject: [PATCH] Prettify generated project requirements (#1557) * Prettify base.txt * Prettify local.txt * Get rid of test.txt Rationale: it effectively a duplicate of what's in local.txt * Prettify production.txt --- .../requirements/base.txt | 79 +++++++------------ .../requirements/local.txt | 34 ++++---- .../requirements/production.txt | 50 ++++-------- .../requirements/test.txt | 18 ----- .../utility/install_python_dependencies.sh | 1 - 5 files changed, 64 insertions(+), 118 deletions(-) delete mode 100644 {{cookiecutter.project_slug}}/requirements/test.txt diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index 9cd9f30f..1f091295 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -1,54 +1,31 @@ -# Conservative Django -django==2.0.3 # pyup: < 2.1 - -# Configuration -django-environ==0.4.4 -{% if cookiecutter.use_whitenoise == 'y' -%} -whitenoise==3.3.1 +pytz==2018.3 # https://github.com/stub42/pytz +awesome-slugify==1.6.5 # https://github.com/dimka665/awesome-slugify +Pillow==5.0.0 # https://github.com/python-pillow/Pillow +{%- if cookiecutter.use_compressor == "y" %} +rcssmin==1.0.6{% if cookiecutter.windows == 'y' %} --install-option="--without-c-extensions"{% endif %} # https://github.com/ndparker/rcssmin +{%- endif %} +argon2-cffi==18.1.0 # https://github.com/hynek/argon2_cffi +{%- if cookiecutter.use_whitenoise == 'y' %} +whitenoise==3.3.1 # https://github.com/evansd/whitenoise +{%- endif %} +{%- if cookiecutter.windows == 'y' %} +# TODO: On Windows, install psycopg2 manually from http://www.lfd.uci.edu/~gohlke/pythonlibs/#psycopg +{%- else %} +psycopg2==2.7.4 --no-binary psycopg2 # https://github.com/psycopg/psycopg2 +{%- endif %} +redis>=2.10.5 # https://github.com/antirez/redis +{%- if cookiecutter.use_celery == "y" %} +celery==3.1.25 # pyup: <4.0 # https://github.com/celery/celery {%- endif %} - -# Forms -django-crispy-forms==1.7.1 - -# Models -django-model-utils==3.1.1 - -# Images -Pillow==5.0.0 - -# Password storage -argon2-cffi==18.1.0 - -# For user registration, either via email or social -# Well-built with regular release cycles! -django-allauth==0.35.0 - -{% if cookiecutter.windows == 'y' -%} -# On Windows, you must download/install psycopg2 manually -# from http://www.lfd.uci.edu/~gohlke/pythonlibs/#psycopg -{% else %} -# Python-PostgreSQL Database Adapter -psycopg2==2.7.4 --no-binary psycopg2 +# Django +# ------------------------------------------------------------------------------ +django==2.0.3 # pyup: < 2.1 # https://www.djangoproject.com/ +django-environ==0.4.4 # https://github.com/joke2k/django-environ +django-model-utils==3.1.1 # https://github.com/jazzband/django-model-utils +django-allauth==0.35.0 # https://github.com/pennersr/django-allauth +django-crispy-forms==1.7.1 # https://github.com/django-crispy-forms/django-crispy-forms +{%- if cookiecutter.use_compressor == "y" %} +django-compressor==2.2 # https://github.com/django-compressor/django-compressor {%- endif %} - -# Unicode slugification -awesome-slugify==1.6.5 - -# Time zones support -pytz==2018.3 - -# Redis support -django-redis==4.9.0 -redis>=2.10.5 - -{% if cookiecutter.use_celery == "y" %} -celery==3.1.25 # pyup: <4.0 -{% endif %} - -{% if cookiecutter.use_compressor == "y" %} -rcssmin==1.0.6 {% if cookiecutter.windows == 'y' %}--install-option="--without-c-extensions"{% endif %} -django-compressor==2.2 -{% endif %} - -# Your custom requirements go here +django-redis==4.9.0 # https://github.com/niwinz/django-redis diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 3fb728fa..a40da042 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -1,19 +1,25 @@ -# Local development dependencies go here --r base.txt +-r ./base.txt -coverage==4.5.1 -django-coverage-plugin==1.5.0 +Werkzeug==0.14.1 # https://github.com/pallets/werkzeug +ipdb==0.11 # https://github.com/gotcha/ipdb +Sphinx==1.7.1 # https://github.com/sphinx-doc/sphinx -Sphinx==1.7.1 -django-extensions==2.0.3 -Werkzeug==0.14.1 -django-test-plus==1.0.22 -factory-boy==2.10.0 +# Testing +# ------------------------------------------------------------------------------ +pytest==3.4.2 # https://github.com/pytest-dev/pytest +pytest-sugar==0.9.1 # https://github.com/Frozenball/pytest-sugar -django-debug-toolbar==1.9.1 +# Code quality +# ------------------------------------------------------------------------------ +flake8==3.5.0 # https://github.com/PyCQA/flake8 +coverage==4.5.1 # https://github.com/nedbat/coveragepy -# improved REPL -ipdb==0.11 +# Django +# ------------------------------------------------------------------------------ +factory-boy==2.10.0 # https://github.com/FactoryBoy/factory_boy +django-test-plus==1.0.22 # https://github.com/revsys/django-test-plus -pytest-django==3.1.2 -pytest-sugar==0.9.1 +django-debug-toolbar==1.9.1 # https://github.com/jazzband/django-debug-toolbar +django-extensions==2.0.3 # https://github.com/django-extensions/django-extensions +django-coverage-plugin==1.5.0 # https://github.com/nedbat/django_coverage_plugin +pytest-django==3.1.2 # https://github.com/pytest-dev/pytest-django diff --git a/{{cookiecutter.project_slug}}/requirements/production.txt b/{{cookiecutter.project_slug}}/requirements/production.txt index 41649167..e605e220 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -1,39 +1,21 @@ -# Pro-tip: Try not to put anything here. Avoid dependencies in -# production that aren't in development. +# PRECAUTION: avoid production dependencies that aren't in development + -r base.txt -{% if cookiecutter.windows == 'y' -%} -# Python-PostgreSQL Database Adapter -# Assuming Windows is used locally, and *nix -- in production. -# ------------------------------------------------------------ -psycopg2==2.7.4 --no-binary psycopg2 -{%- endif %} - -# WSGI Handler -# ------------------------------------------------ gevent==1.2.2 -gunicorn==19.7.1 - -# Static and Media Storage -# ------------------------------------------------ -boto3==1.6.2 # pyup: update minor -django-storages==1.6.5 -{% if cookiecutter.use_whitenoise != 'y' -%} -Collectfast==0.6.0 +gunicorn==19.7.1 # https://github.com/benoitc/gunicorn +boto3==1.6.2 # pyup: update minor # https://github.com/boto/boto3 +{%- if cookiecutter.use_whitenoise == 'n' %} +Collectfast==0.6.0 # https://github.com/antonagestam/collectfast +{%- endif %} +{%- if cookiecutter.use_sentry_for_error_reporting == "y" %} +raven==6.6.0 # https://github.com/getsentry/raven-python +{%- endif %} +{%- if cookiecutter.use_opbeat == "y" %} +opbeat==3.6.1 # https://github.com/opbeat/opbeat_python {%- endif %} -# Email backends for Mailgun, Postmark, SendGrid and more -# ------------------------------------------------------- -django-anymail==2.0 - -{% if cookiecutter.use_sentry_for_error_reporting == "y" -%} -# Raven is the Sentry client -# -------------------------- -raven==6.6.0 -{%- endif %} - -{% if cookiecutter.use_opbeat == "y" -%} -# Opbeat agent for performance monitoring -# ----------------------------------------- -opbeat==3.6.1 -{%- endif %} +# Django +# ------------------------------------------------------------------------------ +django-storages==1.6.5 # https://github.com/jschneier/django-storages +django-anymail==2.0 # https://github.com/anymail/django-anymail diff --git a/{{cookiecutter.project_slug}}/requirements/test.txt b/{{cookiecutter.project_slug}}/requirements/test.txt deleted file mode 100644 index 2a6ed87f..00000000 --- a/{{cookiecutter.project_slug}}/requirements/test.txt +++ /dev/null @@ -1,18 +0,0 @@ -# Test dependencies go here. --r base.txt - -{% if cookiecutter.windows == 'y' -%} -# Python-PostgreSQL Database Adapter -# If using Win for dev, this assumes Unix in test/prod -psycopg2==2.7.4 -{%- endif %} - -coverage==4.5.1 -flake8==3.5.0 # pyup: != 2.6.0 -django-test-plus==1.0.22 -factory-boy==2.10.0 -django-coverage-plugin==1.5.0 - -# pytest -pytest-django==3.1.2 -pytest-sugar==0.9.1 diff --git a/{{cookiecutter.project_slug}}/utility/install_python_dependencies.sh b/{{cookiecutter.project_slug}}/utility/install_python_dependencies.sh index c28b5b89..51793484 100755 --- a/{{cookiecutter.project_slug}}/utility/install_python_dependencies.sh +++ b/{{cookiecutter.project_slug}}/utility/install_python_dependencies.sh @@ -35,7 +35,6 @@ if [ -z "$VIRTUAL_ENV" ]; then else pip install -r $PROJECT_DIR/requirements/local.txt - pip install -r $PROJECT_DIR/requirements/test.txt {% if cookiecutter.use_heroku == "y" -%} pip install -r $PROJECT_DIR/requirements.txt {%- endif %}