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

Contribute all good stuff to mypy.stubgenc and freeze this repo #31

Closed
5 of 7 tasks
sizmailov opened this issue Aug 4, 2020 · 11 comments
Closed
5 of 7 tasks

Contribute all good stuff to mypy.stubgenc and freeze this repo #31

sizmailov opened this issue Aug 4, 2020 · 11 comments
Labels
help wanted Extra attention is needed

Comments

@sizmailov
Copy link
Owner

sizmailov commented Aug 4, 2020

At the point when mypy.stubgen (or other) will be able to generate full-featured stubs for pybind11 there would be no need in this tool.

Things to ship:

  • function signatures
  • default argument parsing
  • attribute types
  • attribute values
  • nested classes
  • functions with positional-only arguments
  • pybind11-specific type transformations (e.g. iterator -> typing.Iterator)
@sizmailov sizmailov added the help wanted Extra attention is needed label Aug 4, 2020
@sizmailov sizmailov pinned this issue Aug 4, 2020
@sizmailov sizmailov unpinned this issue Aug 19, 2020
@sizmailov sizmailov pinned this issue Aug 19, 2020
@virtuald
Copy link
Contributor

FWIW, I like the smallness of this dependency. Just copy a single file to a repo and we're good to go. :)

@sizmailov
Copy link
Owner Author

Finally I've managed to make some progress here (see https://github.com/sizmailov/mypy/tree/enhance-stubgenc-pybind-compatibility).

Hopefully I'll be able to split mentioned branch into a couple of PRs and make it's way to official mypy repo.

I'll keep this issue update along the progress with PRs. Comments/reviews as always are very welcome.

@sizmailov
Copy link
Owner Author

sizmailov commented Jan 20, 2021

First PR is merged 🎉 python/mypy#9877
A bit more is on the way.
With those two stubgen will be dangerously really close to pybind11-stubgen output :)

@hiaselhans
Copy link

thanks for the good work @sizmailov !! :)

@allanleal
Copy link

Great work. Please keep it on!

@varunsh-xilinx
Copy link

@sizmailov are you also planning on contributing your docstring parsing? Currently, the stubs from mypy don't have docstrings and there's an open issue suggesting it could be an added option.

@sizmailov
Copy link
Owner Author

Sorry, I don't have time/plans to contribute to mypy in foreseeable future.
I'm personally unsatisfied with my docstring parsing implementation to contribute it anywhere, especially to a mature project such as mypy.
At the same time, I don't mind if you reuse parts (or even all) of my code to create a PR to mypy or any other project. Feel free to do so without asking, and don't worry about my credits.

@cunnane
Copy link

cunnane commented Sep 8, 2022

Please don't give up :) I'm using your codebase to create documentation stubs: I want to publish docs on readthedocs but don't want to build the pybind binary there (in fact I can't because it's MSVC-only...). Just tweaking a few lines was all that was necessary for this use case

@sizmailov sizmailov unpinned this issue Aug 29, 2023
@sizmailov
Copy link
Owner Author

I didn't return to the problem for quite some time and I'm not planning to in foreseeable future. So closing as not planned.

@sizmailov sizmailov closed this as not planned Won't fix, can't repro, duplicate, stale Aug 29, 2023
@bluenote10
Copy link

Out of curiosity: What exactly is the relationship between this implementation and mypy.stubgen? Is one of them using the other, or did they start as a fork of each other or so? The original issue sounded like mypy.stubgen is the better place to have this functionality. So just curious what made you change your mind -- the amount of work involved, or are there simply too many pybind11 specific features involved that would making an integration into mypy difficult?

@sizmailov sizmailov pinned this issue Oct 8, 2023
@sizmailov
Copy link
Owner Author

@bluenote10 Initially, I was unsatisfied with how mypy.stubgen performed on my pet project, and I decided to make a tool to get things done quickly.

At some point, I thought it would be nice to avoid the responsibility of solely maintaining a package with long-standing bugs/feature requests, so I've contributed a few features to mypy.stubgen. It was too slow and time-consuming and I was carried away by other things.

I think there is a need for stubgen as:

  1. an opinionated CLI tool with a handful of options, for the most common use cases
  2. a flexible library, to obtain fine-tuned results

I believe mypy.stubgen could satisfy the first but not the second. So, pybind11-stubgen and mypy.stubgen would co-exist for quite a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

7 participants