Git Product home page Git Product logo

typeannotations's People

Contributors

carlsverre avatar ceronman avatar dahlia avatar moritzs avatar ntoll avatar terrycojones avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

typeannotations's Issues

Couldn't find this library in PyPI

I've searched some Python 3 libraries to typecheck using the function annotation, and found this library. I was fascinated by its features, but I got a problem that it wasn't yet uploaded on Python Package Index(PyPI), so I couldn't install it with pip install typeannotations, and couldn't simply include it as a dependency. Therefore it becomes a huge burden for maintainability. setup.py was already included in this repository, However, I wonder the reason it wasn't distributed on PyPI.

If you're just deferring the distribution, I wish to mention that anyone can register their packages on PyPI with any unused name without any verifications, and if the name was taken once, it cannot be released as unused until the owner who took the name firstly will drop it or yield it. That's why Pillow have to use different name instead of PIL, and the current maintainer of setuptools had released its enhanced version as a different name, distribute. So if you're willing to upload this library as typeannotations, I suggest doing it as quick as possible to acquire the name. Although your first release is 0.1.0 or less, it's ok to me. I can deal with it and many people also will do.

This is a great library that will be applicable immediately (unlike mypy), so It can be very helpful to many Python 3 users by a little effort. Please consider uploading it on PyPI.

Is set of types supported?

This is really a question, not an issue: is there a way to implement a type-annotated function that takes arguments of different but compatible types, such as "int" and "float"? I was thinking of the set syntax, such as:

@typechecked def f(x: {int, float}): return x*2

Thank you!

Accept `None` as return type

You should allow to write something like that to indicate there is no return (=void)

@typechecked
def rettest(self) -> None:
    print("Hello World")

But Actually

Hello World
Traceback (most recent call last):
[...]
  File "[...]/annotation/typed.py", line 500, in wrapper
    return _check_return_type(signature, target(*args, **kwargs))
  File "[...]/annotation/typed.py", line 477, in _check_return_type
    raise TypeError('Incorrect return type')
TypeError: Incorrect return type

is thrown and you had to use

@typechecked
def rettest(self) -> type(None):
    print("Hello World")

but writing that is ugly and PEP484 defines that

When used in a type hint, the expression None is considered equivalent to type(None) .

so you should also allow None as type.

This is an alternative to #8 .

would be nice to support __debug__

When python runs with -O __debug__ is set to False. This allows the optimizer to remove bytecode that is protected by an if __debug__: completely. Perhaps providing a @debugtyped decorator that was protected would be nice for people who only want type checking during development?

Just an idea.

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.