-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildstubs.sh
executable file
·54 lines (40 loc) · 2.31 KB
/
buildstubs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
sudo apt install -y python3-pip
pip3 install virtualenv
sudo rm -Rf buildstubs_env
virtualenv buildstubs_env
source buildstubs_env/bin/activate
pip3 install --upgrade boto3 botocore jinja2 pyparsing black mdformat isort
python3 get_aws_services.py
git clone https://github.com/chrishollinworth/mypy_boto3_builder.git
cd mypy_boto3_builder
./scripts/build.sh
./scripts/install.sh
cd ..
sudo rm -Rf typings
mkdir -p typings/boto3
mkdir -p typings/botocore
cp buildstubs_env/lib/python3.10/site-packages/boto3-stubs/__init__.pyi typings/boto3/__init__.pyi
cp buildstubs_env/lib/python3.10/site-packages/boto3-stubs/compat.pyi typings/boto3/compat.pyi
cp buildstubs_env/lib/python3.10/site-packages/boto3-stubs/exceptions.pyi typings/boto3/exceptions.pyi
cp buildstubs_env/lib/python3.10/site-packages/boto3-stubs/session.pyi typings/boto3/session.pyi
cp buildstubs_env/lib/python3.10/site-packages/boto3-stubs/utils.pyi typings/boto3/utils.pyi
cp buildstubs_env/lib/python3.10/site-packages/botocore-stubs/config.pyi typings/botocore/config.pyi
cat services2.txt | while IFS=$' \t\n\r' read -r line || [[ -n "$line" ]]; do
if [ "$line" != "lambda" ]; then
# install generated stubs for implicit type inference on boto3.client/boto3.resource
mkdir -p typings/mypy_boto3/$line
for f in __init__ client literals paginator service_resource waiter type_defs; do \
cp buildstubs_env/lib/python3.10/site-packages/mypy_boto3_$line/$f.pyi typings/mypy_boto3/$line/$f.pyi; done
else
# install generated stubs for implicit type inference on boto3.client/boto3.resource
mkdir -p typings/mypy_boto3/lambda_
for f in __init__ client literals paginator service_resource waiter type_defs; do \
cp buildstubs_env/lib/python3.10/site-packages/mypy_boto3/lambda_/$f.pyi typings/mypy_boto3/lambda_/$f.pyi; done
fi
# install packaged stubs for explicit type annotation (also used by the generated stubs)
mkdir -p typings/mypy_boto3_$line
for f2 in __init__ client literals paginator service_resource waiter type_defs; do \
cp buildstubs_env/lib/python3.10/site-packages/mypy_boto3_$line/$f2.pyi typings/mypy_boto3_$line/$f2.pyi;
done
done