home.social

#virtualenv — Public Fediverse posts

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

fetched live
  1. quicktipp #117: Bootstrapping a portable Python bundle on MS Windows using the `pywinbundle` tool.

    github.com/christian-korneck/p

    A bundle is a bit like a venv, but self-contained and can get moved/renamed to any path or copied to any Windows machine. The bundle will continue to work, even if there is no existing Python installation.

    #python #windows #pip #venv #virtualenv #uv #jupyter #pypi

  2. quicktipp #117: Bootstrapping a portable Python bundle on MS Windows using the `pywinbundle` tool.

    github.com/christian-korneck/p

    A bundle is a bit like a venv, but self-contained and can get moved/renamed to any path or copied to any Windows machine. The bundle will continue to work, even if there is no existing Python installation.

    #python #windows #pip #venv #virtualenv #uv #jupyter #pypi

  3. 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.

  4. 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.

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

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

    habr.com/ru/articles/1013512/

    #python #virtualenv #poetry #pip #venv

  6. 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

  7. 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

  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. 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...

  10. 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

  11. 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.
  12. 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.
  13. 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?

  14. 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?

  15. 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

  16. 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

  17. 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

  18. 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

  19. 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.

  20. 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.

  21. 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

  22. 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

  23. @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

  24. @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

  25. 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/

  26. 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/

  27. 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

  28. 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

  29. @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

  30. @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

  31. « 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.

  32. 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 ✨

  33. 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 ✨

    #Python #VirtualEnv #macOS #BestPractise #Olivetti

  34. @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

  35. @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

  36. 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

  37. 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.

  38. 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

  39. Made this niche public service announcement, please enjoy
    #conda #virtualenv

  40. @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

  41. After getting yet another bug report about #Python package (this time #VirtualEnv) failing to build, because the user did not have new enough #TroveClassifiers installed, I've filed a bug asking #Hatchling to make trove classifier validation either optional or non-fatal.

    Right now this simply is not feasible. Technically, every package would need to specify a *minimal* `trove-classifiers` package dependency based on the classifiers they used, and we would have to keep these versions in every #Gentoo ebuild. However, that's unlikely to ever happen, so we'd actually have to check all listed trove classifiers and map them back to package versions. Or, more realistically, just always depend on the newest trove-classifiers available and hope we don't forget to update the dependency.

    github.com/pypa/hatch/issues/1
    bugs.gentoo.org/928447

    #PEP517 #packaging