Re:Learning Go as a Python Developer: The Good and the Bad
by linsomniac on Monday July 18, 2022 @05:53PM
(#32144423)
"Vendoring" means including the library in your package. So instead of listing it in requirements.txt, you copy the code of the library.
Re:Learning Go as a Python Developer: The Good and the Bad
by giantrobot on Monday July 18, 2022 @07:32PM
(#32145521)
You can get that by bundling up your venv. When you install a package is a venv it installs it into that venv rather than the system. As far as the venv is concerned it is the system Python. Unfortunately passing around a venv can be problematic, say between Mac and Linux or between different architectures when binaries are involved.
Re:Learning Go as a Python Developer: The Good and the Bad
by KptMarchewa on Monday July 18, 2022 @08:48PM
(#32146062)
>- python -m venv .venv
>- source .venv/bin/activate
If those two steps were automatic like in node.js we'd literally have 99% less problems.
Re:Learning Go as a Python Developer: The Good and the Bad
by jeremydw on Monday July 18, 2022 @07:43PM
(#32145604)
Sounds like someone has never been asked to clone and run software targeting Python 3.x when their system-installed Python is 3.y and the two are incompatible.
Re:Learning Go as a Python Developer: The Good and the Bad
by Spivak on Monday July 18, 2022 @08:27PM
(#32145912)
Then you use pyenv and pyenv virtualenv.
pyenv install 3.9.47
pyenv virtualenv 3.9.47 my app
git clone …/myapp
cd …/myapp
pyenv local myapp
pip install -r requirements.txt
Is it annoying, maybe, but I normally don’t trust system deps for anything.
- Pip freeze just pins all dependencies at once to requirements.txt
- I don't know what "vendoring in dependency code" means
- I've never used pipreqs in my life (and 80% of my work has been in Python)
- Virtualenvs are just a convenient way to keep project runtimes separated
And for 90% of Python projects in existence the following is sufficient (assuming Python3 is installed):
- python -m venv .venv
- source .venv/bin/activate
- pip install -r requirements.txt
That's it. And all of that requires a single dependency: Python. Could it be better? Sure. But to call that a "mess" is an exaggeration.