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

Add Python type stub file #1867

Merged
merged 1 commit into from
Aug 7, 2024
Merged

Conversation

N-Wouda
Copy link

@N-Wouda N-Wouda commented Aug 6, 2024

This PR closes #1866. It adds a Python type stub file that covers the content of the _core native extensions.

I generated these stubs using mypy's stubgen, as follows:

stubgen --parse-only -o . -m _core

I then checked the stub file for any errors, and although it can always be improved, I think this'll suffice as an initial default. It's certainly enough to provide Python users with meaningful type information and autocompletion when working with highspy.

@N-Wouda N-Wouda changed the title Add type stub file Add Python type stub file Aug 6, 2024
@jajhall jajhall requested a review from galabovaa August 6, 2024 20:20
@N-Wouda
Copy link
Author

N-Wouda commented Aug 6, 2024

One thing I'm not entirely sure of is how to keep the type stubs in sync with the actual extension going forward. In my own projects I write these files largely myself and thus also keep them up to date, but I can imagine you might not want to spend a lot of (human) time with this. In that case doing stub generation during Python package builds could be worth investigating?

@jajhall jajhall added the enhancement New feature or request label Aug 7, 2024
Copy link
Contributor

@galabovaa galabovaa left a comment

Choose a reason for hiding this comment

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

Thank you! We will keep in mind to update this when we update highspy, and, as you say, it may be worth automating. Looks good to me!

@jajhall jajhall merged commit ddd3778 into ERGO-Code:latest Aug 7, 2024
110 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants