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

How to represent packages ? #15

Closed
tristanlatr opened this issue Aug 11, 2021 · 1 comment · Fixed by #17
Closed

How to represent packages ? #15

tristanlatr opened this issue Aug 11, 2021 · 1 comment · Fixed by #17
Assignees
Labels
type: improvement An improvement to an existing feature.

Comments

@tristanlatr
Copy link
Contributor

Hello,

It seems that the _MemberType variable is assigned to the following:

_MemberType = te.Annotated[
  t.Union[Data, Function, Class],
  A.unionclass({ 'data': Data, 'function': Function, 'class': Class }, style=A.unionclass.Style.flat)]

I was wondering if the _MemberType should be assign to the following instead:

_MemberType = te.Annotated[
  t.Union[Data, Function, Class],
  A.unionclass({ 'data': Data, 'function': Function, 'class': Class,  'module': Module }, style=A.unionclass.Style.flat)]

This way, modules will be able to contain other modules!

Tell me what you think,

Thanks

@NiklasRosenstein
Copy link
Owner

NiklasRosenstein commented Aug 11, 2021

Hey @tristanlatr , funny you should mention this! I've been having this in the back of my mind (in addition to a few other things that should make traversing the API tree easier). And it actually came up as well yesterday on a Pydoc-Markdown PR discussion 😄

I'd prefer to introduce a new _ModuleMemberType which can include Module objects (and you need to also include Module in the t.Union[...]), as otherwise classes could contain modules.

Doing this should be mostly backwards-compatible, but docspec-python would need to be updated to return the modules nested instead of flat. This would probably need to be an option that is disabled by default (or a function to be applied after you have a list of modules) . I'm not sure yet how Pydoc-Markdown renderers would behave with nested modules, but most likely it won't work as expected right now.

@NiklasRosenstein NiklasRosenstein added the type: improvement An improvement to an existing feature. label Aug 11, 2021
@NiklasRosenstein NiklasRosenstein self-assigned this Aug 11, 2021
NiklasRosenstein added a commit that referenced this issue Aug 12, 2021
* move unit tests in src/test

* add very simple ReverseMap unit test

* address #15, add ApiObject.parent

* update action to trigger on develop only

* regenerate setup.py

* actually our main branch is called main

* regenerate setup.py

* remove test/__init__.py as that will cause an error when pytest tries to import the test modules for execution in one single process

* fix test

* add types-Deprecated to dev requirements, fix type hint
@NiklasRosenstein NiklasRosenstein linked a pull request Aug 12, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: improvement An improvement to an existing feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants