question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

add option to sandbox package and its dependencies (like pipsi)

See original GitHub issue

What’s the problem this feature will solve?

When installing packages that have console entry_points and should be globally accessible (such as black), the only way to do this is to have all packages share the same dependencies.

The problems with this are

1.) packages may have conflicting dependencies 2.) even if there are no conflicts, installing packages globally mixes user installed packages with eachother and with system installed packages. This makes it difficult to know which packages rely on which; pip freeze gets very large. 3.) Isolating packages requires virtual envs which has a somewhat high learning curve, and also requires activation/deactivation, and remembering the name of each virtual env.

Describe the solution you’d like

Add a new flag to pip install such that the installation works like pipsi.

pipsi creates a virtual environment for each top-level package, and installs dependencies to the site-packages within the package’s virtual environment.

pipsi installs each package into ~/.local/venvs/PKGNAME and then symlinks all new scripts into ~/.local/bin

Compared to pip install --user each PKGNAME is installed into its own virtualenv, so you don’t have to worry about different PKGNAMEs having conflicting dependencies.

Ideas for flag names. Only one of these would be chosen.

  • pip install PKGNAME --isolate
  • pip install PKGNAME --shield
  • pip install PKGNAME --auto-venv
  • pip install PKGNAME --into-venv
  • pip install PKGNAME --venv
  • pip install PKGNAME --virtual

Alternative Solutions

Additional context

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
pfmoorecommented, May 24, 2018

@cs01 Thanks for the clarification - I’d assumed you meant virtualenv style rather than --target, so now that I understand what you were after, I see your point better.

I think what you’re suggesting could probably be done with a relatively small wrapper script round pip. That script could run pip (via subprocess), then change the necessary environment variables and run the entry point (again via subprocess). You could make such a thing as specific or generic as you felt necessary.

In fact, I think the rwt (“run with this”) package on PyPI may be of interest to you. As I understand it, it does something very like this.

I still think it’s something we’d rather not make “official” in pip - there are too many odd edge cases that would potentially confuse users, that we’d have to support. Making the step with something like this from “works for me” to “capable of handling the needs of a big user base” is always a lot more work than it seems at first!

0reactions
lock[bot]commented, Jun 2, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pipx — Install and Run Python Applications in Isolated ...
pip is a general-purpose package installer for both libraries and apps with no environment isolation. pipx is made specifically for application installation, as...
Read more >
pipx · PyPI
Upgrades all packages within their virtual environments by running pip install --upgrade PACKAGE . pipx upgrade-all. inject. Adds packages to an ...
Read more >
2.1. Configuration — Cabal 3.2.0.0 User's Guide
Most of the options in this configuration file are also available as command ... Install dependencies into the sandbox $ cabal build #...
Read more >
Ruby equivalent of virtualenv? - python - Stack Overflow
Neither sandbox, RVM, nor rbenv manage the versions of your app's gem ... If you only need to install gems as non-root, try...
Read more >
Create Org-Dependent Unlocked Packages
But now you have a solution that enables you to package metadata without completely accounting for all metadata dependencies: org-dependent unlocked packages.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found