python-poetry / python-poetry/poetry

Replace special chars with underscores for environment variables with credentials

Open
#7,123 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

  • I am on the latest stable Poetry version, installed using a recommended method.

  • 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.

  • Poetry version: >=1.0.0

  • Python version: 3

  • OS version and name: N/A

  • pyproject.toml: bryant-finney/pyproject.toml

Request for Enhancement

Currently, I am unable to use environment variables to authenticate for installing packages from a private internal PyPI repository example.com.

In the linked pyproject.toml, the source repository named example.com provides a private package named the-package:

# ...

[[tool.poetry.source]]
name = "example.com"
url = "https://example.com/pypi/simple"
default = false
secondary = false

# ...

From my development machine, I can authenticate with the example.com repository and install the-package:

❯ poetry config http-basic.example.com $EXAMPLE_USER $EXAMPLE_PASSWORD

❯ poetry add --group dev the-package
Using version ^1.2.3 for the-package

Updating dependencies
Resolving dependencies... (6.7s)

Writing lock file

Package operations: 8 installs, 0 updates, 0 removals

  • Installing click-didyoumean (0.3.0)
  • Installing click-plugins (1.1.1)
  • Installing click-repl (0.2.0)
[ ... ]

I also expected to use the environment variables POETRY_HTTP_BASIC_EXAMPLE_COM_USERNAME and POETRY_HTTP_BASIC_EXAMPLE_COM_PASSWORD for installations during Docker image builds.

However, this does not work: poetry.config.config:230 only replaces -s with _s, so it does not match these variables.

This request is to support other special characters in the repo name (e.g. . in example.com) instead of only -s.

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 in src/poetry/config/config.py around line 230, where environment-variable names currently normalize hyphens. Reproduce the example.com repository configuration with POETRY_HTTP_BASIC_EXAMPLE_COM_USERNAME and POETRY_HTTP_BASIC_EXAMPLE_COM_PASSWORD; done means credentials using repository names with special characters are recognized during installation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.