https://github.com/kornicameister/loguru-mypy
mypy plugin for loguru
https://github.com/kornicameister/loguru-mypy
logging loguru mypy plugin typing
Last synced: about 3 hours ago
JSON representation
mypy plugin for loguru
- Host: GitHub
- URL: https://github.com/kornicameister/loguru-mypy
- Owner: kornicameister
- License: mit
- Created: 2020-06-01T20:18:39.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-04-12T14:25:56.000Z (about 1 year ago)
- Last Synced: 2024-04-14T05:47:34.872Z (about 1 year ago)
- Topics: logging, loguru, mypy, plugin, typing
- Language: Python
- Homepage:
- Size: 232 KB
- Stars: 16
- Watchers: 4
- Forks: 3
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-python-typing - loguru-mypy - Plugin for [loguru](https://github.com/Delgan/loguru) support. (Tools / Mypy plugins)
README
# loguru-mypy
A fancy plugin to boost up your logging with [loguru](https://github.com/Delgan/loguru)

[](https://www.codetriage.com/kornicameister/loguru-mypy)


[](https://wakatime.com/badge/github/kornicameister/loguru-mypy)
[](http://mypy-lang.org/)## mypy compatibility
`logoru-mypy` should be compatible with `mypy>=0.770`.
Currently there is no limit as far as the compatibility can go. If you are interested to see
how far `loguru_mypy` goes you can visit [CI/CD action](./.github/workflows/ci.yml) and check its
matrix.## Installation
Simply execute:
```sh
pip install loguru-mypy
```And later on modify your `mypy.ini` configuration file with
```ini
[mypy]
plugins = loguru_mypy
```That is all, your code is now ready to be linted.
## What is included?
`loguru-mypy` is obviously a [mypy](https://github.com/python/mypy) plugin that allows to avoid
some of those little _runtime_ trickeries :).
Here is a short attempt to list some of those:### Lazy loggers
`logger.opt(lazy=True)` in facts returns a `logger` that we call _lazy_. Lazy loggers accept only
`typing.Callable[[], t.Any]` in place of positional or named arguments. Passing a callable that
accepts even a **single** argument thus results in runtime error. `loguru-mypy` detects that fact
and lets you know before your runtime reaches that portion of a code.