Comments (15)
Confirmed. All static checks passed with the fix: https://github.com/apache/airflow/actions/runs/5699174893/job/15447938188?pr=32930
from mypy_boto3_builder.
No issues with the new version on the following snippet:
import boto3 conn = boto3.client("appflow") response = conn.describe_flow(flowName="flow_name") conn.update_flow( flowName=response["flowName"], destinationFlowConfigList=response["destinationFlowConfigList"], sourceFlowConfig=response["sourceFlowConfig"], triggerConfig=response["triggerConfig"], description=response.get("description", "Flow description."), tasks=[ { "sourceFields": ["field_name", "field_name2"], "taskType": "Map", } ], )I am going to prepare a new release and update
boto3
packages later today.
Thanks. I am travelling and had no time to check it - but yes that was precisely the snippet that caused the problems for us so it looks good.
Thanks for quick reaction.
from mypy_boto3_builder.
BTW. Once you release the new package, Airflow will run a canary build and will automatically pull and test the last version - so we will know immediately if it's been fixed :)
from mypy_boto3_builder.
Indeed. Seems like the issue is back even after the new release with 1.28.15: https://github.com/apache/airflow/actions/runs/5696388972/job/15441693475#step:6:161
Unfortunately, I cannot change it on my side - the problem is that both - producer(describe_flow) and consumer(update_flow) of the data structures come from mypy-boto3-appflow, so I cannot change the consumer to accept the union. Both methods are in the mypy-boto3-appflow
realm.
For now I am going to simply limit mypy-boto3-appflow
to < 1.28 and I hope it can get resolved somehow - possibly with mypy if you create an issue, but I think honestly this is a flaw of the design if you have two - from Python point of view - types and expect that one will be compatible with the other. That sounds a bit strange.
from mypy_boto3_builder.
I re-run apache/airflow#32930 with this fix.
from mypy_boto3_builder.
Thank you for testing this postrelease. I am going to leave this issue open until mypy-boto3-appflow 1.28.16
is released next Monday.
Please let me know if you find any other issues, that was a huge improvement.
from mypy_boto3_builder.
Thank you for the report!
Fixes for input/output TypeDef
s are already implemented, and hopefully be released today. I am going to cross-check your case. Could you please prepare a short snippet to reproduce the issue?
from mypy_boto3_builder.
No issues with the new version on the following snippet:
import boto3
conn = boto3.client("appflow")
response = conn.describe_flow(flowName="flow_name")
conn.update_flow(
flowName=response["flowName"],
destinationFlowConfigList=response["destinationFlowConfigList"],
sourceFlowConfig=response["sourceFlowConfig"],
triggerConfig=response["triggerConfig"],
description=response.get("description", "Flow description."),
tasks=[
{
"sourceFields": ["field_name", "field_name2"],
"taskType": "Map",
}
],
)
I am going to prepare a new release and update boto3
packages later today.
from mypy_boto3_builder.
Well, I have good news, and I have bad news.
Unfortunately, it looks like a bug (or expected behavior) in mypy
.
from typing import TypedDict
class InputTypedDict(TypedDict, total=True):
field_name: str | int
class OutputTypedDict(TypedDict, total=True):
field_name: str
def test(data: InputTypedDict) -> OutputTypedDict:
return {
"field_name": str(data["field_name"]),
}
data: OutputTypedDict = {"field_name": "123"}
test(data) # Argument 1 to "test" has incompatible type "OutputTypedDict"; expected "InputTypedDict"
The proper solution would be to check if input and output shapes are compatible and if they are, accept Union[MyTypeDef, MyOutputTypeDef]
instead of MyTypeDef
.
I will test and let you know.
from mypy_boto3_builder.
Just in case, TypedDict
compatibility is implemented in pyright
properly. However, I cannot find a relevant mypy
issue. Probably I should create one.
from mypy_boto3_builder.
@potiuk I am preparing a new release with the changes I described above.
You can help me if you test mypy-boto3-appflow 1.28.15.post1
on your code and let me know if it works as it should for you. If everything is good - I am going to release the changes tomorrow for all packages.
from mypy_boto3_builder.
Sure. I can do that
from mypy_boto3_builder.
Build running here: apache/airflow#32930
from mypy_boto3_builder.
All looks good. We had this one on the first pass:
airflow/providers/amazon/aws/hooks/appflow.py:103: error: Argument 1 to
"append" of "list" has incompatible type "TaskOutputTypeDef"; expected
"TaskTypeDef" [arg-type]
tasks.append(task) # List of non-filter tasks
But this is one originating from our code and I just fixed it with changing tasks: list[TaskTypeDef] = []
into tasks: list[TaskTypeDef | TaskOutputTypeDef] = []
from mypy_boto3_builder.
Closing the issue, all packages are updated.
Please reopen in case you have any issues. And feel free to report new ones.
from mypy_boto3_builder.
Related Issues (20)
- Incorrectly typed `aioboto.dynamodb.BatchWriter` HOT 10
- Missing `total=False` on some TypedDict with boto3-stubs>=1.28.3 HOT 7
- `InstanceTypeDef` gone in `mypy-boto3-ec2==1.28.3.post1` HOT 5
- "TypeError: duplicate base class object" for types-aiobotocore-dynamodb version 2.5.2.post1 HOT 3
- Regression boto3-stubs[dynamodb] Table.get_item typing HOT 4
- Wrong types for IAMClient.get_policy_version HOT 2
- Shorten package descriptions for compatibility with Azure DevOps mirroring, pipelines HOT 3
- Return type incorrect for DynamoDb Client methods HOT 2
- The query paginator returns unexpected Type QueryOutputTableTypeDef HOT 2
- upload_fileobj types in S3Client are wrong. HOT 3
- Corrupt tarball for mypy-boto3-ec2 on PyPI HOT 2
- Include TypeDef for Cloudwatch Alarms Events from EventBridge HOT 10
- Support configuration of `typing` vs `typing_extensions` HOT 4
- [sts] GetCallerIdentityResponseTypeDef -> Arn should be 'str' but ist dict[str, Any] HOT 3
- GetKeyPolicyResponseTypeDef Policy should be `str` not `Dict[str, Any]` HOT 4
- dynamo: AttributeBase does not include `name` property HOT 2
- Client package ServiceName literal definitions are not necessarily up-to-date HOT 2
- pyright now treats TypedDict field types as invariant instead of covariant resulting in some type checking errors HOT 5
- session.get_credentials() has become optional HOT 2
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 mypy_boto3_builder.