Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@finswimmer
Copy link
Member

@finswimmer finswimmer commented Oct 23, 2025

Without this fix, Poetry will report Setting data-dir does not exist or Setting python.installation-dir does not exist.

@sourcery-ai
Copy link

sourcery-ai bot commented Oct 23, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The PR updates the ConfigCommand to recognize and normalize two previously unsupported installer-related settings by extending the unique_config_values map.

Class diagram for updated ConfigCommand unique_config_values

classDiagram
    class ConfigCommand {
        +unique_config_values() dict[str, tuple[Any, Any]]
    }
    class boolean_validator
    class boolean_normalizer
    class Path
    ConfigCommand --> boolean_validator
    ConfigCommand --> boolean_normalizer
    ConfigCommand --> Path
    %% Highlight new/modified config keys
    class cache_dir {
        +type: str
        +normalizer: lambda val: str(Path(val))
    }
    class data_dir {
        +type: str
        +normalizer: lambda val: str(Path(val))
    }
    class python_installation_dir {
        +type: str
        +normalizer: lambda val: str(Path(val))
    }
    ConfigCommand --> cache_dir
    ConfigCommand --> data_dir
    ConfigCommand --> python_installation_dir
Loading

File-Level Changes

Change Details Files
Support for setting 'data-dir' added
  • Declared 'data-dir' key in unique_config_values
  • Assigned type str and Path-based normalizer
src/poetry/console/commands/config.py
Support for setting 'python.installation-dir' added
  • Declared 'python.installation-dir' key in unique_config_values
  • Assigned type str and Path-based normalizer
src/poetry/console/commands/config.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `src/poetry/console/commands/config.py:77` </location>
<code_context>
    @property
    def unique_config_values(self) -> dict[str, tuple[Any, Any]]:
        unique_config_values = {
            "cache-dir": (str, lambda val: str(Path(val))),
            "data-dir": (str, lambda val: str(Path(val))),
            "virtualenvs.create": (boolean_validator, boolean_normalizer),
            "virtualenvs.in-project": (boolean_validator, boolean_normalizer),
            "virtualenvs.options.always-copy": (boolean_validator, boolean_normalizer),
            "virtualenvs.options.system-site-packages": (
                boolean_validator,
                boolean_normalizer,
            ),
            "virtualenvs.options.no-pip": (boolean_validator, boolean_normalizer),
            "virtualenvs.path": (str, lambda val: str(Path(val))),
            "virtualenvs.use-poetry-python": (boolean_validator, boolean_normalizer),
            "virtualenvs.prompt": (str, str),
            "system-git-client": (boolean_validator, boolean_normalizer),
            "requests.max-retries": (lambda val: int(val) >= 0, int_normalizer),
            "installer.re-resolve": (boolean_validator, boolean_normalizer),
            "installer.parallel": (boolean_validator, boolean_normalizer),
            "installer.max-workers": (lambda val: int(val) > 0, int_normalizer),
            "installer.no-binary": (
                PackageFilterPolicy.validator,
                PackageFilterPolicy.normalize,
            ),
            "installer.only-binary": (
                PackageFilterPolicy.validator,
                PackageFilterPolicy.normalize,
            ),
            "solver.lazy-wheel": (boolean_validator, boolean_normalizer),
            "keyring.enabled": (boolean_validator, boolean_normalizer),
            "python.installation-dir": (str, lambda val: str(Path(val))),
        }

        return unique_config_values

</code_context>

<issue_to_address>
**issue (code-quality):** Inline variable that is immediately returned ([`inline-immediately-returned-variable`](https://docs.sourcery.ai/Reference/Default-Rules/refactorings/inline-immediately-returned-variable/))
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@@ -76,6 +76,7 @@ class ConfigCommand(Command):
def unique_config_values(self) -> dict[str, tuple[Any, Any]]:
unique_config_values = {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (code-quality): Inline variable that is immediately returned (inline-immediately-returned-variable)

@finswimmer finswimmer requested a review from a team October 23, 2025 14:14
@radoering radoering changed the title fix: some python installer related settings cannot be set fix: allow to set data-dir and python-installation-dir Oct 24, 2025
@radoering radoering merged commit 6ace575 into python-poetry:main Oct 24, 2025
63 checks passed
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants