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

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 area/cli Related to the command line area/installer Related to the dependency installer kind/feature Feature requests/implementations labels Jul 28, 2019
@sdispater sdispater added this to the 1.0 milestone Jul 28, 2019
@marctorsoc
Copy link

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 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 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 commented Sep 26, 2019

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

@AdamGold
Copy link

AdamGold commented Nov 6, 2019

Any news on this?

@PranitModak
Copy link

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
Contributor

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?

Copy link

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 Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/cli Related to the command line area/installer Related to the dependency installer kind/feature Feature requests/implementations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants