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

poetry export --with-credentials fails under tox with tox-poetry-installer #72

Closed
ejd opened this issue Aug 23, 2022 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@ejd
Copy link

ejd commented Aug 23, 2022

I used poetry config http-basic.private-index __token__ TOKEN to store credentials for a private package index. I have a tox testenv that runs poetry export --with-credentials to generate a requirements file. When the testenv runs poetry export --with-credentials under tox, it prints the following message:

No suitable keyring backends were found
Using a plaintext file to store and retrieve credentials

The resulting output contains the username part of the index credentials but is missing the password part:

--extra-index-url https://__token__:@example.com/pypi/simple

When I run poetry export --with-credentials on the command line, poetry doesn't print the warning and its output contains both the username and password for the index, like this:

--extra-index-url https://__token__:TOKEN@example.com/pypi/simple

Should I expect to be able to run poetry export --with-credentials under tox with tox-poetry-installer installed? Here is some information I thought would be helpful in diagnosing my problem. I'm happy to provide other details if needed.

~/.poetry/bin/poetry is the copy of poetry that the testenv runs -- I checked with which poetry in the testenv. I'm not sure if it's relevant, but running .tox/.tox/bin/poetry export --with-credentials on the command line also produces the correct output with the username and password present.

Poetry version: 1.1.15
tox version: 3.25.1
Poetry installation method:

curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3.9 -

tox.ini:

[tox]
minversion = 3.3.0
isolated_build = True
requires = tox-poetry-installer[poetry] == 0.8.4

[testenv]
sitepackages = False
require_poetry = True
require_locked_deps = True

[testenv:export]
skip_install = True
allowlist_externals = poetry
commands = poetry export --with-credentials

Relevant portion of pyproject.toml:

[[tool.poetry.source]]
name = "private-index"
url = "https://example.com/pypi/simple"
secondary = true

poetry.toml:

[repositories]
[repositories.private-index]
url = "https://example.com/pypi/simple"
@enpaul enpaul added the bug Something isn't working label Aug 24, 2022
@ejd
Copy link
Author

ejd commented Sep 10, 2022

This isn't an issue with tox-poetry-installer. I found jaraco/keyring#283 which explains that I need to have the following in the testenv that does poetry export:

passenv =
    DBUS_SESSION_BUS_ADDRESS

Otherwise, keyring can't connect to the dbus session.

Sorry for the confusion!

@ejd ejd closed this as completed Sep 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants