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

Experimental API for port and param docs #343

Merged
merged 1 commit into from
Apr 23, 2024
Merged

Experimental API for port and param docs #343

merged 1 commit into from
Apr 23, 2024

Conversation

ducky64
Copy link
Collaborator

@ducky64 ducky64 commented Apr 23, 2024

Adds an optional doc='...' argument to self.Port(...), self.Parameter(...) and self.ArgParameter(...). Docs are stored in the block, similar to how optional and port tags are tracked. The idea is this keeps documentation close to the port definition and (in the future) allows tools that are port-/parameter-aware to generate documentation specific to the data model here.

Python doesn't have a accepted convention for class attribute docs, so we're going to make our own. PEP 224 was a proposal for attribute docstrings, but was rejected.

Quick informal conventions:

  • Type information should not be repeated in the docstring.
  • Other arguments to Port should not be repeated in the docstring (e.g., optional, port tags). Tools should automatically add these when generating visualizations / documentation.
  • Documentation should not simply repeat the port name, but rather add more information / context - pwr, gnd would not need docstrings unless the docstrings add information, e.g. disambiguate between multiple power rails or pwr_in vs pwr_out or highlight odd behavior.

@ducky64 ducky64 requested a review from Suke0811 April 23, 2024 22:32
@ducky64 ducky64 enabled auto-merge (squash) April 23, 2024 22:46
Copy link
Collaborator

@Suke0811 Suke0811 left a comment

Choose a reason for hiding this comment

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

Good

@ducky64 ducky64 merged commit dda3378 into master Apr 23, 2024
9 checks passed
@ducky64 ducky64 deleted the member-docs branch April 23, 2024 22:46
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