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

custom pypi repository on the local disk (file:// urls) #536

Open
2 tasks done
FelixSchwarz opened this issue Oct 23, 2023 · 5 comments · May be fixed by #538
Open
2 tasks done

custom pypi repository on the local disk (file:// urls) #536

FelixSchwarz opened this issue Oct 23, 2023 · 5 comments · May be fixed by #538

Comments

@FelixSchwarz
Copy link

Checklist

  • I added a descriptive title
  • I searched open requests and couldn't find a duplicate

What is the idea?

Since #529 there is support for additional pip repositories. I would like to ask for support of local repositories, specified by a file:// url like this:

channels:
  - conda-forge
pip-repositories:
  - file:///some/path/to/local/repo/
dependencies:
  - python=3.11
  - requests=2.26
  - pip:
    - fake-private-package==1.0.0

Why is this needed?

We require some private wheels for our repo but there is no private registry in place. The easiest thing for us seems to be to put the wheels in git lfs which available for every developer. That way we do not need to operate a private pypi service and we circumvent all the hooks with regards to authentication/user accounts.

Running conda-lock with a file:// url triggers an exception by requests:
requests.exceptions.InvalidSchema: No connection adapters were found for 'file:///some/path/to//'.

What should happen?

For the user it should not matter if he specifies an https:// or a file:// url. The end result should be the same assuming that both URLs are valid.

Additional Context

There is the requests-file library which hooks into requests. Maybe conda-lock could hook that into the processing chain?

The main problem I see is that conda-lock would need to ship its own version of LegacyRepository which then registers the file adapter for the session returned by its session property. A follow-up problem is that poetry issues a GET to /some/path/to/local/repo/ (instead of /some/path/to/local/repo/index.html) but I hope that the requests-file project might be open to accept a patch.

Of course that is only my idea on how to implement this. It might be easier to write a completely custom repo provider which avoids all the requests functionality.

@maresb
Copy link
Contributor

maresb commented Oct 23, 2023

Thanks, it would definitely be great to support this.

You have thought much more deeply about this than I have. Ideally we don't implement anything that increases our dependency on Poetry. (I would like to eventually switch away from it.) The requests-file project looks nice and simple. Would the necessary patch be to reroute directories to .../index.html?

I would be happy to consider a PR for this.

@FelixSchwarz
Copy link
Author

Would the necessary patch be to reroute directories to .../index.html?

Unfortunately yes because poetry issues a request to /some/path/to/local/repo/fake-private-package/.

@maresb
Copy link
Contributor

maresb commented Oct 24, 2023

I don't think it would be problematic to vendor a patched requests-file in conda-lock, but upstreaming it would be preferable.

@FelixSchwarz
Copy link
Author

I submitted #538 as a kind of draft PR

@pplonski
Copy link

Hi,
I would like to use this feature as well. Any update on it? Thank you.

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

Successfully merging a pull request may close this issue.

3 participants