Skip to content

Conversation

XzzX
Copy link
Contributor

@XzzX XzzX commented Feb 13, 2025

No description provided.

Copy link

Binder 👈 Launch a binder notebook on branch pyiron/pyiron_workflow/run_nbqa

Copy link

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.00% (target: -1.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (006bfc9) 3423 3127 91.35%
Head commit (b87bc57) 3423 (+0) 3127 (+0) 91.35% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#590) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

@XzzX
Copy link
Contributor Author

XzzX commented Feb 14, 2025

from typing_extensions import deprecated

@deprecated("use new_function")
def old_function() -> None:
    print("I am old")

works for all classes and functions defined in python files.
Dynamically generated stuff (in our case most probably everything created via decorators) is not checked as it is only defined at runtime. I think
warnings.warn(message, DeprecationWarning, stacklevel=2)
is the way to go there. With the correct filter warnings can be converted to errors.

Starting with python>=3.13 also the deprecated decorator from warning can be used.

@XzzX
Copy link
Contributor Author

XzzX commented Feb 14, 2025

Getting the notebooks pass mypy checks might be complicated:

notebooks/deepdive.ipynb:cell_21:11: error: "int" has no attribute "eq" [attr-defined]:
@pwf.as_macro_node
def TheFifthElement(
    self,
    exactly_five: tuple[int, int, int, int, int],
    mod: int = 10,
    extra: int = 5,
    target: int = 0,
) -> tuple[bool, float]:
    self.fifth_element = exactly_five[4]  # Access injection
    self.transformed = (self.fifth_element + extra) % mod  # Operator injection
    self.matches = self.transformed.eq(target)  # Method injection

It looks like self.transformed should be int, but due to intentional pyiron_workflow magic it is not.

notebooks/deepdive.ipynb:cell_22:9: error: Name "Car.dataclass" is not defined [name-defined]

The dataclass type definitions are only created at runtime and cannot be checked statically.

@liamhuber What do you suggest?

@liamhuber
Copy link
Member

I'm on mobile so it's inconvenient to double check, but I'm 90% confident the dataclass field is already there and properly stated on the Dataclass node parent class. I think going back and fixing up the typing on the decorators here and the ’pyiron_snippets.factory` code is likely to resolve this (and other) issues. For the next couple weeks my focus needs to be on the storage tools and pyironflow web portal though, so at least from my end there won't be any imminent action here. It's still somewhere on the todo list.

@XzzX
Copy link
Contributor Author

XzzX commented Feb 17, 2025

Ok, let's put this on hold for now.

@liamhuber liamhuber marked this pull request as draft February 25, 2025 00:23
Copy link

stale bot commented Apr 26, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 26, 2025
@stale stale bot closed this Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants