# - docker build -t $IMAGE_TAG ci/devenv
# - docker push $IMAGE_TAG
-# FIXME - use custom Docker image, so that we don't rebuild it all every single time
+
+# agressively cache Poetry's and NPM's data
+cache:
+ key: "always-the-same-cache"
+ paths:
+ - node_modules/
+ - .venv/
+ policy: pull-push
+
lint:
stage: check
-
- cache:
- key: "check:always-the-same-cache"
- paths:
- - node_modules/
- policy: pull-push
script:
# run the actual tests
- poetry env use $(pyenv which python)
Because we want to support multiple versions of Python with one codebase, we develop against the oldest supported version and then check in our CI that it works for newer Python versions.
Install these tools:
-* [pyenv](https://github.com/pyenv/pyenv#installation)
-* [Poetry](https://python-poetry.org/docs/#installation)
+* [pyenv](https://github.com/pyenv/pyenv#installation) (can be installed using distro's package manager)
+* [Poetry](https://python-poetry.org/docs/#installation) (Note: do not install the package via pip, follow instructions in Poetry's official documentation)
* [Yarn](https://yarnpkg.com/) (See FAQ for why do we need JS in Python project) or NPM
Be careful, that you need the latest version of Poetry. The setup was tested with Poetry version 1.1.4. Due to it's ability to switch between Python versions, it has to be installed separately to work correctly. Make sure to follow [the latest setup guide](https://python-poetry.org/docs/#installation).
* [pyre](https://pyre-check.org/) - supports type inference, contains security focused static analysis tool, written in Python, does not work in Python 3.6
* [pyright](https://github.com/Microsoft/pyright) - not that advanced as pyre and pytype, reports correct code as broken, basic type inference when no typehints are provided, written in TypeScript, great integration with VSCode, works regardless of current Python version
-Type inference is really handy when it comes to libraries without type hints or when you use internal functions without specifiing their types. This is why we use pyright instead of the more classical approach with mypy.
\ No newline at end of file
+Type inference is really handy when it comes to libraries without type hints or when you use internal functions without specifiing their types. This is why we use pyright instead of the more classical approach with mypy.
ENV PATH="/home/user/.poetry/bin:$PATH"
# force Poetry to run under python3
RUN sed -i 's/env python/env python3/' .poetry/bin/poetry
+# force Poetry to use local .venv/ directory that we can cache
+ENV POETRY_VIRTUALENVS_IN_PROJECT=true
+
+
+# install additional project dependencies
+USER root
+RUN apt-get update && apt-get install --no-install-recommends --no-install-suggests -y libcairo2-dev libglib2.0-0 libgirepository1.0-dev
+USER user