home.social

#virtualenv — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #virtualenv, aggregated by home.social.

  1. The state of #security these days: #Python #virtualenv package now includes SHA256 sums of their bundled wheels, declaring that it protects against "supply-chain compromise". Because obviously there are so many attack vectors that permit you to alter a .whl file but not the .py file in the same directory.

    No, I'm not saying verifying checksum makes no sense, because indeed it can save some pain if fs is damaged somehow. However, calling this a "security" feature is a misnomer at best, and openly giving people false sense of security at worst.

  2. От Dependency Hell до изоляции: эволюция и внутреннее устройство виртуальных сред в Python

    До 2007 года установка двух версий одной библиотеки на одном сервере была невозможной миссией. Появление virtualenv, а затем и нативного venv, изменило ландшафт Python-разработки навсегда. Но как именно работает этот механизм на уровне операционной системы и интерпретатора? Разбираем путь от копирования бинарников до современных симлинков, анализируем роль sys.path и реализуем собственный аналог venv.

    habr.com/ru/articles/1013512/

    #python #virtualenv #poetry #pip #venv

  3. Thanks to @adamw, who dared to suggest we try it, we now have a small patch for #virtualenv in #Fedora to enable creation of #Python 3.6 virtual environments.

    Hence, you can use #tox to test your code on Python 3.6 to 3.15, without the need for nasty hacks -- github.com/tox-dev/tox/issues/

    Supporting testing on 3.6 is important to us, as many developers targeting #RHEL 8 still need to support it. (Python 3.6 is the new Python 2.6.)

    Anyway, test it out:
    bodhi.fedoraproject.org/update
    bodhi.fedoraproject.org/update

  4. I kind of irrationally #CodeGolf my #Makefile rules, but sometimes I sit down to straighten out something awkward that bugged me for years, and get kind of mad when I seem to have been the first to actually treat `make` like the tool it is instead of as a broken shell script runner.

    This time it was #Python #VirtualEnv setup:

    ```
    dep: .venv/bin/pip .venv/lib/*/site-packages/__pycache__

    .venv/lib/%/site-packages/__pycache__: .venv/bin/pip requirements.txt
    .venv/bin/pip install -Ur requirements.txt

    %/bin/pip:
    /usr/bin/virtualenv $*
    ```

    (Yeah pretend those are tabs. Yeah that is make's worst wart.)

    I even use `!#.venv/bin/python3` in my scripts and hey presto everything just works everywhere and I can focus on the actual code.

    I'm curious what cases I'm ignoring or missing here. Non-install upgrades may deserve a target perhaps...

  5. I kind of irrationally #CodeGolf my #Makefile rules, but sometimes I sit down to straighten out something awkward that bugged me for years, and get kind of mad when I seem to have been the first to actually treat `make` like the tool it is instead of as a broken shell script runner.

    This time it was #Python #VirtualEnv setup:

    ```
    dep: .venv/bin/pip .venv/lib/*/site-packages/__pycache__

    .venv/lib/%/site-packages/__pycache__: .venv/bin/pip requirements.txt
    .venv/bin/pip install -Ur requirements.txt

    %/bin/pip:
    /usr/bin/virtualenv $*
    ```

    (Yeah pretend those are tabs. Yeah that is make's worst wart.)

    I even use `!#.venv/bin/python3` in my scripts and hey presto everything just works everywhere and I can focus on the actual code.

    I'm curious what cases I'm ignoring or missing here. Non-install upgrades may deserve a target perhaps...

  6. I kind of irrationally #CodeGolf my #Makefile rules, but sometimes I sit down to straighten out something awkward that bugged me for years, and get kind of mad when I seem to have been the first to actually treat `make` like the tool it is instead of as a broken shell script runner.

    This time it was #Python #VirtualEnv setup:

    ```
    dep: .venv/bin/pip .venv/lib/*/site-packages/__pycache__

    .venv/lib/%/site-packages/__pycache__: .venv/bin/pip requirements.txt
    .venv/bin/pip install -Ur requirements.txt

    %/bin/pip:
    /usr/bin/virtualenv $*
    ```

    (Yeah pretend those are tabs. Yeah that is make's worst wart.)

    I even use `!#.venv/bin/python3` in my scripts and hey presto everything just works everywhere and I can focus on the actual code.

    I'm curious what cases I'm ignoring or missing here. Non-install upgrades may deserve a target perhaps...

  7. I kind of irrationally #CodeGolf my #Makefile rules, but sometimes I sit down to straighten out something awkward that bugged me for years, and get kind of mad when I seem to have been the first to actually treat `make` like the tool it is instead of as a broken shell script runner.

    This time it was #Python #VirtualEnv setup:

    ```
    dep: .venv/bin/pip .venv/lib/*/site-packages/__pycache__

    .venv/lib/%/site-packages/__pycache__: .venv/bin/pip requirements.txt
    .venv/bin/pip install -Ur requirements.txt

    %/bin/pip:
    /usr/bin/virtualenv $*
    ```

    (Yeah pretend those are tabs. Yeah that is make's worst wart.)

    I even use `!#.venv/bin/python3` in my scripts and hey presto everything just works everywhere and I can focus on the actual code.

    I'm curious what cases I'm ignoring or missing here. Non-install upgrades may deserve a target perhaps...

  8. I kind of irrationally #CodeGolf my #Makefile rules, but sometimes I sit down to straighten out something awkward that bugged me for years, and get kind of mad when I seem to have been the first to actually treat `make` like the tool it is instead of as a broken shell script runner.

    This time it was #Python #VirtualEnv setup:

    ```
    dep: .venv/bin/pip .venv/lib/*/site-packages/__pycache__

    .venv/lib/%/site-packages/__pycache__: .venv/bin/pip requirements.txt
    .venv/bin/pip install -Ur requirements.txt

    %/bin/pip:
    /usr/bin/virtualenv $*
    ```

    (Yeah pretend those are tabs. Yeah that is make's worst wart.)

    I even use `!#.venv/bin/python3` in my scripts and hey presto everything just works everywhere and I can focus on the actual code.

    I'm curious what cases I'm ignoring or missing here. Non-install upgrades may deserve a target perhaps...

  9. Holy fuck! I know I’m late to the game but uv is amazing! A single binary for managing python deps, envs and even python versions! Nice to see it’s been written in rust too! And it’s really fast! docs.astral.sh/uv/ #rustlang #python #virtualenv #pip

  10. If I had the time and energy I would:

    • Make a #ThonnyIDE plug-in to launch #JupyterLab from the Thonny GUI interface (using Thonny's #Python #virtualenv;
    • Write some code to convert #geoDataFrames with a graphic attributes column into #py5 styled shapes;
    • Make a search interface to my daily sketch-a-day sketches and fix the RSS.
  11. My final boss in solving this #Django on #Alpine container thing is getting #Apache/#WSGI (mod_wsgi) working. My container runs Apache fine, I suppose, if I don't supply it any site config - but once I do (i.e. in /etc/apache2/conf.d), I'm getting Segmentation fault core dumped errors and reboots.

    I'm assuming, as far as my config goes, I need to point
    python-home to where my #virtualenv is, in addition to python-path to where my Django site/app is (like I do on #Ubuntu since that does not enforce the use of venv yet). But that doesn't seem to be enough, so again, in addition to apache2, apache2-mod-wsgi, and apache2-utils (and perhaps musl-dev and gcc in runtime other than just during build), what am I missing?

  12. 671 - Descubre la herramienta que cambiará como usas Python

    #uv es la herramienta perfecta para gestionar proyectos y dependencias de #python y que viene a sustituir a #pip #poetry #pyenv #virtualenv y otras

    Como ya te he comentado en mas de una ocasión, la llegada de Rust, está suponiendo una auténtica revolución. Los desarrolladores apoyados en Rust se ha

    youtube.com/watch?v=Jb-9QII_E1Y

    #atareaoConLinux #podcastesp

  13. 671 - Descubre la herramienta que cambiará como usas Python

    #uv es la herramienta perfecta para gestionar proyectos y dependencias de #python y que viene a sustituir a #pip #poetry #pyenv #virtualenv y otras

    Como ya te he comentado en mas de una ocasión, la llegada de Rust, está suponiendo una auténtica revolución. Los desarrolladores apoyados en Rust se ha

    youtube.com/watch?v=Jb-9QII_E1Y

    #atareaoConLinux #podcastesp

  14. Hey #Fedi, can you help me with a #Python environment pain-point?

    TL;DR : I want global #virtualenv management

    I've been using virtual environments for quite some time, but I might be missing some standard feature because switching env is a pain: I have to be in the right folder (where the venv dir was created) or manually configure a shell script.
    Is there a tool that can provide me with the equivalent of ``envswitch envname`` regardless of the folder I'm in?

    #venv #poetry #pipenv #askFedi

  15. After programming a good 2 months in #python finally found the tool #poetry which is quite similar to how #nodejs bundles libraries into a directory either locally or globally in the cache directory.

    I have tried the other tools from #pyenv to #venv and/or #virtualenv. Where I thought they were used to deal with library dependency management only to realize that they are more like #nvm.

    I did use #conda for some time, though preferred a python only solution. I do realize that poetry won't resolve all issues and might need to look into to containerization later on, though for the time period it looks like a good solution.

  16. Using pyenv and pyenv-virtualenv to install Python and create a virtual environment on MacOS andreagrandi.it/posts/install-

    I keep referring to this blog post of mine a lot. I'm glad I took some time to note all my process so I can reuse it int he future (and hopefully it's useful for other people too)

    #Python #pyenv #virtualenv

  17. @forse

    Can you try installing it with `pipx` instead?

    pipx will create a Python virtualenv just for that program, and install all of its dependencies into that virtual environment. It can then run independently of any system-level versions of those same packages that are installed *for the distro-shipped Python tools*.

    The version pipx installs can be upgraded (or left alone) completely independently of OS updates.

    #pip #pipx #virtualenv

  18. Just tried the #uv #Python management tool. At first I thought: Oh no, not another Python package manager. But this one seems different. It combines all the pip-tools, #pyenv, #poetry, #virtualenv, etc in one.
    And it's damn fast. This likely will stay with me for a while.

    docs.astral.sh/uv/

  19. I'm trying to use mypy inside tox with tox-uv, but mypy's --install-types flag hardcodes the usage of pip. When you're using tox-uv, pip is no longer installed in the environment because uv does the heavy lifting with `uv pip install` as a faster alternative to `pip install`

    Here's my attempt at making mypy more configurable so it can install types using uv:

    github.com/python/mypy/compare

    #python #packaging #typing #uv #mypy #tox #virtualenv

  20. @samuel

    Why is Python special in this regard? Many applications, whether written in Python, Perl, Ruby, or C etc, embed a particular version of a library because they either can't rely on it being available system-wide, or because they can't rely on the system-provided one being completely #compatible with their needs.

    I find virtual environments an elegant solution to the problem, better than many other languages' solutions.

    #library #embed #vendor #venv #virtualenv

  21. « Do not try and use a Python virtual environment from one Python installation or version with mod_wsgi, when mod_wsgi was compiled for a different one. »
    modwsgi.readthedocs.io/en/deve

    C'est génial #virtualenv avec #Python, mais #mod_wsgi te remet direct les pieds sur terre.

  22. I'm looking for advice on the best way to install Python on a new MacBook Pro 🍎

    On my Dell XPS 13 with Ubuntu 24.04 the time to install Python and start programming is literally 0 seconds, since it is pre-installed 🐧

    I would like to avoid bloatware (eg: Xcode or similar), Docker (at least for now) or GUI, unless absolutely necessary to create a virtualenv in the terminal and start programming with Django (if it's possible) 🐍

    Less is more ✨

  23. @archiloque Mind you, I had the exact same feeling while trying to install #woob on #ubuntu. I failed in a trap lying between #venv and #virtualenv

  24. 0.2.15 is out and includes a new tool that I’ve wanted for so long: `uv pip tree` displays the whole dependency tree in your current virtualenv !

    pypi.org/project/deptree/ Already implemented this but it's much more convenient to have a version of this tool that doesn’t actively “pollute" the environment it’s meant to display.

    kudos to @charliermarsh and team 🎉

    github.com/astral-sh/uv/releas

  25. So I just asked #ChatGPT to:

    1) Give me script that mass renames keys in my #firebase database.
    2) Tell me how to obtain & setup firebase credential keys.
    3) Tell me how to install necessary #python libraries (language of said script) and set #virtualenv.
    4) Resolve series of issues with my python environment by simply copy & pasting terminal errors and progressing further on each step.

    Outcomes:
    - I managed to get the outcome I wanted in fraction of the time I would have to invest otherwise.
    - I might have not learned the details about the intricacies of python environment setup, but frankly I can't care less about this geeky stuff.
    - I can move on with my life and not a single white hair was harmed in the process.

  26. W końcu to zrobiłem.

    Trzy lata po otwarciu zgłoszenia, dwa lata po utworzeniu odrębnych paczek "ensurepip" w #Gentoo (używanych przez wbudowany w Pythona moduł venv), w końcu przerobiłem #VirtualEnv, by używało naszych paczek wheel zamiast swojej własnej kopii.

    Co najważniejsze, oznacza to, że VirtualEnv będzie domyślnie używał najnowszych wersji pip, setuptools i wheel, które są dostępne w Gentoo, a my nie będziemy już musieli martwić się kolejną warstwą pośrednią, która instaluje swoje własne wersje paczek, z potecjalnymi dziurami bezpieczeństwa.

    Tyle że w tej chwili VirtualEnv na Gentoo używa starszych wersji pip i setuptools niż normalnie, bo ostatnie wydania były nieudane.

    gitweb.gentoo.org/repo/gentoo.
    bugs.gentoo.org/807643

    #Python

  27. I finally did it.

    Three years after filing the bug, two years after introducing separate "ensurepip" wheel packages in #Gentoo (used by the built-in venv module in #Python), I've finally patched #VirtualEnv to use these wheels instead of their own bundle.

    Most importantly, this means that VirtualEnv will now use the latest version of pip, setuptools and wheel packages found in Gentoo, and we are no longer going to have to worry about another layer of indirection bundling vulnerable packages.

    That said, since the recent releases of pip and setuptools were broken, this also means that VirtualEnv on Gentoo now uses older versions than normally.

    gitweb.gentoo.org/repo/gentoo.
    bugs.gentoo.org/807643

  28. @Tiim

    For Ubuntu, the deadsnakes repo can be used to install a bunch of other versions, or the pyenv tool can do it. There are other ways too.

    Then, get used to using virtual environments for development (so you're not installing your project's dependencies globally, and you can't get conflicts).

    For installing 3rd-party tools not in your OS, i.e. you're not hacking them, just using them, use `#pipx install --python python3.11 <pypi-name>`. pipx is in the system repos.

    2/2

    #virtualenv

  29. I guess I'll learn how to use and use Python 3.9? (or should I use ? ? ? ? ? Why are there so many of these things??)

  30. is yet another project that "optimizes" its test suite by using time-machine. Since time-machine works on CPython only, it also keeps supporting but you are allowed to use it on PyPy only now.

    I really do wonder if this "optimization" actually makes anything faster, and if it outweighs the added complexity. The complexity also falls on downstreams ().

    But that's modern development for you! "Shiny! Must have it!"

    github.com/pypa/virtualenv/com

  31. Hello, #python folks! Anyone run into trouble trying to deploy #pycairo or #cairosvg into a #pipenv #virtualenv? Mine fail to find #libcairo2, despite it being available on the system. (I run an OLD MacOs, with python 3.9 and other tools installed using #fink).

  32. Hello, #python folks! Anyone run into trouble trying to deploy #pycairo or #cairosvg into a #pipenv #virtualenv? Mine fail to find #libcairo2, despite it being available on the system. (I run an OLD MacOs, with python 3.9 and other tools installed using #fink).

  33. Hello, #python folks! Anyone run into trouble trying to deploy #pycairo or #cairosvg into a #pipenv #virtualenv? Mine fail to find #libcairo2, despite it being available on the system. (I run an OLD MacOs, with python 3.9 and other tools installed using #fink).