Giter Site home page Giter Site logo

Type hints for python? about pycolmap HOT 4 CLOSED

Coelhomatias avatar Coelhomatias commented on June 27, 2024
Type hints for python?

from pycolmap.

Comments (4)

sarlinpe avatar sarlinpe commented on June 27, 2024

This is most likely due to your IDE or plug-in not relying on or parsing the help output. Maybe it's expecting the function to have a docstring in a given format? We could try to add one as described here and see if this solves your issue. I don't have time for this at the moment, but feel free to give it a try and contribute it back with a PR if it works.

from pycolmap.

Coelhomatias avatar Coelhomatias commented on June 27, 2024

I'm sorry I don't have much knowledge in this subject. I use VSCode with Pylance. From my understanding and what I read online. For Pylance to understand the types of the module it is necessary a stub file. This stubfile can be generated with pybind11-stubgen or with mypy's stubgen. Both of them give me errors when trying to generate the stubs because some missing imports.
Despite this, a stub file is indeed generated but I can't get Pylance to know about this.
I am not a C/C++ developer and I don't know how to modify make files, however, I think this can be added to the build process.
I will be working extensively with colmap and pycolmap for the remainder of the year and would be happy to (eventually) contribute, however, I too don't have enough time to learn the necessary skills for now. Maybe in the future I'll submit a PR regarding this issue.

from pycolmap.

Phil26AT avatar Phil26AT commented on June 27, 2024

Hi @Coelhomatias, I just tried generating stubfiles with pybind11-stubgen pycolmap. It will create a file stubs/pycolmap.pyi. You need to move it into the same folder as the pycolmap.cpython*.so file (with a source install you can just put it into the pycolmap folder). Then VSCode gives correct types (where available, arguments with type py::object will show ...) and auto-complete also works.

from pycolmap.

Coelhomatias avatar Coelhomatias commented on June 27, 2024

@Phil26AT Thank you very much, you just saved me a lot of time and effort!

from pycolmap.

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.