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

Accept os.PathLike in addition to str for paths in public API #392

Merged
merged 14 commits into from Oct 27, 2021
2 changes: 1 addition & 1 deletion src/build/__init__.py
Expand Up @@ -50,7 +50,7 @@

RunnerType = Callable[[Sequence[str], Optional[str], Optional[Mapping[str, str]]], None]
ConfigSettingsType = Mapping[str, Union[str, Sequence[str]]]
PathType = Union[str, os.PathLike[str]]
PathType = Union[str, 'os.PathLike[str]']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do from __future__ import annotations instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Python 3.6 hasn't hit EoL.

Besides, they are talking about deprecating that in 3.11 and removing it in 3.13. 😠

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah 😕

Yeah, it will likely be replaced by co_annotations, but I haven't been following the progress closely.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might have to do a version check here actually.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's safe to do a string inside this, it'll be a ForwardRef. Also, from __future__ import annotations wouldn't work here, this is not an annotation.

https://discuss.python.org/t/type-annotations-pep-649-and-pep-563/11363 for the annotation discussion.

_ExcInfoType = Union[Tuple[Type[BaseException], BaseException, types.TracebackType], Tuple[None, None, None]]


Expand Down
2 changes: 0 additions & 2 deletions src/build/util.py
Expand Up @@ -5,8 +5,6 @@
import sys
import tempfile

from typing import Union

import pep517

import build
Expand Down