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

[Feat] Automated Development Environment with Docker Volumes #2760

Closed
2 tasks done
bergkvist opened this issue Aug 1, 2020 · 3 comments
Closed
2 tasks done

[Feat] Automated Development Environment with Docker Volumes #2760

bergkvist opened this issue Aug 1, 2020 · 3 comments
Labels
kind/feature Feature requests/implementations

Comments

@bergkvist
Copy link

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Feature Request

Ability to poetry install/pip install -e . on an (empty) folder during docker build.

The Docker image will have all project dependencies preinstalled with the correct versions - but does not yet know anything about the source code of the library - as this will be mounted when the container is started up.

Motivation

I want a new developer to be able to start changing Python-code, without having to know anything about poetry. The only manual step involved should be a docker-compose up. Having to run poetry install every time the container starts up feels repetitive, slow - and unneccesary. Dependencies don't change very often compared to source code.

Problem

poetry install right now seems to be "imperative"/"eager" (initially anyways). I would love if there was some "declarative"/"lazy" alternative, or something that could be done in advance, which would not need to have the source code available.

A key to this is that I'm personally responsible for ensuring that dependencies are available. I'm also using poetry config virtualenvs.create false inside the docker containers.

It is important to me that I don't include the source code itself in the docker image - so that the docker image can be shared without also sharing the source code.

Workflow

JupyterLab (custom prebuilt Docker image)

# JupyterLab: autoreloads allow for changing code and immediately playing around with it
# without restarting the IPython kernel.
%load_ext autoreload
%autoreload 2
# I don't want to have to run poetry install manually for this to work.
import myproject

VSCode (for editing code in shared docker volume)

I want to be able to edit my code here, and have tests rerun automatically. The latest version will immediately/auomatically become available in the JupyterLab container.

Automatic testing/test reporting container

This container will be responsible for automatically rerunning tests whenever files change. The test results will be exposed through an html test reporter and livereload.

@bergkvist bergkvist added kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels Aug 1, 2020
@abn
Copy link
Member

abn commented Aug 1, 2020

@bergkvist is there any reason that you cannot do a poetry install --no-root during build with pyproject.toml added in order to cache a layer with dependencies (default venv config should be good here, and probably better in most cases) and trigger poetry install on run via an entrypoint perhaps? As long as the poetry.lock or pyproject.toml do not change, the install should be quick and its a good idea since it will cover any include changes etc.

@bergkvist
Copy link
Author

bergkvist commented Aug 12, 2020

Yeah, thanks - I'm now using the following for my jupyter notebook setup (docker-compose) - in case anyone else faces the same problem:

command: "sh -c \"( cd /home/jovyan/myproject && poetry install ) && start-notebook.sh --ip 0.0.0.0 --no-browser\""

@abn abn removed the status/triage This issue needs to be triaged label Sep 25, 2020
Copy link

github-actions bot commented Mar 3, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature Feature requests/implementations
Projects
None yet
Development

No branches or pull requests

2 participants