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

github action may fail when use the [package.source] in poetry.lock #2151

Closed
2 tasks done
youngquan opened this issue Mar 8, 2020 · 10 comments
Closed
2 tasks done

github action may fail when use the [package.source] in poetry.lock #2151

youngquan opened this issue Mar 8, 2020 · 10 comments
Labels
status/duplicate Duplicate issues

Comments

@youngquan
Copy link

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Issue

I am from China. Because https://pypi.org/simple is too slow for me to download package, I often use a pypi mirror. I add cofigurations below to speed up:

[[tool.poetry.source]]
name = "tsinghua"
url = "https://pypi.tuna.tsinghua.edu.cn/simple/"
default = false

Recently, I have used Poetry to manage a python project named goldenmask on Github. However, because the poetry.lock file was pushed to the repository, poetry install would try to fetch packages from the pypi mirror located in China. These is unnecessary, and I have to delete the file poetry.lock and the cofigurations above, so github actions could work.

This maybe unreasonable I think, so is there a better solution for developers in China? Could someone give me some advice?

@trim21
Copy link
Contributor

trim21 commented Mar 18, 2020

you can set mirror in pip config file like /etc/pip.conf in old way.

When poetry call pip to install packages, pip will try to install from mirror instead of pypi. There is no need to add source section in pyproject.toml

@youngquan
Copy link
Author

Thanks for your reply. I have already set the global.index-url using pip config set

$ pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/
Writing to /root/.config/pip/pip.conf

$ pip config get global.index-url
https://pypi.tuna.tsinghua.edu.cn/simple/

However, when I tried to use poetry to add a package, pip was still using https://pypi.org/simple, because it was too slow to resolving dependencies.

I also tried to set mirror in pip config file like /etc/pip.conf in old way, however it still did not work:

$ cat /etc/pip.conf 
[global] 
index-url = https://pypi.tuna.tsinghua.edu.cn/simple/

Is there some way to know which pypi mirror that poetry was using? Besides, even I can set the pypi mirror, the poetry.lock would still contian information of the pypi mirror I set. I had to delete the file poetry.lock again when I was using github actions, I do not know whether this was reasonable?

Here are the version of poetry:

$ poetry --version
Poetry version 1.0.5

@trim21
Copy link
Contributor

trim21 commented Mar 18, 2020

no, pip is not using pypi.

poetry is issuing http requests to pypi json api to resolve deps, that's why it's slow.

I'm not sure if poetry could use json api of mirrors, looks like it could.

I'm doing it this way but I can't find anything about my pypi mirror in my poetry.lock...

@youngquan
Copy link
Author

youngquan commented Mar 18, 2020

So when I set pypi mirror in /etc/pip.conf, where did poetry try to resolve deps from? From https://pypi.org/simple or from https://pypi.tuna.tsinghua.edu.cn/simple/ ? If I set [[tool.poetry.source]] in pyproject.toml, it will be very fast to resolve deps !

Here is a picture show how slow the poetry is, when I did set pypi mirror in /etc/pip.conf:

image

I have never waited for the result, so I never saw the poetry.lock file when pypi mirror was only set in /etc/pip.conf. 😂

Meanwhile, If I set [[tool.poetry.source]] in pyproject.toml,there would be pypi mirror information in poetry.lock:

image

@trim21
Copy link
Contributor

trim21 commented Mar 18, 2020

From pypi, because I often got requests failure exceptions showing host is pypi.
I never wait to resolve whole project, either...
I start from empty pyproject.toml and add deps one by one, to let poetry catch more and more requests.

@youngquan
Copy link
Author

I see! So poetry use pypi json api to resolve deps, and download packages from pypi mirror in pip.conf, is that right?

Thanks for your time!

I did start from an empty pyproject.toml and add the click package 1 hours ago, poetry has not finished yet:

image

It is so frustrating, so I still have to set [[tool.poetry.source]] in pyproject.toml ???!!!

@NateScarlet
Copy link

Related to #1632

@sinoroc
Copy link

sinoroc commented May 1, 2021

@youngquan There is a PR that could help solve this issue. Would you be able to test it, give feedback? #3624

@neersighted
Copy link
Member

Closing as a specialized duplicate of #1632

@neersighted neersighted closed this as not planned Won't fix, can't repro, duplicate, stale Oct 4, 2022
@neersighted neersighted added the status/duplicate Duplicate issues label Oct 4, 2022
Copy link

github-actions bot commented Mar 1, 2024

This issue 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
status/duplicate Duplicate issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants