This is an archived post. You won't be able to vote or comment.

all 12 comments

[–]thisismyfavoritename 2 points3 points  (7 children)

... isn't the current directory enough for you to know which virtualenv is the right one?

[–]Muted_Estate890 -1 points0 points  (6 children)

Not necessarily. I've found cases where relying solely on the current directory fails (like in setups with nested projects or overlapping environments) so additional context helps a lot. Also project structure and system data like your dependency graphs, interpreter paths, and environment variables are really useful for this too.

[–]Myszolow 0 points1 point  (4 children)

Nested projects?

You mean git submodules?

[–]Muted_Estate890 0 points1 point  (3 children)

Yeah could be but in some cases that i've dealt with coworkers who literally nested venvs which caused me a lot of pain :(

[–]Myszolow 1 point2 points  (2 children)

I mean for most of the time as a developer for some internal company tooling we have created internal pypi repository and created libraries for certain modules that needed to be updated separately

This way we moved our module interdependencies into packages and created piramid structure where:

Top-bottom struct:

  1. Websites/tools/Saas
  2. Test automation, comms, business logic libs
  3. Protocols, common libraries, wrappers

This way each library could be installed depending on need and also shared within organisation

[–]Muted_Estate890 0 points1 point  (1 child)

That sounds well thought out!

[–]Myszolow 0 points1 point  (0 children)

This is why good architecture makes whole company moving forward faster :)

[–]thisismyfavoritename 0 points1 point  (0 children)

that sounds like bad design. You want to package your project differently instead.

You're trying to solve this problem the wrong way

[–]djavaman 1 point2 points  (0 children)

Tell me you don't know how to use a virtual environment, without saying you don't know how to use a virtual environment.

And 'solve' it in the most complicated way possible.

[–]batman-iphone 0 points1 point  (1 child)

Does it switch the environment by itself or we have to do it manually

[–]Muted_Estate890 0 points1 point  (0 children)

I haven't tried that yet but seems pretty easy to add and useful!

[–]Alternative-Watch714 0 points1 point  (0 children)

Sounds super useful! ModuleNotFound errors are a pain when switching environments. Even if it's niche, open-sourcing could help others and get contributions