Commit 3992e984 authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Merge branch 'pipenv-instead-of-requirements' into 'master'

Use pipenv instead of requirements.txt

Closes #672 and #631

See merge request !879
parents 86bb6dab 379f32d0
...@@ -2,12 +2,11 @@ variables: ...@@ -2,12 +2,11 @@ variables:
POSTGRES_DB: thalia POSTGRES_DB: thalia
POSTGRES_USER: postgres POSTGRES_USER: postgres
POSTGRES_PASSWORD: "" POSTGRES_PASSWORD: ""
CI_DEPS: psycopg2-binary # https://hub.docker.com/r/thalia/python-thalia/
# https://hub.docker.com/r/twiggers/python-thalia/ # https://github.com/thaliawww/python-thalia
# https://github.com/thomwiggers/python-thalia
# Should get auto-updated with the official 'python' repository # Should get auto-updated with the official 'python' repository
# Installs: # Installs:
# - pip: tox, coverage # - pip: tox, coverage, pipenv
# - apt: ghostscript # - apt: ghostscript
PY35_IMAGE: thalia/python-thalia:3.5 PY35_IMAGE: thalia/python-thalia:3.5
PY36_IMAGE: thalia/python-thalia:3.6 PY36_IMAGE: thalia/python-thalia:3.6
...@@ -20,7 +19,6 @@ stages: ...@@ -20,7 +19,6 @@ stages:
pep8: pep8:
stage: test stage: test
image: $PY35_IMAGE image: $PY35_IMAGE
before_script:
script: script:
- tox -e flake8 - tox -e flake8
...@@ -54,17 +52,16 @@ docs: ...@@ -54,17 +52,16 @@ docs:
image: $PY35_IMAGE image: $PY35_IMAGE
before_script: before_script:
# install django deps # install django deps
- pip install -r requirements.txt - pipenv --bare install --dev --ignore-pipfile
- pip install -r dev-requirements.txt
- cd docs
# install doc deps # install doc deps
- pip install -r requirements.txt - cd docs
- pipenv run pip install -r requirements.txt
script: script:
- echo "Building current docs" - echo "Building current docs"
- env -u GITLAB_CI make doctest - env -u GITLAB_CI pipenv run make doctest
- env -u GITLAB_CI sphinx-build -M html "." "_build" -W -j $(nproc) - env -u GITLAB_CI pipenv run sphinx-build -M html "." "_build" -W -j $(nproc)
- echo "Checking if there are changes" - echo "Checking if there are changes"
- ./generate-apidocs.sh - pipenv run ./generate-apidocs.sh
- git diff --exit-code - git diff --exit-code
build docker image: build docker image:
......
...@@ -37,21 +37,21 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ ...@@ -37,21 +37,21 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
ghostscript && \ ghostscript && \
rm -rf /var/lib/apt rm -rf /var/lib/apt
RUN pip install --no-cache-dir pipenv
WORKDIR /usr/src/app/website/ WORKDIR /usr/src/app/website/
# install python requirements # install python requirements
COPY requirements.txt /usr/src/app/website/
COPY production-requirements.txt /usr/src/app/website/
COPY dev-requirements.txt /usr/src/app/website/
COPY docs/requirements.txt /usr/src/app/docs/ COPY docs/requirements.txt /usr/src/app/docs/
RUN pip install --no-cache-dir \ COPY Pipfile /usr/src/app/website/
-r requirements.txt \ COPY Pipfile.lock /usr/src/app/website/
-r production-requirements.txt \
-r ../docs/requirements.txt
RUN if [ "$install_dev_requirements" -eq 1 ]; then \ RUN if [ "$install_dev_requirements" -eq 1 ]; then \
pip install --no-cache-dir -r dev-requirements.txt; \ pipenv install --system --dev; \
else \
echo "This will fail if the dependencies are out of date"; \
pipenv install --system --deploy; \
fi fi
RUN pip install --no-cache-dir \
-r ../docs/requirements.txt
# Create entry points # Create entry points
COPY resources/entrypoint.sh /usr/local/bin/entrypoint.sh COPY resources/entrypoint.sh /usr/local/bin/entrypoint.sh
......
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
django-localflavor = "*"
django-sendfile = "*"
freezegun = "*"
bleach = "*"
"django-tinymce4-lite" = "*"
rcssmin = "*"
djangorestframework = "*"
django-ical = "*"
django-libsass = "*"
django-cors-headers = "*"
python-magic = "*"
pyfcm = "*"
celery = "*"
redis = "*"
raven = "*"
Django = ">=2.0,<2.1"
Pillow = "*"
django_compressor = "*"
django_celery_results = "*"
"psycopg2-binary" = "*"
bcrypt = "*"
django-slack = "!=5.7.2"
"argon2_cffi" = "*"
uWSGI = "*"
[dev-packages]
django-template-check = "*"
"flake8" = "*"
pydenticon = "*"
pylint = "*"
pylint-django = "*"
tox = "*"
Faker = "*"
factory_boy = "*"
coverage = "*"
This diff is collapsed.
...@@ -17,11 +17,10 @@ Getting started ...@@ -17,11 +17,10 @@ Getting started
If you use Docker, please look at [this part](#docker) of the README. If you use Docker, please look at [this part](#docker) of the README.
0. Get at least Python 3.5 and install the Pillow requirements as per below. 0. Get at least Python 3.5 and install pipenv and the Pillow requirements as per below.
1. Clone this repository 1. Clone this repository
2. Run `source ./source_me.sh` or `source venv/bin/activate` (or what you do for your own favourite virtualenv solution) 2. Run `pipenv install --dev`
3. Run `pip install -r requirements.txt` 3. Run `pipenv shell`
4. Run `pip install -r dev-requirements.txt`
5. `cd website` 5. `cd website`
6. `./manage.py migrate` to initialise the database 6. `./manage.py migrate` to initialise the database
7. `./manage.py createsuperuser` to create the first user (note that this user won't be a member!) 7. `./manage.py createsuperuser` to create the first user (note that this user won't be a member!)
...@@ -41,6 +40,13 @@ ignored. If you want to run a specific check, you can do the following: ...@@ -41,6 +40,13 @@ ignored. If you want to run a specific check, you can do the following:
You can run `tox -l` to see the available environments. You can run `tox -l` to see the available environments.
Pipenv
------
Install Pipenv per the [pipenv documentation][pipenv install]
[pipenv install]: https://docs.pipenv.org/install/#installing-pipenv
Pillow dependencies Pillow dependencies
------------------- -------------------
......
Django>=2.0.8,<2.1
django-localflavor>=2.0,<2.1
Pillow>=5.0,<5.1
django-compressor>=2.1,<3
django-sendfile<=0.4
freezegun>=0.3.9,<0.4.0
bleach>=2.1.0,<2.2
django-tinymce4-lite>=1.7,<1.8
rcssmin>=1.0.6
djangorestframework>=3.7.1,<3.8
django-ical>=1.4,<2
django-libsass>=0.7,<1
django-cors-headers>=2.1.0,<2.2
python-magic>=0.4.13,<0.5
pyfcm>=1.4.2,<1.5
celery>=4.0,<4.2
redis>=2.10,<2.11
django-celery-results>=1.0.1,<1.1
raven>=6.4.0,<6.5.0
[tox] [tox]
envlist = flake8, {py35,py36}-django20 envlist = flake8, {py35,py36,py37}-django20, {py35,py36,py37}-django21
skipsdist = True skipsdist = True
skip_missing_interpreters = True skip_missing_interpreters = True
...@@ -8,31 +8,22 @@ changedir={toxinidir}/website ...@@ -8,31 +8,22 @@ changedir={toxinidir}/website
commands = commands =
; Copy the env list to make not conflict with the Django version ; Copy the env list to make not conflict with the Django version
; specified below ; specified below
cp {toxinidir}/requirements.txt {envbindir}/reqtemp.txt pipenv --bare install --dev --ignore-pipfile
sed -i /Django>=.*/d {envbindir}/reqtemp.txt ; override using pip. Using pipenv would write to Pipfile!
pip install -r{envbindir}/reqtemp.txt -r{toxinidir}/dev-requirements.txt django20: pip install 'django>=2.0rc1,<2.1'
# Issue https://gitlab.science.ru.nl/thalia/concrexit/issues/631 django21: pip install --pre 'django>=2.1rc1,<2.2'
#pipconflictchecker # if this fails, use pipdeptree to debug pipenv --bare run python manage.py check
python manage.py check pipenv --bare run python manage.py templatecheck --project-only
python manage.py templatecheck --project-only pipenv --bare run python manage.py makemigrations --no-input --check --dry-run
python manage.py makemigrations --no-input --check --dry-run pipenv --bare run python -Wall -mcoverage run --branch --source '.' manage.py test
python -Wall -mcoverage run --branch --source '.' manage.py test pipenv --bare check
safety check
deps = deps =
coverage pipenv
pip-conflict-checker
django20: django>=2.0rc1,<2.1
{env:CI_DEPS:}
passenv = passenv =
GITLAB_CI GITLAB_CI
PIP_CACHE_DIR PIP_CACHE_DIR
whitelist_externals= env =
sed PIPENV_SUPPRESS_NESTED_WARNING=1
cp
[flake8]
exclude = */migrations/*, */urls.py, .ropeproject
[testenv:flake8] [testenv:flake8]
deps= flake8 deps= flake8
...@@ -41,3 +32,7 @@ commands= ...@@ -41,3 +32,7 @@ commands=
flake8 . flake8 .
passenv = passenv =
PIP_CACHE_DIR PIP_CACHE_DIR
# Settings for Flake8
[flake8]
exclude = */migrations/*, */urls.py, .ropeproject
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment