Skip to content

Conversation

@signedav
Copy link
Member

@signedav signedav commented Nov 18, 2025

  • Concert headers to preferred Google style
  • Convert existing ReSt Docstrings to Google style
  • Complete type hints. Resolves Complete type hints #99
    If time left
  • Generate docstrings templates according to type hints with AI
  • Fill up docstrings templates manually

@signedav signedav changed the title Docstring Not yet the docstrings, but the base before we create docstrings Nov 28, 2025
@signedav
Copy link
Member Author

My goal was to invest a day in documentation of the library, like with docstrings etc. But in the end the docstrings are massively easier to generate when there are already proper typehints. And for working with the library they are at least as valuable. So these are at least the typehints of all the functions.

Header format in proper py docsting style

Header docstring in proper format

headers of processing
@signedav signedav changed the title Not yet the docstrings, but the base before we create docstrings Typehints etc: Not yet the docstrings, but the base to create docstrings Nov 28, 2025
@signedav signedav marked this pull request as ready for review November 28, 2025 16:29
Type hints for iliwrapper

Typehints for generator

Type hints for utils

Type hints for ilitoppingmaker
@signedav signedav requested a review from gacarrillor December 1, 2025 10:40
@signedav
Copy link
Member Author

signedav commented Dec 1, 2025

Same weird test result on latest release only... 🤔

Copy link
Member

@gacarrillor gacarrillor left a comment

Choose a reason for hiding this comment

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

Since it's a massive PR, I must admit I didn't do an exhaustive check here. However, I spotted some minor issues that I addressed as comments.

Otherwise, very welcome changes!

def db_or_schema_exists(self):
def db_or_schema_exists(self) -> bool:
"""Whether the DB (for GPKG) or schema (for PG) exists or not."""
raise NotImplementedError
Copy link
Member

Choose a reason for hiding this comment

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

This was there to make it clear for subclasses which methods do need to be overridden.

Perhaps we can remove the line as you did and stick now to @abc.abstractmethod? See https://stackoverflow.com/a/44316506

Copy link
Member Author

Choose a reason for hiding this comment

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

ah okay. But we are not consequent here. Why the db_or_schema_exists and the create_db_or_schema is abstract but not the metadata_exists is?

Copy link
Member Author

Choose a reason for hiding this comment

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

What about having this on our to do list when going on with this:

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good. For the changes we could keep in mind that DBConnector should be abstract, so that nobody can use it directly, but should use subclasses instead.

def get_db_connector(configuration):
def get_db_connector(
configuration: Ili2DbCommandConfiguration,
) -> GPKGConnector | PGConnector | MssqlConnector:
Copy link
Member

Choose a reason for hiding this comment

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

Not sure what's the recommended approach here. Could it be DBConnector instead?
If we add Oracle to DBConector subclasses, updating this typing hint would be easily forgotten.

Copy link
Member Author

Choose a reason for hiding this comment

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

One cannot really use a DbConnector, that's why I took the "real" types here.

Not sure if there will be another database added that quickly, but probably you are right.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, both make sense. I'm fine with any approach here.

@signedav signedav merged commit e4473fd into main Dec 2, 2025
5 of 6 checks passed
@signedav signedav deleted the docstring branch December 2, 2025 14:20
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.

Complete type hints

3 participants