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

feat: add type hints #161

Merged
merged 10 commits into from
Jul 12, 2023
Merged

feat: add type hints #161

merged 10 commits into from
Jul 12, 2023

Conversation

noahgorstein
Copy link
Member

@noahgorstein noahgorstein commented Jul 10, 2023

Overview

This PR adds type hints to majority of the code (not including tests) in pystardog. Type hints have several benefits - too many to add here but namely they can aid static analysis (e.g. mypy) of the code and make the code self-documenting. Type hints also aid many IDE's autocomplete support. I think this addition will make this library a bit more friendly to consumers.

Sphinx Autodoc Type Hints

This PR also leverages type hints for documentation purposes. Using an extension (sphinx-autodoc-typehints), we can actually generate parameter/return types without needing to explicitly document them in the docstring. See https://github.com/stardog-union/pystardog/tree/feature/type-hints#autodoc-type-hints for additional information.

I have rewritten/restructured a lot of docstrings in the repository such that they can leverage the newly added typehints as well.

Copy link
Collaborator

@scardena scardena left a comment

Choose a reason for hiding this comment

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

this is awesome! thanks for adding this.

@noahgorstein noahgorstein merged commit 092a485 into main Jul 12, 2023
@noahgorstein noahgorstein deleted the feature/type-hints branch July 12, 2023 13:14
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