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

Add support for url dependencies #1260

Merged
merged 1 commit into from Aug 1, 2019
Merged

Add support for url dependencies #1260

merged 1 commit into from Aug 1, 2019

Conversation

sdispater
Copy link
Member

@sdispater sdispater commented Jul 28, 2019

Pull Request Check List

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

This PR adds support for URL dependencies.

Adding a URL dependency to the current project can be done in two ways: via the add command or by modifying the pyproject.toml file directly.

poetry add https://example.com/packages/my-package-1.0.0.tar.gz
[tool.poetry.dependencies]
my-package = {url = "https://example.com/packages/my-package-1.0.0.tar.gz"}

@sdispater sdispater added CLI Installation Feature labels Jul 28, 2019
@sdispater sdispater added this to the 1.0 milestone Jul 28, 2019
@sdispater sdispater added this to In progress in 1.0 via automation Jul 28, 2019
@sdispater sdispater moved this from In progress to Done in 1.0 Jul 30, 2019
@sdispater sdispater merged commit f205ac7 into develop Aug 1, 2019
4 checks passed
@sdispater sdispater deleted the url-dependencies branch Aug 1, 2019
@sdispater sdispater mentioned this pull request Aug 2, 2019
1 task
@sdispater sdispater mentioned this pull request Aug 2, 2019
1 task
@marctorsoc
Copy link

@marctorsoc marctorsoc commented Aug 10, 2019

I tried to install spacy language model like this

(title_detector) MacBook-MacBook-Pro-de-Marc:title_detector marctorrellassocastro$ poetry add https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.1.0/en_core_web_sm-2.1.0.tar.gz

Updating dependencies
Resolving dependencies... (6.6s)


Package operations: 1 install, 0 updates, 0 removals

  - Installing en_core_web_sm (2.1.0 https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.1.0/en_core_web_sm-2.1.0.tar.gz)

[EnvCommandError]
Command ['/Users/marctorrellassocastro/Library/Caches/pypoetry/virtualenvs/title-detector-uYNvqQ-e-py3.7/bin/python', '-m', 'pip', 'install', '--no-deps', 'en-core-web-sm==2.1.0'] errored with the following return code 1, and output:
Collecting en-core-web-sm==2.1.0
  Could not find a version that satisfies the requirement en-core-web-sm==2.1.0 (from versions: )
No matching distribution found for en-core-web-sm==2.1.0
You are using pip version 19.0.3, however version 19.2.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

but didn't work. Doing pip install <url> it works. Am I doing something wrong?

@im-n1
Copy link

@im-n1 im-n1 commented Sep 26, 2019

Just tried this and doesnt work on tar/zip balls.

{ url = "https://github.com/im-n1/django-seed/archive/bf8b56d.zip" }

doesn't work because of

[SolverProblemError]
Because middleware depends on django-seed (*) which doesn't exist, version solving failed.

Maybe the version check can be skipped in this case or if you must know it we can come up with something like :

{ url = "https://github.com/im-n1/django-seed/archive/bf8b56d.zip", version = "my-epic-version" }

This happends if you fork someones repo on Github, do stuff but the original developer is not responding to your merge request. Then you need to add your repo as dependency which doesn't have PyPI link nor official version number.

@Jamim
Copy link
Contributor

@Jamim Jamim commented Sep 26, 2019

Hello @im-n1,

Just tried this and doesnt work on tar/zip balls.

Could you please submit an issue?
Thank you!

@im-n1
Copy link

@im-n1 im-n1 commented Sep 26, 2019

I just did. Feel free to do your internal issue management. Bye.

@AdamGold
Copy link

@AdamGold AdamGold commented Nov 6, 2019

Any news on this?

@sdispater sdispater moved this from Done to Closed in 1.0 Jan 5, 2020
@PranitModak
Copy link

@PranitModak PranitModak commented Jun 17, 2021

Hi @sdispater ,
Can you please let me know the format in which we would have to mention this.

I have tried the following in pyproject.toml

[tool.poetry.dependencies.tensorflow]
version = "~2.3"
url = "https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.3.2.tar.gz"

got this error

 The Poetry configuration is invalid:
   - [dependencies.tensorflow] {'version': '~2.3', 'url': 'https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.3.2.tar.gz'} is not valid under any of the given schemas

when I tried this:

[tool.poetry.dependencies]
tensorflow= { url = "https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.3.2.tar.gz" }

got this error

 TypeError

 expected string or bytes-like object

 at ~/.poetry/lib/poetry/_vendor/py3.8/poetry/core/utils/helpers.py:27 in canonicalize_name
      23│ _canonicalize_regex = re.compile(r"[-_]+")
      24│ 
      25│ 
      26│ def canonicalize_name(name):  # type: (str) -> str
   →  27│     return _canonicalize_regex.sub("-", name).lower()
      28│ 
      29│ 
      30│ def module_name(name):  # type: (str) -> str
      31│     return canonicalize_name(name).replace(".", "_").replace("-", "_")

Pull Request Check List

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

This PR adds support for URL dependencies.

Adding a URL dependency to the current project can be done in two ways: via the add command or by modifying the pyproject.toml file directly.

poetry add https://example.com/packages/my-package-1.0.0.tar.gz
[tool.poetry.dependencies]
my-package = {url = "https://example.com/packages/my-package-1.0.0.tar.gz"}

@ashnair1
Copy link

@ashnair1 ashnair1 commented Aug 22, 2021

I got the same error as @PranitModak (TypeError: expected string or bytes-like object) while trying to install a tar.gz file. Is there a fix for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI Feature Installation
Projects
No open projects
1.0
  
Closed
Development

Successfully merging this pull request may close these issues.

None yet

7 participants