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

Installing from github #543

Closed
hhoeflin opened this issue Apr 21, 2022 · 7 comments
Closed

Installing from github #543

hhoeflin opened this issue Apr 21, 2022 · 7 comments

Comments

@hhoeflin
Copy link

Hi,

thanks for flit, I really like it. One question I had was that pip supports installation from github via the
'git+https://github.com ....' notation. But if I include that in the requirements, I get an error that it can't be parsed.

what would your recommended way to be use it like this?

Thanks

@takluyver
Copy link
Member

I'm not quite sure what you mean. If you're trying to install something that's packaged with Flit from GitHub, that should work, but you might need to upgrade to the latest pip.

If you're trying to include something in the requirements of your package, it doesn't exactly work like that (this is true whether you use Flit or a setup.py file). For some background on why, see this blog post. You can specify a fixed URL for a package (see an example here), but then it's completely fixed - you don't benefit from pip picking the newest compatible version, or selecting a package to fit the platform it's installing on.

@pradyunsg
Copy link
Member

And, just to be complete: you might need to use package-name @ git+... syntax for specifying packages.

@hhoeflin
Copy link
Author

hhoeflin commented Apr 21, 2022

Thanks @takluyver and @pradyunsg, that worked. using package-name @ git+....

Thanks for the pointer that the version and link would be fixed - the only reason I do this is that I depend on a package that only exists on github.

If this was part of the docs, would be great. There is a lot of hard to parse information out there on how to specify these things

@pradyunsg
Copy link
Member

FWIW, I'm hoping to make the "pip-specific" vs "general and will work with all tools" requirement syntax more clearly documented in pip's documentation in the coming weeks.

@wrosko
Copy link

wrosko commented May 5, 2022

@hhoeflin Did you get this working in your pyproject.toml file? Can you give a code snippet example? Does the package have to be a "release" or can it simply be the url of the repo.

@hhoeflin
Copy link
Author

hhoeflin commented May 5, 2022

I use a package called 'topk', and it is only available on github. I reference like this:

"topk@git+https://github.com/oval-group/smooth-topk"

inside the dependencies list. Simply the url of the repo. But you have to give the name of the package, it is not inferred from the url repo name.

@hhoeflin hhoeflin closed this as completed May 5, 2022
@takluyver
Copy link
Member

You can see the relevant spec about this 'direct URL' format here:

https://peps.python.org/pep-0440/#direct-references

As far as I know, you can't combine this with version specifiers (e.g. >= 4.0). So it's still a good idea for packages to be uploaded to PyPI (or another index) if possible.

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

No branches or pull requests

4 participants