harald/pythonbuilder
1
0
Fork
You've already forked pythonbuilder
0

Revert implementation of state generators accepting a Target too instead of only a Target.item #6

Closed
opened 2025年10月22日 11:16:31 +02:00 by harald · 1 comment

Current Situation

After implementing issue #2, calling a state generator is complicated by checking whether it accepts a Target or a Target.item as the first parameter.

This was implemented because I thought I need it, but checking 10 of my projects with supposedly the problem described in that issue I see it is not used anywhere.

The assumption formulated in #2 for filters on a Target Path needing to depend on the filters applied on a dependency Path is correct, but with the implementation of Paths, in particular Paths.mappedTo we can cover the requirement without the weirdo runtime type check of the first parameter of the state generator function.

Requirement

Remove the feature introduced in issue #2, in particular:

  • Remove the additional type of the state= parameter to just str | Callable[[T], str].
  • Adapt the documentation on the constructor of Target.
  • Remove _computeState and use self.generateState(self.item) inline where needed.
  • Fix tests as needed.
# Current Situation After implementing issue #2, calling a state generator is complicated by checking whether it accepts a `Target` or a `Target.item` as the first parameter. This was implemented because I thought I need it, but checking 10 of my projects with supposedly the problem described in that issue I see it is not used anywhere. The assumption formulated in #2 for filters on a `Target` `Path` needing to depend on the filters applied on a dependency `Path` is correct, but with the implementation of `Paths`, in particular `Paths.mappedTo` we can cover the requirement without the weirdo runtime type check of the first parameter of the state generator function. # Requirement Remove the feature introduced in issue #2, in particular: - Remove the additional type of the `state=` parameter to just `str | Callable[[T], str]`. - Adapt the documentation on the constructor of `Target`. - Remove `_computeState` and use `self.generateState(self.item)` inline where needed. - Fix tests as needed.
Author
Owner
Copy link

Implemented: 3a6598d602

Implemented: 3a6598d6028b409a1ed2e2fa8a6b40f5af3ea9d8
Sign in to join this conversation.
No Branch/Tag specified
main
v-2025年10月23日
list
v-2025年09月26日
v-2025年09月21日
v-2025年09月18日
v-2025年08月21日
v-2025年08月17日
v-2025年08月03日
v-2025年07月27日
v-2025年05月31日
v-2025年05月10日
No labels
feature
refactoring
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
harald/pythonbuilder#6
Reference in a new issue
harald/pythonbuilder
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?