python / python/cpython

Rewrite `sysconfig.get_config_vars` data generation to receive clearly-defined inputs

Open
#128,072 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic-sysconfig type-feature
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Feature or enhancement

Proposal:

Right now, some of the data is calculated during import, then we use that to calculate more data when building the sysconfig.get_config_vars cache. It would be good to transform all of this into a clearly defined algorithm, where we the data is generated based on a set of inputs, making it easier to generate data when cross-compiling, and allowing us to generate data for a specific environment (eg. source builds, vs installed build). This would have helped mitigate issues such as GH-127429, GH-128055, and GH-126789.

Additionally, this also gives us the opportunity to split the data into two sets: the minimum needed to evaluate the install scheme paths, and the non-critical additional data we expose in sysconfig.get_config_vars. This would help with the bootstrapping issue in python -m sysconfig --generate-posix-vars.

https://github.com/python/cpython/blob/f802c8bf872ab882d3056675acc79c950fe5b93c/Lib/sysconfig/__main__.py#L206-L221

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

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 Lib/sysconfig/main.py, especially the linked lines 206–221 and the python -m sysconfig --generate-posix-vars flow. Trace how configuration data is calculated during import and cache generation. Done means the data-generation algorithm has clearly defined inputs, supports distinct environments such as cross-compiling and installed builds, and separates install-scheme data from additional exposed variables.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.