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

Adds support for adding package from remote urls #801

Closed
wants to merge 3 commits into from

Conversation

canassa
Copy link

@canassa canassa commented Jan 16, 2019

  • Added tests for changed code.
  • Updated documentation for changed code.

This PR adds support for installing packages from remote URLs, by passing a --url parameter. e.g.:

poetry add minibar --url https://github.com/canassa/minibar/archive/master.zip

I really needed this feature in order to keep using poetry in my internal company projects, therefore I hacked this PR together yesterday. This is really a proof-of-concept and not something production grade, I am opening this PR because I would like to get some feedback about this before I invest more time in it. Some question that I have are:

  • Is this a welcomed feature?
  • Do you agree with the new --url parameter, or do you prefer something else?
  • Did I took the correct approach by subclassing Dependency and implementing the search_for_url that download the file and calls the search_for_file method?

Fixes #695

Thanks!

@jaysonsantos
Copy link

I think you would have to implement your own dependency because if you use file's it would still reference your local file and if you distribute the lock you would have problems reproducing the install on a remote system for example.

Git dependency will pass all informations needed to reproduce on the remote system.
Here is an example of lock file using minibar with --git:

[[package]]
category = "main"
description = "Simple text progress bar library"
name = "minibar"
optional = false
python-versions = "*"
version = "0.4.0"

[package.source]
reference = "25484a383790ba09df69b4e1a6d65e018743326c"
type = "git"
url = "https://github.com/canassa/minibar"

@jaysonsantos
Copy link

Ah, git won't propagate hashes to metadata but IMO url should do it as file does

@canassa
Copy link
Author

canassa commented Jan 16, 2019

@jaysonsantos Thanks! I fixed the issue

@canassa
Copy link
Author

canassa commented Jan 16, 2019

I noticed that my implementation doesn't work for all kinds of files. For example, it works if I point the url to an archive that was generated with poetry build but it doesn't work if I try to point to a tarball with only the source code. For example, this works:

poetry add minibar --url https://files.pythonhosted.org/packages/12/34/f1d8396d246f9649e164208d9c28e3c2bdb91077c59f86368b10fba36324/minibar-0.5.0.tar.gz

But this doesn't work:

poetry add minibar --url https://github.com/canassa/minibar/archive/0.4.0.tar.gz

@canassa
Copy link
Author

canassa commented Feb 5, 2019

A friendly bump 😉

I really would like to see this feature merged, please let me know if there is anything else I could do to help move this forward.

poetry/puzzle/provider.py Outdated Show resolved Hide resolved
@canassa
Copy link
Author

canassa commented Feb 21, 2019

I have been using this branch for a while now and so far so good!

The only problem that I had is that while this is working fine if I put the dependency in the [tool.poetry.dependencies] section, it doesn't seem to work if I put it in the [tool.poetry.dev-dependencies] section. I still didn't have the chance to debug that

@sklarsa
Copy link

sklarsa commented Apr 2, 2019

What is the roadmap for getting this onto master?

@canassa
Copy link
Author

canassa commented Apr 3, 2019

@sklarsa I think that it would at least require that the issue that I mentioned in my previous comment to be fixed. Other than that I think the PR works as I used my fork for quite a while without issues. Unfortunately, installing a poetry fork is a very cumbersome process and I don't want to force my coworkers into having to install a custom fork just to run my project.

Given that I haven't received any feedback from a maintainer in 2 months, I just assumed that this project is currently dead and I moved back to pip, therefore I won't be updating this PR any longer.

@canassa canassa closed this Apr 3, 2019
@drunkwcodes
Copy link

This feature overlaps with git clone and wget.

Copy link

github-actions bot commented Mar 1, 2024

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

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants