Code Monkey home page Code Monkey logo

stub-package's Introduction

Stub package

This is an example of a PEP-561 compliant stub package. It ships stubs for the package in https://github.com/ethanhs/pep-561, another sample PEP 561 compliant package.

License

This package doesn't do anything original, but just in case, any original work within is licensed under the CC0

stub-package's People

Contributors

ethanhs avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

jvlar edf-re

stub-package's Issues

stub-package for python modules or extensions?

Hi, thank you very much for providing examples for PEP 561

Just for curiosity I have installed this library with

pip install https://github.com/ethanhs/stub-package/archive/refs/heads/master.zip

and found that my VSCode can see the typehints:

image

despite there is no typedpkg installed.

I am not interested in type hinting packages. I usually make Python extensions or modules with type hints in .pyi stub files.
in this context:

  • packages are folders of python code with or without an __init__.py.
  • modules are modulename.py files.
  • extensions are mymodule.___.pyd or mymodule.___.so files.

This repository is a great example to add stub files for packages, but would it be correct to use it for modules or extensions?

I currently have:

setup(
    name='mymodule',
    ext_modules=[Extension(name='mymodule', ...)],
    data_files=[('.', ['mymodule.pyi'])],
)

This is obviously not correct as '.' is not a package, but it seemed to work and I used it here.

Moving mymodule.pyi to mymodule-stubs/__init__.pyi and changing the setup code to:

setup(
    name='mymodule',
    ext_modules=[Extension(name='mymodule', ...)],
    package_data={'mymodule-stubs': ['__init__.pyi']},
    packages=['mymodule-stubs'],
)

This might be also inappropiate as mymodule is an extension not a package.

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.