-
Notifications
You must be signed in to change notification settings - Fork 481
Make gramps.gen.lib.primaryobj
typed
#2018
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
base: master
Are you sure you want to change the base?
Conversation
Yes. The code should run on python 3.10 in the master branch. |
Do we want CI builds for that so that people like me don't accidentally break things? |
b06d8d1
to
4117589
Compare
The CI is running 3.10 in the master branch and I run 3.13 locally. |
Oh right, I confused the linter action (which passed) with the CI one which is the one that actually runs mypy (soz!). I updated the PR to use |
96c8d60
to
e2464be
Compare
e2464be
to
ee27bd4
Compare
ee27bd4
to
9ac4928
Compare
Why are the docstrings mostly removed or truncated? Does the documentation tool use the type hints? (Sorry if I have not understood the significance of the typing.override). |
@kulath Fair question! I erroneously assumed this was part of the https://peps.python.org/pep-0698/#set-override-true-when-possible says:
|
@bartfeenstra Thanks for the response. I note that the quoted comment says "could". It also talks about using a run-time library, whereas I am thinking about the generated documentation. I am not sure whether Sphinx will actually generate the documentation correctly. I am looking at https://gramps-project.org/api_3_3_x/api.html (I know this is out of date, but I didn't take the time to find the current doc.) I wonder whether it would be possible for you to generate the documentation from this modified code, and se whether it correctly uses the typing.override ? Edit to add: This is the current documentation https://gramps-project.org/docs/gen/gen_lib.html |
Sphinx does this, yeah. See https://betty.readthedocs.io/stable/betty.ancestry.person/#betty.ancestry.person.Person.dump_linked_data for an example of an overriden method that inherits its parent's docstring. |
This PR:
gramps.gen.lib.primaryobj
, as well as any methods overridden in subclassestyping.override
to help mypy ensure subclasses override methods correctly, and for them to inherit the parents' docstrings (hence the large number of removals).