Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding type hints #135

Closed
sbdchd opened this issue Aug 10, 2020 · 8 comments · Fixed by python/typeshed#7972 or #198
Closed

Adding type hints #135

sbdchd opened this issue Aug 10, 2020 · 8 comments · Fixed by python/typeshed#7972 or #198

Comments

@sbdchd
Copy link

sbdchd commented Aug 10, 2020

I was wondering if you'd be open to adding type hints to the repo?

Otherwise, would it be okay if I added them to https://github.com/python/typeshed/

sbdchd added a commit to chdsbd/kodiak that referenced this issue Aug 11, 2020
Now we explicitly ignore specific imports instead of a blanket ignore
on all missing types.

Upgraded databases and pytest to get their latest versions which include
types, for the rest we're ignoring them explicitly.
see #485

- arrow

  doesn't have types but we can replace it with std library calls

- requests_async

  deprecated in favor of httpx, so we'd need to upgrade to get types.
  The API of httpx is a little different as well.

- structlog

  doesn't have types currently

  hynek/structlog#165

- rure

  No stubs yet

  davidblewett/rure-python#23

- pytest_mock

  types recently added to the typeshed so we'll need to wait for the next
  release of mypy.

  pytest-dev/pytest-mock#152

- markdown_html_finder

  Wrapper around some Rust code. Needs stubs to be added.

  chdsbd/markdown-html-finder#5

- asyncio_redis

  We're our own fork of it, but adding types would be rather manual.
  Granted we aren't using that much of the API surface.

  https://github.com/chdsbd/asyncio-redis

- zstandard

  No stubs yet, so we're ignoring for the time being

  indygreg/python-zstandard#120

- inflection

  Types, but I think they're misconfigured, once they're fixed we can
  unignore.

  jpvanhal/inflection#49

- django

  Need to setup django-stubs for this to work since django doesn't have
  any static types.

  https://github.com/TypedDjango/django-stubs

- dj_database_url

  Doesn't have any static types yet

  jazzband/dj-database-url#135

- responses

  No types yet

  getsentry/responses#339

- stripe

  Plan for types, but they don't exist currently

  stripe/stripe-python#650
kodiakhq bot pushed a commit to chdsbd/kodiak that referenced this issue Aug 11, 2020
Now we explicitly ignore specific imports instead of a blanket ignore
on all missing types.

Upgraded databases and pytest to get their latest versions which include
types, for the rest we're ignoring them explicitly.
see #485

- arrow

  doesn't have types but we can replace it with std library calls

- requests_async

  deprecated in favor of httpx, so we'd need to upgrade to get types.
  The API of httpx is a little different as well.

- structlog

  doesn't have types currently

  hynek/structlog#165

- rure

  No stubs yet

  davidblewett/rure-python#23

- pytest_mock

  types recently added to the typeshed so we'll need to wait for the next
  release of mypy.

  pytest-dev/pytest-mock#152

- markdown_html_finder

  Wrapper around some Rust code. Needs stubs to be added.

  chdsbd/markdown-html-finder#5

- asyncio_redis

  We're using our own fork of it, but adding types would be rather manual.
  Granted we aren't using that much of the API surface.

  https://github.com/chdsbd/asyncio-redis

- zstandard

  No stubs yet, so we're ignoring for the time being

  indygreg/python-zstandard#120

- inflection

  Types, but I think they're misconfigured, once they're fixed we can
  unignore.

  jpvanhal/inflection#49

- django

  Need to setup django-stubs for this to work since django doesn't have
  any static types.

  https://github.com/TypedDjango/django-stubs

- dj_database_url

  Doesn't have any static types yet

  jazzband/dj-database-url#135

- responses

  No types yet

  getsentry/responses#339

- stripe

  Plan for types, but they don't exist currently

  stripe/stripe-python#650
kodiakhq bot pushed a commit to chdsbd/kodiak that referenced this issue Nov 13, 2020
Added basic type stubs for some of the smaller libraries the bot and
web_api use.

We put the types in the `typings` folder which we configure in the Mypy, 
but is also the [default path that pyright looks at](https://github.com/microsoft/pyright/blob/b9e61e9f2ae6179284fed8e7b534e5dcb46c8f8b/docs/configuration.md)
so pylance should just work.

Libraries with missing types that remain:
- structlog, waiting on the release of its typed api
- requests_async, need to convert to httpx which has types
- asyncio_redis, maybe write stubs, or use a different client
- django, stubs exist, last time we tried it, there were a number of
  false positives
- stripe, no types currently, could probably write some minimal stubs
  rel: stripe/stripe-python#650


rel: indygreg/python-zstandard#120
rel: davidblewett/rure-python#23
rel: jazzband/dj-database-url#135
@XF-FW
Copy link

XF-FW commented Apr 26, 2022

Hey @sbdchd . Since, you got no reply after 2 years, could you add the types you've setup on kodiak to the typeshed?

If you would prefer, I could do it as well, but since it's your code, I think you should do it. Just let me know!

Thank you!

@sbdchd
Copy link
Author

sbdchd commented Apr 26, 2022

@XF-FW feel free to do it!

@mattseymour
Copy link
Contributor

I think with where python is no Adding type hints is a good shout. All the supported python version are now typehint compliant.

@XF-FW
Copy link

XF-FW commented May 28, 2022

As of earlier today, you can now have typing support for this package, by installing the types-dj-database-url package.

@palfrey palfrey mentioned this issue Dec 13, 2022
@palfrey
Copy link
Member

palfrey commented Dec 14, 2022

#198 adds in type hints (and mypy checks for them)

@XF-FW
Copy link

XF-FW commented Dec 21, 2022

Could you let me know when this gets released, so I can deprecate the types-dj-database-url package from typeshed as per their policy[0] ?

[0] https://github.com/python/typeshed/blob/main/CONTRIBUTING.md#third-party-library-removal-policy

@palfrey
Copy link
Member

palfrey commented Feb 20, 2023

@mattseymour Can we do a new release with this in?

@mattseymour
Copy link
Contributor

I will take into doing this shortly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants