• @infeeeee@lemm.ee
    link
    fedilink
    14
    edit-2
    3 years ago

    My workflow:

    cd project
    python -m venv .venv
    . ./.venv/bin/activate
    pip install -e .
    

    By default pyvenv excludes system packages, so I can have different versions in the venv. To reset the venv, I just have to delete the .venv dir.

      • @solidsnail@programming.dev
        link
        fedilink
        43 years ago

        I don’t think he does. If you’re talking about the third line, there’s a space between the dots.

        The dot command is equivalent to source (running the script in the context of the current shell).

      • stOneskull
        link
        fedilink
        23 years ago

        i’ve moved to just using conda environments. i find it’s a lighter load on my old brain.

      • @infeeeee@lemm.ee
        link
        fedilink
        23 years ago

        I love this workflow because it has only two prerequisites: python and pip. It works on windows, linux, any vm or container. Pipenv requires some setup, while this should work everywhere. In powershell you have to use ./.venv/bin/acticate.ps1 but that’s the only difference.

      • @Mikina@programming.dev
        link
        fedilink
        13 years ago

        What did you not like on pipenv in comparison to venv? I was always avoiding venv because it was, as you said, manual work and it was too much effort to again google what was the order of commands and parameters to start a venv, which is not an issue in pipenv, since you just pipenv install what you need.

          • @Mikina@programming.dev
            link
            fedilink
            13 years ago

            I only use python as a go-to scripting language when I need to quickly automate something or write a quick throwaway script that requires an SDK, since there’s a python library for almost anything and doing it in powershell would be too much aditional work. But it does make sense that for CI you only need to figure out the venv setup once and you’re done, so it may be a better solution.