-
Notifications
You must be signed in to change notification settings - Fork 253
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
typechecking poetry.core.masonry #274
Conversation
93f7187
to
955d823
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
@@ -206,10 +203,6 @@ def find_files_to_add(self, exclude_build: bool = True) -> Set["BuildIncludeFile | |||
if file.suffix == ".pyc": | |||
continue | |||
|
|||
if file in to_add: | |||
# Skip duplicates |
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.
to_add
is a set, it couldn't contain duplicates if it tried. Just need to be happy with __hash__
and __eq__
on the BuildIncludeFile
.
955d823
to
d3f48dd
Compare
d3f48dd
to
d57e384
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
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.
suggest moving the adding of mypy
to a separate PR
672e316
to
a2e26b3
Compare
Ugh, merge conflicts. So de-motivating. I don't think this is waiting on anything, can we get it merged please? @finswimmer? (I have removed mypy from pyproject.toml in case that was controversial, though if that was a problem it's frustrating that no-one with the commit bit would say so) |
a2e26b3
to
810b42b
Compare
810b42b
to
70b2a62
Compare
target_dir: Path | None = None, | ||
) -> None: | ||
super().__init__(poetry, executable=executable) | ||
self._target_dir = target_dir |
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.
Not sure if this is desired. Iirc build is intended to be called multiple times with different target directories. You can default to cwd if desired though.
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.
The builders were inconsistent about whether they took a target directory on their constructor or on their build()
method. I have made them consistently put it on the constructor.
I think the suggestion is that we should jump the other way? ie remove the parameter from the constructors, put it on the build()
method?
(There's a default value either way)
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.
I suspect the inconsistency comes from the use of make_in
in the wheel builder. Happy for it to be unified as consistency here is better, with the following funcitonality maintained.
- There is a default target directory (which as you said is present either way).
- the
build()
method can accept target directory.
This can also mean that make_in / make becomes redundant. Will need to check downstream see if they are being used.
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.
I pushed a commit that does what I think we're agreeing - say if I've misunderstood
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.
make()
and make_in()
do indeed look redundant, happy to remove them if you want
@abn are we good to go? There was a question about potentially removing |
return self.path == other.path | ||
|
||
return self.path == other | ||
def __eq__(self, other: object) -> bool: |
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.
Why are we disallowing comparison with Path?
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.
Not disallowing, but always returning False.
Because a BuildIncludeFile is not a Path!
b1acaf6
to
cb3ed03
Compare
cb3ed03
to
52597de
Compare
@abn are we waiting on anything to get this merged? |
52597de
to
f6258d7
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
target_directory is removed from the constructor, included on `build()`
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.
Minor question otherwise good.
Resolves: python-poetry#
I've added mypy to the dev-dependencies and made the poetry.core.masonry code mypy-clean.
Slightly more invasive than some of the typechecking MRs we've seen:
.build()
methods have the same signature required changes (and I've removed an unused parameter too)Path
rather thanstr
I've removed some odd-one-outUnion[Path, str]
BuildIncludeFile
could be equal to aPath
because it just seemed too much. I've caught one place where this trickery was being exploited, and re-implemented it in a less magical way, but it's possible that I've missed something.