Migrate to poetry

parent 711d1885
[flake8]
exclude = */migrations/*,*/urls.py
......@@ -6,7 +6,7 @@ variables:
# https://github.com/thaliawww/python-thalia
# Should get auto-updated with the official 'python' repository
# Installs:
# - pip: tox, coverage, pipenv
# - pip: coverage, poetry
# - apt: ghostscript
PY36_IMAGE: thalia/python-thalia:3.6
PY37_IMAGE: thalia/python-thalia:3.7
......@@ -19,8 +19,10 @@ stages:
codestyle:
stage: test
image: $PY36_IMAGE
before_script:
- poetry install --no-interaction
script:
- tox -e flake8
- poetry run flake8 website
# Check for obsolete translations in .po files (starting with `#~`).
- cd website
- grep --include="*.po" --files-with-matches --recursive "^#~" && exit 1 || echo "No obsolete translations found."
......@@ -37,40 +39,42 @@ codestyle:
- postgres:latest
before_script:
- git log -1
- poetry install --no-interaction
script:
- tox -e ${PYTHON_VERSION}-${DJANGO_VERSION}
- cd website
- poetry run python manage.py check
- poetry run python manage.py templatecheck --project-only
- poetry run python manage.py makemigrations --no-input --check --dry-run
- >
poetry run
python -Wall -mcoverage run
--omit="manage.py,thaliawebsite/wsgi.py,*/migrations/*"
--branch
--source '.'
manage.py test
- coverage report
python36-django21:
<<: *djangotest
image: $PY36_IMAGE
variables:
PYTHON_VERSION: py36
DJANGO_VERSION: django21
python37-django21:
<<: *djangotest
image: $PY37_IMAGE
variables:
PYTHON_VERSION: py37
DJANGO_VERSION: django21
docs:
stage: test
image: $PY36_IMAGE
before_script:
# install django deps
- pipenv --bare install --dev --ignore-pipfile
# install doc deps
- cd docs
- pipenv run pip install -r requirements.txt
- poetry install --no-interaction --extras "docs"
script:
- echo "Building current docs"
- env -u GITLAB_CI pipenv run make doctest
- env -u GITLAB_CI pipenv run sphinx-build -W . _build
- cd docs
- env -u GITLAB_CI poetry run make doctest
- env -u GITLAB_CI poetry run sphinx-build -W . _build
- echo "Checking if there are changes"
- pipenv run ./generate-apidocs.sh
- poetry run ./generate-apidocs.sh
- git diff --exit-code
build docker image:
......
......@@ -37,21 +37,20 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
ghostscript && \
rm -rf /var/lib/apt
RUN pip install --no-cache-dir pipenv
RUN pip install --no-cache-dir poetry && \
poetry config settings.virtualenvs.create false
WORKDIR /usr/src/app/website/
# install python requirements
COPY docs/requirements.txt /usr/src/app/docs/
COPY Pipfile /usr/src/app/website/
COPY Pipfile.lock /usr/src/app/website/
COPY pyproject.toml /usr/src/app/website/
COPY poetry.lock /usr/src/app/website/
RUN if [ "$install_dev_requirements" -eq 1 ]; then \
pipenv install --system --dev; \
poetry install --no-interaction --extras "docs"; \
else \
echo "This will fail if the dependencies are out of date"; \
pipenv install --system --deploy; \
fi
RUN pip install --no-cache-dir \
-r ../docs/requirements.txt
poetry install --no-interaction --extras "docs" --no-dev; \
fi; \
poetry cache:clear --all --no-interaction pypi
# Create entry points
COPY resources/entrypoint.sh /usr/local/bin/entrypoint.sh
......
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
django-localflavor = "*"
freezegun = "*"
bleach = "*"
"django-tinymce4-lite" = "*"
rcssmin = "*"
djangorestframework = "*"
django-ical = "*"
django-libsass = "*"
django-cors-headers = "*"
python-magic = "*"
redis = "*"
Django = ">=2.1,<2.2"
Pillow = "*"
django_compressor = "*"
"psycopg2-binary" = "*"
bcrypt = "*"
"argon2_cffi" = "*"
uWSGI = "*"
"django-bootstrap4" = "*"
firebase-admin = "*"
sentry-sdk = "*"
django-sendfile2 = "*"
[dev-packages]
django-template-check = "*"
"flake8" = "*"
pydenticon = "*"
pylint = "*"
pylint-django = "*"
tox = "*"
Faker = "*"
factory_boy = "*"
coverage = "*"
This diff is collapsed.
......@@ -11,10 +11,11 @@ Getting started
If you use Docker, please look at [this part](#docker) of the README.
0. Get at least Python 3.6 and install pipenv and the Pillow requirements as per below.
0. Get at least Python 3.6 and install poetry and the Pillow requirements as per below.
1. Clone this repository
2. Run `pipenv install --python 3 --dev`
3. Run `pipenv shell`
2. Make sure `poetry` uses your python 3 installation: `poetry env use python3`
3. Run `poetry install`
4. Run `poetry shell`
5. `cd website`
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!)
......@@ -23,23 +24,27 @@ If you use Docker, please look at [this part](#docker) of the README.
Testing and linting
-------------------
1. In the root folder of the project, run `tox`.
You can use [`pyenv`](https://github.com/pyenv/pyenv) (on Unix systems) to test in different python
environments.
You may get errors about missing interpreters. That is normal and can be
ignored. If you want to run a specific check, you can do the following:
The linter can be run in the `poetry shell` or by running
tox -e flake8 # Runs the flake8 linter
tox -e py36-django20 # runs the tests with python 3.6 and Django 2.0
tox -e py37-django20 # runs the tests with python 3.7 and Django 2.0
poetry run flake8 website
You can run `tox -l` to see the available environments.
There are a range of tests that can be run:
Pipenv
poetry run python manage.py check
poetry run python manage.py templatecheck --project-only
poetry run python manage.py makemigrations --no-input --check --dry-run
poetry run python -mcoverage run --branch --source '.' manage.py test
coverage report
poetry
------
Install Pipenv per the [pipenv documentation][pipenv install]
Install poetry per the [poetry documentation][poetry install]
[pipenv install]: https://docs.pipenv.org/install/#installing-pipenv
[poetry install]: https://github.com/sdispater/poetry#installation
Pillow dependencies
-------------------
......
recommonmark
sphinx==1.8.3
This diff is collapsed.
[tool.poetry]
name = "concrexit"
version = "22.0.0"
description = "New new Thalia website, now with extra Django."
authors = ["Thalia Technicie <www@thalia.nu>"]
license = "AGPL-3.0-or-later"
[tool.poetry.dependencies]
python = "^3.6"
django-localflavor = "^2.1"
freezegun = "^0.3.11"
bleach = "^3.1"
django-tinymce4-lite = "^1.7"
rcssmin = "^1.0"
djangorestframework = "^3.9"
django-ical = "^1.5"
django-libsass = "^0.7.0"
django-cors-headers = "^2.4"
python-magic = "^0.4.15"
redis = "^3.2"
Django = "^2.1"
Pillow = "^5.4"
django_compressor = "^2.2"
psycopg2-binary = "^2.7"
bcrypt = "^3.1"
argon2_cffi = "^19.1"
uWSGI = "^2.0"
django-bootstrap4 = "^0.0.7"
firebase-admin = "^2.15"
sentry-sdk = "^0.7.3"
django-sendfile2 = "^0.4.2"
# docs requirements
recommonmark = { version = "^0.5.0", optional = true }
sphinx = { version = "^1.8", optional = true }
[tool.poetry.extras]
docs = ["recommonmark", "sphinx"]
[tool.poetry.dev-dependencies]
django-template-check = "^0.3.1"
flake8 = "^3.7"
pydenticon = "^0.3.1"
pylint = "^2.2"
pylint-django = "^2.0"
Faker = "^1.0"
factory_boy = "^2.11"
coverage = "^4.5"
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
[tox]
envlist = flake8, {py36,py37}-django21
skipsdist = True
skip_missing_interpreters = True
[testenv]
changedir={toxinidir}/website
commands =
; Copy the env list to make not conflict with the Django version
; specified below
pipenv --bare install --dev --ignore-pipfile
; override using pip. Using pipenv would write to Pipfile!
django21: pip install --pre 'django>=2.1rc1,<2.2'
pipenv --bare run python manage.py check
pipenv --bare run python manage.py templatecheck --project-only
pipenv --bare run python manage.py makemigrations --no-input --check --dry-run
pipenv --bare run python -Wall -mcoverage run --branch --source '.' manage.py test
pipenv --bare check
deps =
pipenv
passenv =
GITLAB_CI
PIP_CACHE_DIR
env =
PIPENV_SUPPRESS_NESTED_WARNING=1
[testenv:flake8]
basepython=python3.6
deps= flake8
skip_install=True
commands=
flake8 .
passenv =
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