Skip to content
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

Make src_paths behave as expected when using --resolve-all-configs and improve performance #2142

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Commits on Jun 6, 2023

  1. Make src_paths behave as expected when using --resolve-all-configs

    When using `--resolve-all-configs`, there is unexpected behavior in that
    `src_paths` ends up resolving relative to the project root, which
    defaults to the current working directory. This results in first-party
    modules being marked as third-party modules in the default case.
    
    Under the previous implementation, one possible workaround would be to
    specify the relative path to config directory (e.g.
    `relative/path/to/configdir/src`). However, assuming that the most
    common use of `--resolve-all-configs` is to support multiple
    sub-projects in the same repository/overall directory, this workaround
    would now require each sub-project to understand where it lives in the
    filesystem.
    
    This change proposes a fix that sets `directory` on the `config_data` to
    be the directory containing the used configuration file if not already
    set. Downstream, this directory is then used to resolve the absolute
    paths specified by `src_paths`.
    
    Fixes PyCQA#2045
    sudowork committed Jun 6, 2023
    Configuration menu
    Copy the full SHA
    1e90580 View commit details
    Browse the repository at this point in the history

Commits on Jun 7, 2023

  1. Greatly improve performance of find_all_configs

    Avoid recursing into default skip files like .venv. Also avoid doing an
    iteration per config file type. Lastly, use scandir to improve file system walk
    performance.
    
    The previous implementation would walk the entire tree, and iterate over
    each config source type to test if the file exists. Instead, walk over
    existing files and do a fast filter to remove candidates.
    sudowork committed Jun 7, 2023
    Configuration menu
    Copy the full SHA
    b5f83ab View commit details
    Browse the repository at this point in the history