m1racoli opened a new issue, #64861:
URL: https://github.com/apache/airflow/issues/64861
### Under which category would you file this issue?
Task SDK
### Apache Airflow version
3.1.8
### What happened and how to reproduce it?
Given the file **dags/example.py**
```python
from airflow.sdk import ObjectStoragePath, dag, task
@task
def run() -> ObjectStoragePath:
return ObjectStoragePath("s3://my-bucket/my-file.csv")
@dag(schedule=None)
def example():
run()
example()
```
raises an error when type checking with ty 0.0.29:
```sh
$ uvx [email protected] check dags/example.py
error[invalid-return-type]: Return type does not match returned value
--> dags/example.py:5:14
|
4 | @task
5 | def run() -> ObjectStoragePath:
| ----------------- Expected `ObjectStoragePath` because of
return type
6 | return ObjectStoragePath("s3://my-bucket/my-file.csv")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected
`ObjectStoragePath`, found `UPath`
|
info: rule `invalid-return-type` is enabled by default
Found 1 diagnostic
```
This is likely because it is inheriting UPath's `__new__` method without
adjusting its return type:
```python
class UPath(PathlibPathShim, Path):
...
def __new__(
cls, *args, protocol: str | None = None, **storage_options: Any
) -> UPath:
```
The issue seems to be result of https://github.com/astral-sh/ruff/pull/24357.
### What you think should happen instead?
It should not raise a type error.
### Operating System
MacOS
### Deployment
None
### Apache Airflow Provider(s)
_No response_
### Versions of Apache Airflow Providers
_No response_
### Official Helm Chart version
Not Applicable
### Kubernetes Version
_No response_
### Helm Chart configuration
_No response_
### Docker Image customizations
_No response_
### Anything else?
_No response_
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]