question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

poetry self and custom sources

See original GitHub issue
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the FAQ and general documentation and believe that my question is not already covered.

Feature Request

I’m preparing for the eventuality of the export plugin not being installed by default. When running poetry self add poetry-plugin-export, I noticed that the files were being downloaded from pythonhosted.org instead of my company’s repos. I’d prefer that poetry retrieve artifacts from my company’s internal repos.

Expectation

⭐ ⭐ ⭐ ⭐ ⭐ = A command line option would be great:

poetry self add poetry-plugin-export --index-url https://example.com/proxies/pypi/simple

⭐ ⭐ ⭐ ⭐ = But I could also see this being a one-time setup thing:

poetry self config pip.global.index-url https://example.com/proxies/pypi/simple

⭐ ⭐ ⭐ = but this probably works for now until something nicer exists:

${POETRY_HOME}/bin/pip3 config --site set global.index-url https://example.com/proxies/pypi/simple

But I don’t have a good way for poetry to tell me its venv path for scripting, e.g. something like

POETRY_HOME=$(poetry self venv)

or to run something in poetry’s venv with a command like

poetry self run pip config …

Related:

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
neersightedcommented, Nov 13, 2022

poetry self add is not respecting your source as you have configured your project to use your proxied source, not your Poetry instance. We are referring to the internal pyproject.toml used by Poetry to manage itself, located at ~/.config/pypoetry/pyproject.toml on a Linux system.

When adding/removing plugins with poetry self, Poetry is used to manage Poetry. You have been confused to believe that project-level source configuration has any level of influence over Poetry’s global state; it does not.

If you’re still confused by this, please reach out via another channel (e.g. Discord) for assistance as we’re just generating noise on this ticket at this point.

0reactions
jonathanunderwoodcommented, Nov 13, 2022

OK - gottit, I did indeed misunderstand. Thanks for bearing with me.

Nonetheless, the end result is that I am still seeing an issue (though it might be a different root cause) resulting in the inability to install plugins from a local pypi mirror due to poetry insisting on doing dependency resolution against PyPi for self add.

pyproject.toml:

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "ecba-scoring-api"
version = "0.0.0.post4.dev0+bb465c1"
description = "Scoring API for the ECBA framework"
authors = ["Jonathan G. Underwood <jonathan.underwood@someemail.com>"]
license = "Proprietary"
readme = "README.md"

[[tool.poetry.source]]
name = "pypi-mirror"
url = "https://artifactory.internal.someenterprise.com/artifactory/api/pypi/pypi-python-org/simple"
default = true
secondary = false

[tool.poetry.dependencies]
python = ">=3.10,<3.11"
fastapi = "^0.86.0"
uvicorn = "^0.19.0"
ecba = {git = "https://github.localenterpriseinstance.com/ECBA/pyecba.git", branch = "ecba-scoring-api"}

[tool.poetry.group.dev.dependencies]
flake8 = "^5.0.4"
black = "^22.10.0"
isort = "^5.10.1"
mypy = "^0.990"
pylint = "^2.15.5"
pydocstyle = "^6.1.1"
$ poetry self add "poetry-dynamic-versioning[plugin]"
Using version ^0.21.1 for poetry-dynamic-versioning

Updating dependencies
Resolving dependencies... (12.5s)

HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/3d/1a/d31fce69c119df1fddab3706b63c53d363982c55d841d9c3839b12f15327/shellingham-1.5.0-py2.py3-none-any.whl (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)')))

So, you can see, poetry self add isn’t paying attention to the [[tool.poetry.source]] section, and is trying to reach out to PyPi (and failing to do so due to an SSL error caused by a proxy - that’s fine, and expected).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Repositories | Documentation | Poetry - Python dependency ...
Poetry can fetch and install package dependencies from public or private custom repositories that implement the simple repository API as described in PEP...
Read more >
Dependency Management With Python Poetry
Learn how Python Poetry will help you start new projects, maintain existing ones, and master dependency management.
Read more >
A Prayer for my Daughter by W. B. Yeats - Poems | poets.org
Find and share the perfect poems. ... For beauty's very self, has charm made wise, And many a poor man that ... And...
Read more >
Dependency Scanning - GitLab Docs
For self-managed GitLab instances in an environment with limited, restricted, or intermittent access to external resources through the internet, some ...
Read more >
What to Consider When Self-Publishing Poetry Books
Learn how to self-publish poetry books by following our guide to poetry, ... keep in mind that there are great resources available in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found