Closed tomaz-suller closed 1 year ago
Now sure what you're asking of me here. The packaging provided by this template should work in any environment than works with source or wheel distributions, and that includes virtualenvs.
Clarify what this means:
During set up, this template installs Python packages through pip to the Python user install directory
What "set up"?
What I meant to suggest was adding the option to set up a virtual environment after executing cookiecutter ...
. Something like
1 - no
2 - yes
Install dependencies inside venv? [1]:
By selecting option 1, everything would happen as right now. By selecting option 2 though a virtual environment would be created inside the rendered template, and it would then be sourced so tox
and other template dependencies were installed in the venv.
I thought this would be a good feature since I wasn't expecting installing a library to my user as a side effect of cloning a cookiecutter template, and because some users prefer installing packages using pip only on virtual environments.
Adding this would involve adding the option to the cookiecutter
menu and then modifying this part of the post-gen hook
https://github.com/ionelmc/cookiecutter-pylibrary/blob/2b2d9db441d9ad7a43c58b61492fb40fd6f2f8c1/hooks/post_gen_project.py#L135-L141
if this is a use case this template wants to support of course.
Implementing it should be straightforward, except perhaps for supporting the different shells and their different ways of activating the venv.
I don't think this is a widely accepted workflow. I am using pipx to install tooling (including tox) ... and all this seems very crummy and will create support work for me, something I want to avoid especially when it's not my daily workflow.
During set up, this template installs Python packages through
pip
to the Python user install directory and does not provide an option to install them on a virtual environment. There are users (like myself) who generally want to keep their packages either to the system package manager or to virtual environments and avoid installing withpip
directly, so I'd like to ask if support for virtual environments has been considered and could be added.With Python standard library
venv
on Python 3.3+, it would be possible to add virutal environments with no additional dependencies, and it seems to me the only necesary modifications would be sourcing the environment during set up (which admittedly can be tricky due to the use of different shells) and modifying the.gitignore
and linter config files to ignore the virtual environment. Sourcing the environment whenever the user accesses the repo would be their responsibility after that.