-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
feat(config): installer.build-config-settings.pkg #10129
Conversation
Reviewer's Guide by SourceryThis pull request introduces the Sequence diagram for package installation with build config settingssequenceDiagram
participant User
participant Poetry
participant Chef
participant BuildBackend
User->>Poetry: Install package with build config settings
Note over Poetry: Read build config settings from config
Poetry->>Chef: prepare(archive, config_settings)
Chef->>BuildBackend: build(distribution, config_settings)
BuildBackend-->>Chef: Built package
Chef-->>Poetry: Prepared package
Poetry-->>User: Package installed
Class diagram for config settings implementationclassDiagram
class Config {
+dict _config
+get(setting_name: str, default: Any)
+_get_environment_build_config_settings()
+_get_normalizer(name: str)
}
class Chef {
+prepare(archive: Path, config_settings: Mapping)
-_prepare(directory: Path, config_settings: Mapping)
-_prepare_sdist(archive: Path, config_settings: Mapping)
}
class Executor {
-dict _build_config_settings
-_execute_operation(operation: Operation)
-_prepare_archive(operation: Operation)
}
Config -- Executor: provides config
Executor -- Chef: uses
Flow diagram for build config settings resolutionflowchart TD
A[Start] --> B{Check env vars}
B -->|Yes| C[Get settings from env]
B -->|No| D{Check config file}
D -->|Yes| E[Get settings from config]
D -->|No| F[Use default empty settings]
C --> G[Merge settings]
E --> G
F --> G
G --> H[Apply to build process]
H --> I[End]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Deploy preview for website ready! ✅ Preview Built with commit 366ebad. |
4d484a2
to
96e2063
Compare
5ef0deb
to
df3f641
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @abn - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟡 Testing: 1 issue found
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably have to add the new setting in
def unique_config_values(self) -> dict[str, tuple[Any, Any]]: |
Hmm, don't think we need to add it there as this is not a single value setting. |
You are probably right. I had always thought that all settings have to be added there and never took a closer look. |
df3f641
to
49adacf
Compare
To be fair, the whole config handling stuff needs a re-write. Right now it works, but doing anything in that area of the code is a headache. |
49adacf
to
97a1518
Compare
This change introduces the `installer.build-config-settings.<pkg>` configuration option to allow for PEP 517 build config settings to be passed to the respective build backends when a dependency is built during installation. This feature was chosen not to be exposed via an addition to the dependency specification schema as these configurations can differ between environments. Resolves: python-poetry#845
Co-authored-by: Randy Döring <[email protected]>
198eee7
to
366ebad
Compare
This change introduces the
installer.build-config-settings.<pkg>
configuration option to allow for PEP 517 build config settings to be passed to the respective build backends when a dependency is built during installation.This feature was chosen not to be exposed via an addition to the dependency specification schema as these configurations can differ between environments.
Resolves: #845 #8909
Closes: python-poetry/poetry-core#715
Examples
Testing
We can verify that the settings are passed to the builder using the following snippet.
The relevant output that shows the correct passing of the config settings are the following.
gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -DSWIG_PYTHON_STRICT_BYTE_CHAR -I/bad/path/graphviz/include/ -I/tmp/tmpy02y2dmo/.venv/include -I/usr/local/include/python3.13 -c pygraphviz/graphviz_wrap.c -o build/temp.linux-x86_64-cpython-313/pygraphviz/graphviz_wrap.o
You can verify this by running pip wheel --no-cache-dir --use-pep517 --config-settings='--global-option=build_ext' --config-settings='--global-option=-I/bad/path/graphviz/include/' --config-settings='--global-option=-L/bad/path/lib/' "pygraphviz (==1.14)".
console.output
Summary by Sourcery
Add support for PEP 517 build config settings during package installation. This allows specifying build configuration settings for dependencies that need to be built from source.
New Features:
installer.build-config-settings.<pkg>
to allow passing PEP 517 build configuration settings to build backends when building dependencies during installation.Tests:
Summary by Sourcery
Add support for PEP 517 build config settings during dependency installation. This allows users to specify build configuration settings for dependencies that need to be built from source using the
installer.build-config-settings.<pkg>
config option.New Features:
installer.build-config-settings.<pkg>
configuration option to allow passing PEP 517 build configuration settings to build backends when building dependencies during installation.Tests: