cookiecutter-hypermodern-python icon indicating copy to clipboard operation
cookiecutter-hypermodern-python copied to clipboard

[Feature Request] Setup the environment and poetry to work with Docker

Open Mithrandir2k18 opened this issue 3 years ago • 4 comments

I really like this template and have been using it for a while, but it seems to have one critical blindspot: Supporting and switching between multiple python versions. Sure it's possible to kind of slap on pyenv and work with that, but I personally have found these external python-version management systems(like pyenv and anaconda) kind of cludgy, especially when it comes to cleaning up after moving to a different project.

Docker on the other hand makes that super-simple. Even if you don't cleanly specify to delete all intermediate containers, one can always do docker system prune and all cleanup should be done. I don't think I have to list all benefits of using Docker during development here.

I have however struggled to setup docker in combination with poetry, let alone adding debugging in VSCode. Poetry also doesn't seem to have documentation about it.

Would it be possible to add Docker support (as an option)?

Mithrandir2k18 avatar May 23 '22 12:05 Mithrandir2k18

Before you add a Dockerfile you might wanna read this https://luis-sena.medium.com/creating-the-perfect-python-dockerfile-51bdec41f1c8

Coinhexa avatar Jun 30 '22 06:06 Coinhexa

@Coinhexa I'd much rather be able to develop, run and test my code in the dockerfile(s) that I plan to ship or push for automated tests, not have another extra "one size fits all" image to carry around and maintain. My pre-poetry workflow, was (similar to) just having a package-list.txt to install system packages and a normal requirements.txt for python in my project and build a fresh docker image with those. For development I just use the VSCode docker extension.

In any case, docker seems like a weird exclusion here.

Mithrandir2k18 avatar Sep 30 '22 16:09 Mithrandir2k18

Not sure if this should be attached to this issue or have a separate one created, please let me know.

I don't mind using pyenv for multiple python versions, but I have found it challenging to ensure the system dependencies are all in place to support it, either for myself on a new machine or for another person I'm trying to help onboard.

To address this I've been working on building a dev container spec that will have everything in place to start using this template. You'd still be using pyenv within the project, but I think it would address the above concern about nicely cleaning up your environment, as well as my issue of reliably creating the environment to begin with.

If there's broader interest in this approach I'm happy to contribute to getting the dev container spec added to this template.

ianepreston avatar Nov 28 '22 17:11 ianepreston