Comments (5)
thanks @williamjamir for the issue! will take a look at this
from prefect.
using this MRE
» cat repros/task_typing.py
from functools import partial
from typing import reveal_type
from prefect import task
@task
def test(a: int, b: int) -> None: ...
partial(test, a=1)
reveal_type(test)
and this version of mypy
» pip freeze | rg mypy
mypy==1.11.0
mypy-extensions==1.0.0
I am not yet able to reproduce this on 2.16.9, newest 2.x, or 3.x
specific version checks
## 2.16.9
» uv pip install prefect==2.16.9 --force-reinstall
...
» mypy repros/task_typing.py
repros/task_typing.py:12: note: Revealed type is "Any"
Success: no issues found in 1 source file
## newest 2.x
» uv pip install -U prefect
...
» mypy repros/task_typing.py
repros/task_typing.py:12: note: Revealed type is "Any"
Success: no issues found in 1 source file
## newest 3.x
» uv pip install -U prefect --pre
...
» mypy repros/task_typing.py
repros/task_typing.py:12: note: Revealed type is "Any"
Success: no issues found in 1 source file
is there anything you notice that I'm missing here?
from prefect.
Thanks for looking at this @zzstoatzz !
It's odd that mypy is not detecting the correct typing for you. The output of reveal_type is Any
, which, in my understanding, disables the check that would be made on partial
.
I would expected to see the reveal_type instead as Task
, like in my initial message.
from prefect.
taking another look, I was able to reproduce in a completely fresh sandbox environment
(root) root@678e57987c9b:~# mypy /tmp/repros/14756.py
/tmp/repros/14756.py:11: error: "Task[[int, int], None]" not callable [misc]
/tmp/repros/14756.py:12: note: Revealed type is "prefect.tasks.Task[[a: builtins.int, b: builtins.int], None]"
Found 1 error in 1 file (checked 1 source file)
will dig into this
from prefect.
it appears that I wasn't able to reproduce before because I had follow_imports = skip
set, once I turned that off I could reliably reproduce.
I don't yet understand what mypy
is on about here, since we overload
__call__
for several cases (perhaps incorrectly somehow) so it should be recognized as a callable thing. (edit, its because of partial
)
perhaps this issue is related? python/mypy#5079 (edit, I dont think it is)
edit actually it appears this might be more relevant python/mypy#17585
as without the partial
, we pass fine. I would say for the moment, I think this is an upstream issue with mypy
(as described in the above linked issue).
from prefect.
Related Issues (20)
- Deploy with missing dependencies breaks when flow decorator uses an imported variable HOT 1
- Variable Server start timeout in prefect_test_harness HOT 1
- Better text editing while editing Variable values
- Add Kubernetes Prefect Operator to docs HOT 4
- Logging not clear what I should be doing to get expected results
- Allow formatting of flow parameter documentation strings
- Support for Service Level Agreements (SLAs) HOT 1
- Improve global concurrency limit management for deployment concurrency limiting HOT 2
- Inactive global concurrency limits are shown as active when edited
- flow name doesn't change with `with_options` function HOT 3
- prefect-ray Local Deployment Error OSError('source code not available')
- Tasks connections are not connecting properly in UI
- Fix flaky test `test_task_timeouts_do_not_crash_flow_runs`
- Race condition causes sub-deployments to be stuck in Canceling state HOT 1
- Allow specifying default result persistence separately for tasks and flows
- flow.to_deployment() length check issue when schedule is added HOT 2
- Can't send notifications to Teams workflow/webhook in Prefect Cloud
- The dashboard view does not show which deployment a flow run belongs a to
- Enable environment variables from GCP secrets in GCP cloud run v2 workers HOT 2
- Track pod state from deployment run
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prefect.