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

A more accurate termcolor.colored fallback #9435

Merged
merged 2 commits into from
Dec 31, 2022

Conversation

Avasam
Copy link
Sponsor Collaborator

@Avasam Avasam commented Dec 31, 2022

utils.colored's signature now correctly reflects termcolor.colored
Attempt in scripts/runtests.py to deduplicate the same fallback (using utils module in an outside folder).
I think the solution is fine, but you tell me. VSCode can pick-up the source just fine, mypy might need an extra mypy_path="tests" to remove # type: ignore[import] at line 13.
Edit: Apparently it wasn't a great solution (see comments below)

@AlexWaygood
Copy link
Member

Eeeeee, I have a strong aversion to mucking about with sys.path 😅 I've heard lots of horror stories about where that gets you...

@Avasam
Copy link
Sponsor Collaborator Author

Avasam commented Dec 31, 2022

[...] I've heard lots of horror stories about where that gets you...

I'll trust your experience on that !
If there's no better solution, it's not that bad of a code duplication, so I can go back to using a fallback (but the one with proper signature).
I was thinking eventually it could use the test scripts directly from within python, instead of having to call a subprocess.

@AlexWaygood
Copy link
Member

If there's no better solution, it's not that bad of a code duplication, so I can go back to using a fallback (but the one with proper signature).

Yeah, that sounds fine to me for now :)

@AlexWaygood AlexWaygood merged commit 46f0d91 into python:main Dec 31, 2022
@Avasam Avasam deleted the termcolor.colored-type-declaration branch December 31, 2022 23:17
@AlexWaygood AlexWaygood changed the title Accurate, deduplicated, termcolor.colored fallback A more accurate termcolor.colored fallback Jan 1, 2023
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 this pull request may close these issues.

2 participants