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

Install package from different sources #482

Closed
frustak opened this issue Mar 13, 2023 · 6 comments · Fixed by #495
Closed

Install package from different sources #482

frustak opened this issue Mar 13, 2023 · 6 comments · Fixed by #495
Labels
enhancement New feature or request

Comments

@frustak
Copy link

frustak commented Mar 13, 2023

Description of request

I've wanted to add PyTorch and the installation command with pip is
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117
How can I specify --extra-index-url with huak? is it possible yet?

@frustak frustak added the enhancement New feature or request label Mar 13, 2023
@cnpryer
Copy link
Owner

cnpryer commented Mar 13, 2023

At the moment it's not implemented, but in theory it shouldn't be too complicated to layer in right now. I'll see if I can sneak that in soon. If I decide to hold off I'll let you know.

Right now I'm probably half-way through what's essentially the second iteration of the project. After I'm done, the first objective is to expand on package installation. So ideally this feature would be rolled into that work.

Thanks for this feedback! It's actually great timing.

@cnpryer
Copy link
Owner

cnpryer commented Mar 17, 2023

Hi! I decided to hold off for now. This is towards the top of my list. Once the work I'm doing now is complete I'll address this.

Thanks again!

@cnpryer
Copy link
Owner

cnpryer commented Mar 26, 2023

Currently huak uses pip to install dependencies. I've added the ability to pass additional arguments like --extra-index-url onto pip. At the moment you can only add one dependency at a time and huak won't pin the deps for you if a version isn't specified. With that said, if you'd like to give huak add torch -- --extra-index-url https://download.pytorch.org/whl/cu117 a try it should work with v0.0.11. The index url also won't be added to the pyproject.toml yet, so huak install would default to PyPI.

Since the installation step is the part of huak I'd like to focus more on next, I plan to add the ability to add multiple packages at once in v0.0.12 (and ship tomorrow 🤞) and better pyproject.toml management would then be on my radar. That'd include pinning versions if a version isn't specified and capturing special installation instructions like using a non-PyPI index for packages.

My goal is to make my way towards locking and dependency resolution (outside of pip), so this stuff is definitely on that path.

@cnpryer
Copy link
Owner

cnpryer commented Mar 27, 2023

Sorry. Didn't mean to close this.

To close #482 ...

😅

@cnpryer
Copy link
Owner

cnpryer commented Mar 27, 2023

Ok so where I've landed for now on this is added to the user guide in #503. Basically as of right now the best way to persist this would be by using PEP 508 strings so that huak adds everything to the pyproject.toml to replicate the behavior for huak installs.

In the future huak will implement this configuration natively and translate those options to PEP 508 strings in the pyproject.toml.

If you want to avoid using PEP 508 strings until huak does the translation for you, you can also manage the dependencies with a group or just pass the options to huak install for everything listed in the pyproject.toml.

Using a group would look like this:

my-project on  master [?] is 📦 v0.0.1 via 🐍 v3.11.0 
❯ huak add torch torchvision torchaudio --group torch -- --extra-index-url https://download.pytorch.org/whl/cu117

my-project on  master [?] is 📦 v0.0.1 via 🐍 v3.11.0 
❯ huak install --groups torch -- --extra-index-url https://download.pytorch.org/whl/cu117

I'll spend more time testing this today. Then I'd like to work on a couple other features before shipping v0.0.12. So this feature should land on the PyPI distributed huak in ~6 hours or so.

For now I'll close this issue, but we can re-open it if it's not working as intended, or if it's incomplete. Thanks again for submitting this issue!

@frustak
Copy link
Author

frustak commented Mar 28, 2023

It's great, thank you for resolving the issue.

This was referenced Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants