This is a PEP-561-compliant stub-only package, which provides type information for matplotlib. The mypy type checker (or pytype or PyCharm) can recognize the types in these packages by installing this package.
Many functions are already typed, and things can still be missing.
Chances are, you will see a message from mypy
claiming that a function does not exist when it does exist.
If you encounter missing functions, I would be delighted for you to send a PR.
If you are unsure of how to type a function, I can discuss it.
You can get this package only from Github, following the instructions below Publishing to PyPi may follow.
To get the most up-to-date version, install it directly from GitHub:
pip install git+https://github.com/stdedos/data-science-types
Or clone the repository somewhere and do pip install -e .
.
The goal is not to recreate the APIs exactly. The main goal is to have useful checks on our code. Often the actual APIs in the libraries is more permissive than the type signatures in our stubs; but this is (usually) a feature and not a bug.
We always welcome contributions.
All pull requests are subject to CI checks.
We check for compliance with mypy
and that the file formatting conforms to our Black specification.
You can install these dev dependencies via
pip install -e '.[dev]'
This will also install NumPy, pandas, and Matplotlib to be able to run the tests.
We include a script for running the CI checks that are triggered when a PR is opened. To test these out locally, you need to install the type stubs in your environment. Typically, you would do this with:
pip install -e .
Then use the check_all.sh
script to run all tests:
./check_all.sh
Below we describe how to run the various checks individually,
but check_all.sh
should be easier to use.
The settings for mypy
are specified in the mypy.ini
file in the repository.
Just running:
mypy tests
from the base directory should take these settings into account.
We enforce 0 mypy
errors.
We use Black to format the stub files.
First, install black
and then run:
black .
from the base directory.
python -m pytest -vv tests/
flake8 *-stubs