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

Specifying priority="primary" in config.toml does NOT suppress use of pypi.org #10245

Closed
wphillipmoore opened this issue Mar 3, 2025 · 5 comments
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged

Comments

@wphillipmoore
Copy link

Description

Like many of us, I work in a corporate environment which does not allow direct access to pypi.org, and instead offers internal artifactory repositories for both internal publication of code, as well as proxied for pypi.

We can trivially configure pip to use ONLY the internal repositories, and we can do so for poetry but this only seems to work if the configuration is managed in pyproject.toml [tool.poetry.source] stanzas, and not when configured via config.toml.

If I add all three repositories to my pyproject.toml files, everything works as documented. One of them is defined as priority="primary", and no attempt is made to reach pypi.org.

However, we have a LOT of code repositories, and I really do not want to have to maintain the entries in pyproject.toml. I would prefer to factor that configuration out into a per-develop config file, so I attempted to make this work with ~/AppData/Roaming/pypoetry/config.toml file. Everyone needs one of these anyway, since we have some common configuration everyone is required to use.

Nothing we have tried results in pypi.org NOT being contacted. The same names, the same URLS, and the same one is defined as primary, yet the attempt to reach pypi.org means this configuration simply can not be used.

Is there an extra configuration required to suppress the use of pypi.org when using a config.toml file, or is this perhaps a bug?

I can reproduce this trivially, and would be more than happy to provide additional diagnostics, if this is in fact a bug.

Workarounds

The current workaround is to maintain the poetry config in each and every pyproject.toml file.

Poetry Installation Method

pip

Operating System

Windows 10

Poetry Version

Poetry (version 1.8.5)

Poetry Configuration

cache-dir = "C:\\Users\\k078065\\AppData\\Local\\pypoetry\\Cache"
experimental.system-git-client = false
installer.max-workers = null
installer.modern-installation = true
installer.no-binary = null
installer.parallel = true
keyring.enabled = true
repositories.intg.url = "<internal url>"
repositories.prxy-a.priority = "primary"
repositories.prxy-a.url = ""<internal url>"
repositories.prxy-b.url = ""<internal url>"
solver.lazy-wheel = true
virtualenvs.create = true
virtualenvs.in-project = true
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.no-setuptools = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}\\virtualenvs"  # C:\Users\k078065\AppData\Local\pypoetry\Cache\virtualenvs
virtualenvs.prefer-active-python = false
virtualenvs.prompt = "{project_name}-py{python_version}"
warnings.export = false

Python Sysconfig

sysconfig.log
Platform: "win-amd64"
Python version: "3.12"
Current installation scheme: "venv"

Paths:
      data = "C:\Users\k078065\Work\GitHub\mqqm-ibm-mq-cmdb\.venv"
      include = "C:\Program Files\Python312\Include"
      platinclude = "C:\Program Files\Python312\Include"
      platlib = "C:\Users\k078065\Work\GitHub\mqqm-ibm-mq-cmdb\.venv\Lib\site-packages"
      platstdlib = "C:\Users\k078065\Work\GitHub\mqqm-ibm-mq-cmdb\.venv\Lib"
      purelib = "C:\Users\k078065\Work\GitHub\mqqm-ibm-mq-cmdb\.venv\Lib\site-packages"
      scripts = "C:\Users\k078065\Work\GitHub\mqqm-ibm-mq-cmdb\.venv\Scripts"
      stdlib = "C:\Program Files\Python312\Lib"

Variables:
      BINDIR = "C:\Users\k078065\Work\GitHub\mqqm-ibm-mq-cmdb\.venv\Scripts"
      BINLIBDEST = "C:\Users\k078065\Work\GitHub\mqqm-ibm-mq-cmdb\.venv\Lib"
      EXE = ".exe"
      EXT_SUFFIX = ".cp312-win_amd64.pyd"
      INCLUDEPY = "C:\Program Files\Python312\Include"
      LIBDEST = "C:\Program Files\Python312\Lib"
      TZPATH = ""
      VERSION = "312"
      VPATH = "..\.."
      abiflags = ""
      base = "C:\Users\k078065\Work\GitHub\mqqm-ibm-mq-cmdb\.venv"
      exec_prefix = "C:\Users\k078065\Work\GitHub\mqqm-ibm-mq-cmdb\.venv"
      installed_base = "C:\Program Files\Python312"
      installed_platbase = "C:\Program Files\Python312"
      platbase = "C:\Users\k078065\Work\GitHub\mqqm-ibm-mq-cmdb\.venv"
      platlibdir = "DLLs"
      prefix = "C:\Users\k078065\Work\GitHub\mqqm-ibm-mq-cmdb\.venv"
      projectbase = "C:\Program Files\Python312"
      py_version = "3.12.4"
      py_version_nodot = "312"
      py_version_nodot_plat = "312"
      py_version_short = "3.12"
      srcdir = "C:\Program files\Python312"
      userbase = "C:\Users\k078065\AppData\Roaming\Python"

Example pyproject.toml

Poetry Runtime Logs

poetry-runtime.log
Paste the output of 'poetry -vvv <command>', over this line.
@wphillipmoore wphillipmoore added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Mar 3, 2025
@dimbleby
Copy link
Contributor

dimbleby commented Mar 3, 2025

Please check for duplicates, please close

@wphillipmoore
Copy link
Author

Apologies, as I most certainly did look for an existing issue, and only after finding nothing, created a new one.

If there is a known issue, please point it out, and I'll happily close this one.

@dimbleby
Copy link
Contributor

dimbleby commented Mar 3, 2025

Most recently #10228, itself a duplicate of #1632, etc

@wphillipmoore
Copy link
Author

With all due respect, this is related, but not an exact duplicate.

I guess it boils down to 'priority = "primary"' is only supported when configured via pyproject.toml? I expected like for like between the two configuration mechanisms, which I now see isn't true.

If config.toml only supports a small subset of what can be configured via pyproject.toml, I suppose that's understandable. We'll just have to live with copying the config into pyproject.toml everywhere, since that works fine.

@dimbleby
Copy link
Contributor

dimbleby commented Mar 4, 2025

we can tell you that this is working as designed, and then you can say that in that case you have a feature request, and then we can tell you it's a duplicate if that makes you happier...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants