jpvanhal / inflection

A port of Ruby on Rails' inflector to Python
https://inflection.readthedocs.io
MIT License
495 stars 62 forks source link

fix: type hint config so they are available to mypy #52

Closed sbdchd closed 4 years ago

sbdchd commented 4 years ago

@sanzoghenzo correctly pointed out that a py.typed file alone wasn't enough to get the typing working, we also need to move inflection into a package.

I tested this by running ./.venv/bin/python setup.py sdist and installing the generated .tar.gz file into a blank project. First attempt without the setup.py changes didn't work, but moving to a package did.

example error:

main.py:3:21: error: Argument 1 to "camelize" has incompatible type "bool"; expected
"str"
    inflection.camelize(False)
                        ^
Found 1 error in 1 file (checked 1 source file)

fixes: https://github.com/jpvanhal/inflection/issues/49

rel: https://www.python.org/dev/peps/pep-0561/#packaging-type-information