fix: __package__ -> __spec__.parent#294
Conversation
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
| assert __spec__ is not None | ||
| assert __spec__.parent is not None | ||
| return load(name, f"{__spec__.parent}.plugins") |
There was a problem hiding this comment.
| assert __spec__ is not None | |
| assert __spec__.parent is not None | |
| return load(name, f"{__spec__.parent}.plugins") | |
| return load(name, f"{PARENT}.plugins") |
There was a problem hiding this comment.
Yeap, this change would be interesting.
| deps = mypy | ||
| commands = | ||
| python -m mypy {posargs:--pretty --show-error-context src} | ||
| mypy src |
There was a problem hiding this comment.
| mypy src | |
| mypy {posargs: src} |
I could keep the extra formatting flags here too, I was checking to see if it worked hard coding them.
There was a problem hiding this comment.
OK so this change basically undoes the proposed change in #131 (comment), right?
So does it mean that vscode/pycharm/iterm or GitHub Actions no longer have the problem with parsing the output?
abravalheri
left a comment
There was a problem hiding this comment.
Thank you very much Henry!
| assert __spec__ is not None | ||
| assert __spec__.parent is not None | ||
| return load(name, f"{__spec__.parent}.plugins") |
There was a problem hiding this comment.
Yeap, this change would be interesting.
|
|
||
| def run(args: Sequence[str] = ()) -> int: | ||
| assert __spec__ is not None | ||
| assert __spec__.parent is not None |
There was a problem hiding this comment.
Possibly we assign a _PARENT constant here too?
Then the asserts can be done only once.
|
|
||
| assert __spec__ is not None | ||
| assert __spec__.parent is not None | ||
| PARENT = __spec__.parent |
There was a problem hiding this comment.
maybe _PARENT to avoid people thinking it is a public member?
| deps = mypy | ||
| commands = | ||
| python -m mypy {posargs:--pretty --show-error-context src} | ||
| mypy src |
There was a problem hiding this comment.
OK so this change basically undoes the proposed change in #131 (comment), right?
So does it mean that vscode/pycharm/iterm or GitHub Actions no longer have the problem with parsing the output?
I was reworking the typing job a bit, mostly to try
ty, and it noticed that we are using__package__, which is scheduled for removal in 3.15. I moved this over to the replacement. This includes the original restructuring to try outty, which also removes the pin on Python.tomlihas to be required unconditionally. And the typechecking tool is moved to the job, since you could be using a different tool (likety).