-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Using Poetry behind a company proxy #3748
Comments
I found a workaround on win10 (git bash) and unix: $ export HTTP_PROXY="http://<user>:<pass>@<server>:<port>"
$ export HTTPS_PROXY="http://<user>:<pass>@<server>:<port>" I currently work on a sample pull request for the first 2 points. |
There's a limitation to using the The ideal solution in that case would be global and per-dependency proxy settings that can work with |
@incoggnito |
who can i use my own pypi url(mirror) in proxy? like pip --index |
I found the solution. You need simply add this in pyproject.toml: [[tool.poetry.source]] |
That's not a solution, that's a workaround :( Poetry should use the pip configuration. Absolute worst case, it should have global configuration of its own, but I can't find any in https://python-poetry.org/docs/configuration/. Changing the checked in pyproject.toml of e.g. an open-source project you're working on simply isn't an option. |
This is very unpleasant.. I also tried different ways to not have the mirror url in the pyproject.toml but I could'nt find a way.. @sdispater can we please get a way to specify pypi mirror/repository/source as configured from outside the pyproject.toml? |
Duplicate #1632. Please refrain from directly pinging project contributors in the future. It's unnecessary as those who are interested will get notifications for every issue, and inconsiderate to those who have opted out of notifications for every single issue. |
Same here. Behind a company proxy. Proxy data should not have to be added into |
@neersighted how is this a duplicate of #1632? #1632 caters to the fact that a "mirror"/"proxy" repository should be used globally. As far as I understand this issue is about using |
Hi, was there an actual fix for the issue? The proxy has been set in my environment variables and the ide of choice. I've also tried to add the information on the project.toml but no success. |
I would agree. The issue seems to be that there is no equivalent in Poetry to something like |
There should be both:
|
since #1632 does not have either a proposal or an implementation it is strange to judge it "very inefficient and complicated". As far as I know - I have not checked - If you need something more sophisticated than that... well this is open source. The way that things happen is: someone who is motivated and able shows up and makes them happen. Is that you? |
I agree, @dimbleby. Someone in the open source community, with the right motivation and talent to fix this, could certainly do so. Unfortunately, the My only comment or request would be to re-open this. Since this issue is currently marked as a duplicate of the unrelated issue #1632, the chances of it getting fixed by and for the poetry community are certainly reduced. |
I'm pretty sure you're wrong, and those variables are respected. I don't have a real proxy to play with: but if I set
|
Okay, so if that's the case, then it is quite possible that something else is causing poetry to fail behind a proxy. Here are some findings:
Note: other users (in comments above) have reported that despite having the HTTP(S)_PROXY variables defined, they are unable to install packages using poetry behind a proxy. |
Quick question to the smart people that make these kinds of decisions: is it a crazy notion to re-open this issue based on the above discussions and findings? If you need more info or testing, please let us know. It looks like there are several people interested in this issue. Unfortunately, I do not have the talent to fix this myself (at this stage), but if we re-open the issue, maybe some brillant contributor out there will conquer it once and for all. |
I forked the poetry repo to implement the functionality, but it seems to be provided out of the box. as it seems Here is an example # .gitlab-ci.yml
image: python:3.10-alpine
stages:
- test
pytest-job:
stage: test
before_script:
- pip list
- export http_proxy=$COMPANY_PROXY
- export https_proxy=$COMPANY_PROXY
- echo "Installing poetry..."
- pip install poetry
- echo "Installing requirements..."
- poetry install
- echo "Preparing db"
# - poetry run make
- poetry run python src/manage.py makemigrations
- poetry run python src/manage.py migrate
script:
- echo "Running tests..."
- poetry run pytest -vv
- echo "Testing complete."
cache:
key: venv-cache
paths:
- .venv FYI: the outputs of $ pip list
Package Version
---------- -------
pip 23.0.1
setuptools 65.5.1
wheel 0.40.0 $ pip install poetry
Collecting poetry
Downloading poetry-1.5.1-py3-none-any.whl (225 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 225.2/225.2 kB 4.2 MB/s eta 0:00:00
Collecting cachecontrol[filecache]<0.13.0,>=0.12.9
.... |
can confirm only pip config set global.proxy xxx works for petry, env var all not working |
Can you provide a reproducible example like the one above? |
poetry add does not respect the proxy set in pip config im on windows 11 |
For people finding this issue, having a problem to run poetry behind a HTTP company proxy on Windows. I used to set my proxy for pip using To do so in powershell:
You can also do Windows > Edit environment variable to add these there. A problem appears if you want to use a company repository / company mirror repository (so without http proxy) and public PYPI (with http proxy) as you cannot setup "per repository proxy". A solution to this would be to have the option per repository in pyproject.tom. If a login is required, the auth information should be some local conf outside project conf. pyproject.toml (in your git)
config.toml (on your machine)
This duality "company-repository" + "pypi repository with http proxy" must be very common and should be answered by poetry for adoption. |
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. |
Feature Request
I would have different ideas for everyone who wants to use poetry through a company proxy-server:
pip.ini
settings and use themIf there is no other solution yet and if it is also desired by others, I would try to add that myself.
Thanks for any reply.
PS: I had already started a discussion on the subject, if that is more appropriate. Link
The text was updated successfully, but these errors were encountered: