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

Prioritizing source_dir in sys.path #383

Closed
wants to merge 1 commit into from
Closed

Conversation

peekxc
Copy link
Contributor

@peekxc peekxc commented Nov 13, 2024

This PR prioritizes the supplied source directory in the sys.path. Currently, the source directory of the Builder instance, when supplied, is appended sys.path:

def build(self, filter: str = "*"):
    ...
    if self.source_dir:
	import sys
        sys.path.append(self.source_dir)

I believe a better pattern should be:

def build(self, filter: str = "*"):
    ...
    if self.source_dir:
	import sys
        if sys.path[0] != self.source_dir:
            sys.path.insert(0, self.source_dir)

This prioritizes module imports from the given source directory first, as opposed to being at the end. For me, this fixes griffe-related resolution issues that arise from mixing relative imports with editable installs (#323).

@peekxc peekxc closed this Nov 13, 2024
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 80.75710% with 61 lines in your changes missing coverage. Please review.

Project coverage is 88.68%. Comparing base (ee4fa3c) to head (7923e8e).

Files with missing lines Patch % Lines
quartodoc/autosummary.py 80.75% 61 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #383      +/-   ##
==========================================
- Coverage   88.78%   88.68%   -0.10%     
==========================================
  Files          37       37              
  Lines        3004     2996       -8     
==========================================
- Hits         2667     2657      -10     
- Misses        337      339       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants