Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker dev env #966

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ python -X tracemalloc -m unittest -f src/test/test_*
python -X tracemalloc -m unittest -f src/test/test_runner.py
```

To run tests in a dedicated container, see `dev/README.md`.

## Codestyle

Popper's code is formatted using the [black](https://github.com/psf/black) style. If code does not conform to this style, merges are prevented to the master and this is checked as a CI step.
Expand Down
1 change: 1 addition & 0 deletions dev/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
venv
6 changes: 6 additions & 0 deletions dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM python:3.8-buster

RUN pip install --upgrade pip
# black==19.10b0 is the version used in GitHub
RUN pip install setuptools setuptools_rust virtualenv black==19.10b0

20 changes: 20 additions & 0 deletions dev/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Development environment

The following steps should be executed from within the folder `dev`.

To test popper, build the `popper-dev` image and prepare the folder to hold the venv
```
docker-compose build popper-dev
mkdir venv
```
then start the container and install deps into the venv
```
docker-compose run --rm popper-dev
# now you're insided the container
python -m virtualenv /venv
source /venv/bin/activate
pip install -e src/
```
From here on, you can always return to the container without having to re-install the venv.
However, don't forget to activate the venv after entering the container.
(The container is temporary and will be removed after you leave, so activate the venv each time.)
15 changes: 15 additions & 0 deletions dev/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: '3.7'
services:
popper-dev:
image: popper-dev
container_name: popper-dev
stdin_open: true # docker run -i
tty: true # docker run -t
build:
context: .
command:
- bash
volumes:
- ${PWD}/..:/workspace
- ${PWD}/venv:/venv
working_dir: /workspace
2 changes: 2 additions & 0 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,7 @@ the above approach you have both (1) popper installed in your machine
and (2) an environment where you can modify popper and test the
results of such modifications.

To create a containerized development environment, e.g. for running tests, see `dev/README.md`.

[venv]: https://virtualenv.pypa.io/en/latest/
[venv-install]: https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/#installing-virtualenv
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[tool.black]
exclude='''
/dev
'''