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

No type annotations for find_uv_bin #1677

Closed
gaborbernat opened this issue Feb 19, 2024 · 5 comments · Fixed by #1728
Closed

No type annotations for find_uv_bin #1677

gaborbernat opened this issue Feb 19, 2024 · 5 comments · Fixed by #1728
Labels
good first issue Good for newcomers question Asking for clarification or support

Comments

@gaborbernat
Copy link
Contributor

gaborbernat commented Feb 19, 2024

I'm using find_uv_bin inside https://github.com/tox-dev/tox-uv/blob/main/src/tox_uv/_venv.py#L14, but mypy complain that this method is not exposed (no __all__ containing it) and also no type annotations for it (because https://peps.python.org/pep-0561/#packaging-type-information is missing from the Python package, plus actual type annotations for it)

@zanieb
Copy link
Member

zanieb commented Feb 19, 2024

Hi! This is not a public function, __main__ is intended for internal use only.

We could consider exposing find_uv_bin in __init__ but I would say in general we are very hesitant to commit to a Python API at this stage.

@zanieb zanieb added the question Asking for clarification or support label Feb 19, 2024
@gaborbernat
Copy link
Contributor Author

In the world of Python __main__ is a public module... You might want to move it to something like _uv... But I'd ask for this one method to be public 😅

@zanieb
Copy link
Member

zanieb commented Feb 19, 2024

I mean, it's Python everything is "public". I don't think __main__ is a module you're meant to be importing things from. It's meant to be a script entrypoint for the module.

@gaborbernat
Copy link
Contributor Author

gaborbernat commented Feb 19, 2024

That's not true by convention anything starting with an underscore is considered private.

Magic modules are also considered public as far as I understand, so yes, they are meant to be importable. They just also serve another functionality on top of that.

@zanieb
Copy link
Member

zanieb commented Feb 19, 2024

I would strongly discourage you from importing from our __main__ module. Whether by convention or not (I cannot find any documentation saying either way), this is not a part of our public API.

It looks like it does have type annotations already? I'm happy to add a py.typed marker and consider moving it to __init__.py though if it's useful. I'm surprised we haven't gotten similar requests in Ruff (which has an identical setup).

@zanieb zanieb added the good first issue Good for newcomers label Feb 19, 2024
@sbrugman sbrugman mentioned this issue Feb 19, 2024
zanieb pushed a commit that referenced this issue Feb 20, 2024
Resolves #1677

Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers question Asking for clarification or support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants