Git Product home page Git Product logo

Comments (5)

Varriount avatar Varriount commented on May 14, 2024

I'll try my hand at this. I think I can do this, at least for pure/mixed python modules, don't know about Pure C modules though.

from mypy.

ashleyh avatar ashleyh commented on May 14, 2024

I have already started this at https://github.com/ashleyh/mypy-stubgen but
feel free to improve it! I can tell you some things that need fixing if you
like....

On 24 January 2013 16:47, Varriount [email protected] wrote:

I'll try my hand at this. I think I can do this, at least for
pure/mixed python modules, don't know about Pure C modules though.


Reply to this email directly or view it on GitHubhttps://github.com//issues/43#issuecomment-12660415.

from mypy.

Varriount avatar Varriount commented on May 14, 2024

Well, what needs fixing? This may sound strange, but I prefer being told what to do, rather than trying to improve things on my own.
Edit - Looking at the stubgen layout, wouldn't it be better to actually parse the python files, the same way that mypy does? Simply importing files can be.. problematic if modules are made to run processes and such on import.

from mypy.

JukkaL avatar JukkaL commented on May 14, 2024

I actually just added some issues to the mypy-stubgen issue tracker ;-)

I also added a link to the code on the mypy wiki page.

Parsing Python files could be useful for things like attributes of Python classes. Doing the analysis at runtime can be useful, as it lets the tool also inspect C extension modules and it can inspect the runtime types of variables, etc.

from mypy.

JukkaL avatar JukkaL commented on May 14, 2024

I've reimplemented stub generation (https://github.com/JukkaL/mypy/blob/master/mypy/stubgen.py). It actually has two stub generators, one for Python modules and one for C modules. It generates Python module stubs from the AST, and it uses runtime inspection for C modules. It only supports Python 3 as of now. I've already generated a bunch of (dynamically typed) stubs for modules such as zlib, xml.etree, etc.

from mypy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.