-
Notifications
You must be signed in to change notification settings - Fork 698
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
Implement mypy plugin for loguru #276
Conversation
31777eb
to
c78f5b9
Compare
@Delgan I took some liberty in designing how messages will look like. We can always tweak or adjust that. Waiting for tour feedback. There's of course a matter of documentation, but let's maybe approve code or functionality here ;) |
@@ -11,7 +11,11 @@ commands = | |||
coverage report -m | |||
|
|||
[pytest] | |||
addopts = -l | |||
addopts = -l --mypy-same-process --mypy-ini-file=typesafety/mypy.ini |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's quite awkward...tox
for some reason chokes on that :/. It shouldn't, I know for sure it works because this is what I have been using for some time.
testpaths = | ||
tests/ | ||
typesafety/ | ||
log_level = DEBUG |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can drop that log_level I believe. Sorry for not doing the before.
@Delgan do you have any idea how to fix that travis situation? I am not much of a travis user myself TBH :( |
Hey @kornicameister, thank you so much for all the work you've done! I had absolutely no idea it was possible to achieve such a level of accuracy with I don't know what's wrong with Travis but I actually encounter the same error on my local computer. While running So, I didn't know what a mypy plugin looked like back to a few days. I'm quite impressed you managed to make something fully working without even needing to modify the However, I don't think I want to maintain all of this with as much dedication as I'm trying for the rest of the codebase. Please tell me: what is your opinion about creating a new repository and library for Personally, I would feel more comfortable that way. Managing such a plugin involves a lot of new things to look after, there are potential bugs [1] and edge cases [2]. Not being myself a user of Of course the plugin will be mentioned in the documentation to ease discovery to those who may need it. What do you think? [1] This raises an exception inside the plugin: from operator import add
from loguru import logger
logger.info("Crash: {}", add) [2] This is reported as an error while it shouldn't: from loguru import logger
def foo(a, b):
a / b
try:
foo(1, 0)
except Exception:
logger.exception("An error occurred while executing: '{}'", foo) |
Plugins are normally not enabled by default, so this could mean we can have external repository. On the other hand that makes plugin harder to discover. Still...I have seen plugins done both ways. This is your repo, but if this plugin allows to avoid runtime problems, I would dare to suggest embedding and maintaing here. Otherwise this can go in external repo and be linked here as another Personally, I would prefer external repo just to get some "fame". But this is quite selfish and I am not really sure if that is better. TBH I wonder if checks match internal logic of loguru, which would be another reason to maintain plugin close to sources. |
I don't think there's a big discoverability problem because we have to mention at some point that a I agree that ideally it would be better to have all functionalities in one place. That would probably be the best. However, the more I think about it, the more I'd prefer it to be in a separate repository. At first I was not sure, but it's too much work otherwise. I'd be happy to contribute if I have the time though, but I'd have a "freer" mind. As I prefer not to have issues reported directly here, I think it should be explicitly installed separately instead of using Sorry I don't feel like integrating it directly into the codebase, but it's easier for me and it won't stop people from benefiting from your work. |
No worries. I wilk create a repo under my name. I was thinking about loguru organization for a while. But..yeah, we can always do that anytime later. |
@Delgan let's move entire discussion to linked PR. This PR; I am closing this PR now, |
Yep, great! Thanks again. 👍 I opened an new issue about documenting the |
Ports implementation of mypy plugin for loguru originally proposed here: Delgan/loguru#276.
Closes: #271