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

Support for namespace packages #871

Open
wants to merge 30 commits into
base: master
Choose a base branch
from

Conversation

tristanlatr
Copy link
Contributor

@tristanlatr tristanlatr commented Jan 23, 2025

Fixes #343
Related to #824

This includes support for PEP 420 as well as old school declaration of namespace packages.

Copy link

codecov bot commented Jan 23, 2025

Codecov Report

Attention: Patch coverage is 98.19820% with 4 lines in your changes missing coverage. Please review.

Project coverage is 93.03%. Comparing base (02063d3) to head (a297e5f).

Files with missing lines Patch % Lines
pydoctor/astutils.py 96.42% 0 Missing and 2 partials ⚠️
pydoctor/epydoc2stan.py 90.00% 0 Missing and 1 partial ⚠️
pydoctor/model.py 98.96% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #871      +/-   ##
==========================================
+ Coverage   92.79%   93.03%   +0.23%     
==========================================
  Files          47       47              
  Lines        8468     8610     +142     
  Branches     1550     1578      +28     
==========================================
+ Hits         7858     8010     +152     
+ Misses        350      339      -11     
- Partials      260      261       +1     

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

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

1 similar comment

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

1 similar comment

This comment has been minimized.

@tristanlatr tristanlatr changed the title Support for implicit namespace packages. Support for implicit namespace packages (PEP 420) Jan 30, 2025

This comment has been minimized.

This comment has been minimized.

@tristanlatr tristanlatr changed the title Support for implicit namespace packages (PEP 420) Support for namespace packages Jan 30, 2025

This comment has been minimized.

This comment has been minimized.

1 similar comment

This comment has been minimized.

@tristanlatr tristanlatr marked this pull request as ready for review January 30, 2025 07:05

This comment has been minimized.

1 similar comment

This comment has been minimized.

@tristanlatr tristanlatr requested review from a team January 30, 2025 15:23
@@ -278,18 +278,7 @@ def namespace(self, obj: model.Documentable) -> List[Union[Tag, str]]:
ob = ob.parent
parts.reverse()
return parts
@renderer
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was dead code :/

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

1 similar comment
Copy link

According to pydoctor_primer, this change doesn't affect pydoctor warnings on a corpus of open source code. ✅

@tristanlatr
Copy link
Contributor Author

Supporting namespace packages is more or less useful if we don’t fix #870. But that can come in a second phase.

tree = parseFile(path)
return tree
except Exception as e:
tree = e
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Caching the exception instance is not a good idea because if cycles with locals.
Instead we should cache the exception type and args and re-raise another instance of it when asked again.

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

Successfully merging this pull request may close these issues.

Does not document namespace packages
1 participant