Skip to content

Small enhance type hints#1168

Open
9en9i wants to merge 2 commits intojmcnamara:mainfrom
9en9i:feature/typings
Open

Small enhance type hints#1168
9en9i wants to merge 2 commits intojmcnamara:mainfrom
9en9i:feature/typings

Conversation

@9en9i
Copy link
Copy Markdown

@9en9i 9en9i commented Dec 17, 2025

Adds a few type annotations that may be useful.

…odules

refactor: enhance type hints across format, workbook, and worksheet modules

refactor: enhance type hints across format, workbook, and worksheet modules
@9en9i
Copy link
Copy Markdown
Author

9en9i commented Dec 17, 2025

Do you accept PRs that don't have a comprehensive approach? Or what do I need to do to get the PR accepted?

@jmcnamara
Copy link
Copy Markdown
Owner

Overall it looks good. I'll try to include it in the next release.

@jmcnamara jmcnamara self-assigned this Dec 18, 2025
@jmcnamara jmcnamara added the in progress The fix/feature is being worked on. label Dec 18, 2025
@jmcnamara
Copy link
Copy Markdown
Owner

BTW, do you have any specific reason for adding these, apart from just increasing the type information in XlsxWriter?

Linked to #1123

@9en9i
Copy link
Copy Markdown
Author

9en9i commented Dec 18, 2025

Yes, I use this library in my code.

return self._add_sheet(name, worksheet_class=chartsheet_class)

def add_format(self, properties=None) -> Format:
def add_format(self, properties: Optional[Dict[str, Any]] = None) -> Format:
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Perhaps it would make sense here to accept not just a string as the key, but a list of literals (fields from the Format class)? What do you think? @jmcnamara

@9en9i
Copy link
Copy Markdown
Author

9en9i commented Dec 25, 2025

Please tell me, do you want to add anything else before merging this PR?

@9en9i
Copy link
Copy Markdown
Author

9en9i commented Dec 25, 2025

Another question: as you know, Python 3.9 has reached end of life. Can I make a separate PR where the minimum Python version will be 3.10 (while updating the annotations to the newer version)? Or are you planning to keep support for Python 3.8 and 3.9?

@jmcnamara
Copy link
Copy Markdown
Owner

Please tell me, do you want to add anything else before merging this PR?

No. It looks fine. I just have a backlog of other things to get through first.

@jmcnamara
Copy link
Copy Markdown
Owner

Or are you planning to keep support for Python 3.8 and 3.9?

I don't usually rush to deprecate older Python version support unless there is a good reason but I would like to be able to use the | simplified type union operator in Python 3.10 so I may deprecate that in the next, or next +1, release. Maybe as part of the pyproject.toml changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in progress The fix/feature is being worked on.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants