python-poetry / python-poetry/poetry

Poetry can't install from private repo inside of tox environment on Gitlab-CI

Open
#10,539 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/bug status/triage
Dominant language
Python
Stars
34.3k
Forks
2.5k
Avg merge
2d 19h
Merged PRs (30d)
30

Description

Description

In our CI we are currently using exported requirements files and pip to install our dependencies inside of tox testing.
This works fine, but is annoying to keep synchronized since poetry is managing the project.

Moving to running poetry directly in tox revealed that it's unable to install our internal python package from a private repository. Two strategies were tried (creating a config and using env vars) that seem to work correctly locally, but not in the CI.

I have an example project here: https://github.com/dromer/gitlab_tox_poetry
It uses a private python package called libloco. (I've anonymized the repo urls. so this won't be directly functional)

This branch tries to use the CI_JOB_TOKEN: https://github.com/dromer/gitlab_tox_poetry/tree/poetry_job_token

This branch tries to use the POETRY_HTTP_BASIC_ env vars: https://github.com/dromer/gitlab_tox_poetry/tree/poetry_http_basic_env

Any suggestions on what else to try are welcome.

Duplicate ticket on Tox repo (wasn't sure where to post): https://github.com/tox-dev/tox/issues/3599

Workarounds

Export requirements.txt

Poetry Installation Method

pip

Operating System

Debian

Poetry Version

2.1.4

Poetry Configuration
cache-dir = "/home/dreamer/.cache/pypoetry"
data-dir = "/home/dreamer/.local/share/pypoetry"
installer.max-workers = null
installer.no-binary = null
installer.only-binary = null
installer.parallel = true
installer.re-resolve = true
keyring.enabled = true
python.installation-dir = "{data-dir}/python"  # /home/dreamer/.local/share/pypoetry/python
repositories.mygitlab.url = "https://gitlab-01.mydomain.com/api/v4/projects/411/packages/pypi/simple"
requests.max-retries = 0
solver.lazy-wheel = true
system-git-client = false
virtualenvs.create = true
virtualenvs.in-project = true
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs"  # /home/dreamer/.cache/pypoetry/virtualenvs
virtualenvs.prompt = "{project_name}-py{python_version}"
virtualenvs.use-poetry-python = false
warnings.export = false
Python Sysconfig
sysconfig.log
Paste the output of 'python -m sysconfig', over this line.
Example pyproject.toml

Poetry Runtime Logs
poetry-runtime.log
Paste the output of 'poetry -vvv <command>', over this line.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked example project and compare the poetry_job_token and poetry_http_basic_env branches, focusing on the GitLab CI tox installation path and the private libloco repository configuration. Reproduce the difference between local and CI behavior; done means Poetry installs the private package inside tox, with runtime logs and a functional example configuration documenting the result.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ci-cd, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.