Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CondaEnv auto-offline behaviour with local package repositories #554

Open
Tolker-KU opened this issue Dec 29, 2021 · 3 comments
Open

CondaEnv auto-offline behaviour with local package repositories #554

Tolker-KU opened this issue Dec 29, 2021 · 3 comments

Comments

@Tolker-KU
Copy link
Contributor

How would this feature be useful?
Inside some companies a local repository of Conda packages is used. This means that a dev is able to connect to the local package repository and download packages without being able to access repo.anaconda.com. We are testing for access to this site when determining if CondaEnv should auto-offline:
/~https://github.com/theacodes/nox/blob/8b12711d43a4c7b231c18c9b124501e4d23d5b53/nox/virtualenv.py#L286
It would be useful to be able to check for connection to a local package repository for determining if Nox should go into "auto-offline mode".

Describe the solution you'd like
I think this is quite tricky to solve, so I've more a list of possible solutions than a solution I want:

  • Parse the users .condarc file to determine what site to use for testing if online. This can become quite complicated as the .condarc file can be saved many different place, may change format, have multiple channels and so on.
  • Make the site to use for testing if online settable by the user in some way. The best place for this is probably some config file specific to the users machine, but having such a config file is not very 'noxy' as I see it.
  • Make a option to disable the "auto-offline" thing. This has its own drawbacks of course.

Describe alternatives you've considered
Alternatively one can use it auto_offline=False argument in Session.conda_install() but it is not very elegant to set this everywhere.

@cjolowicz
Copy link
Collaborator

A question to those more familiar with conda than me:

Instead of automatically switching to offlline mode, can we expose conda's --offline flag through the Nox CLI, letting users choose offline mode explicitly?

Offline-mode seems to be a feature that should be controlled by the Nox user, not the Noxfile author. Our automatic offline detection seems error-prone at best. If this use case can be solved by exposing --offline, I'd argue that we should deprecate the auto-offline mode altogether.

What am I missing?

@Tolker-KU
Copy link
Contributor Author

A question to those more familiar with conda than me:

Instead of automatically switching to offlline mode, can we expose conda's --offline flag through the Nox CLI, letting users choose offline mode explicitly?

Offline-mode seems to be a feature that should be controlled by the Nox user, not the Noxfile author. Our automatic offline detection seems error-prone at best. If this use case can be solved by exposing --offline, I'd argue that we should deprecate the auto-offline mode altogether.

What am I missing?

I agree with all of this and I'm fan of making --offline a CLI argument.

The feature is described and introduced here FTR: #313 #314

@antonitto
Copy link

I’m facing the same issue. Not sure if this breaks nox env isolation, but I would definitely appreciate if conda_install() could use local conda configs, e.g., ~/.condarc. Or maybe pass it as a param in CLI?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants