Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code checks to hubverse-infrastructure #29

Merged
merged 4 commits into from
Apr 8, 2024
Merged

Conversation

bsweger
Copy link
Collaborator

@bsweger bsweger commented Apr 5, 2024

Resolves hubverse-org/hubverse-cloud#66

This PR adds the mypy and ruff Python libraries for type-checking and linting. Additionally, there is a new GitHub workflow that runs these checks.

Most of the other changes fix issues that the linter flagged the first time it was run.

Reviewing this by stepping through each commit will show the separate work for each type of code check.

Edited to add: to pulumi preview comment is a bit awkward to follow. Essentially, you can click on pulumi report and scroll to the bottom to see what infrastructure components (if any) would be changed by the PR.

In this case, the PR doesn't impact any infrastructure:

pulumi:pulumi:Stack hubverse-aws-hubverse  
Resources:
13 unchanged

bsweger added 4 commits April 5, 2024 13:40
Add ruff, a corresponding config file, and the formatting
changes that it suggested
Note that mypy doesn't play especially well with pulumi. Problematic
lines are ignored so the type checker will pass.
This is the first iteration of code check workflow for the
hubverse-infrastructure repo. It's obviously missing a job
step to run tests, which is a future piece of "getting ready
for production" work.
Adding a pre-commit config that mirrors the new "code check"
GitHub action. This is optional, but can be used by devs who
have pre-commit as part of their workflow.
https://pre-commit.com/
Copy link

github-actions bot commented Apr 5, 2024

🍹 preview on hubverse-aws/bsweger/hubverse-aws/hubverse

Pulumi report
Previewing update (hubverse)

View Live: https://app.pulumi.com/bsweger/hubverse-aws/hubverse/previews/3bd8e862-9487-49e2-a760-fb5c9fd07751

@ Previewing update........
pulumi:pulumi:Stack hubverse-aws-hubverse  Creating virtual environment...
@ Previewing update.......
pulumi:pulumi:Stack hubverse-aws-hubverse  Finished creating virtual environment
pulumi:pulumi:Stack hubverse-aws-hubverse  Updating pip, setuptools, and wheel in virtual environment...
pulumi:pulumi:Stack hubverse-aws-hubverse  Requirement already satisfied: pip in ./venv/lib/python3.10/site-packages (23.0.1)
pulumi:pulumi:Stack hubverse-aws-hubverse  Collecting pip
@ Previewing update....
pulumi:pulumi:Stack hubverse-aws-hubverse    Downloading pip-24.0-py3-none-any.whl (2.1 MB)
pulumi:pulumi:Stack hubverse-aws-hubverse       ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 36.9 MB/s eta 0:00:00
pulumi:pulumi:Stack hubverse-aws-hubverse  
pulumi:pulumi:Stack hubverse-aws-hubverse  Requirement already satisfied: setuptools in ./venv/lib/python3.10/site-packages (65.5.0)
pulumi:pulumi:Stack hubverse-aws-hubverse  Collecting setuptools
pulumi:pulumi:Stack hubverse-aws-hubverse    Downloading setuptools-69.2.0-py3-none-any.whl (821 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse       ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 821.5/821.5 kB 55.5 MB/s eta 0:00:00
pulumi:pulumi:Stack hubverse-aws-hubverse  
pulumi:pulumi:Stack hubverse-aws-hubverse  Collecting wheel
pulumi:pulumi:Stack hubverse-aws-hubverse    Downloading wheel-0.43.0-py3-none-any.whl (65 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse       ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 65.8/65.8 kB 29.0 MB/s eta 0:00:00
pulumi:pulumi:Stack hubverse-aws-hubverse  
pulumi:pulumi:Stack hubverse-aws-hubverse  Installing collected packages: wheel, setuptools, pip
pulumi:pulumi:Stack hubverse-aws-hubverse    Attempting uninstall: setuptools
pulumi:pulumi:Stack hubverse-aws-hubverse      Found existing installation: setuptools 65.5.0
pulumi:pulumi:Stack hubverse-aws-hubverse      Uninstalling setuptools-65.5.0:
pulumi:pulumi:Stack hubverse-aws-hubverse        Successfully uninstalled setuptools-65.5.0
@ Previewing update....
pulumi:pulumi:Stack hubverse-aws-hubverse    Attempting uninstall: pip
pulumi:pulumi:Stack hubverse-aws-hubverse      Found existing installation: pip 23.0.1
pulumi:pulumi:Stack hubverse-aws-hubverse      Uninstalling pip-23.0.1:
pulumi:pulumi:Stack hubverse-aws-hubverse        Successfully uninstalled pip-23.0.1
@ Previewing update....
pulumi:pulumi:Stack hubverse-aws-hubverse  Successfully installed pip-24.0 setuptools-69.2.0 wheel-0.43.0
pulumi:pulumi:Stack hubverse-aws-hubverse  Finished updating
pulumi:pulumi:Stack hubverse-aws-hubverse  Installing dependencies in virtual environment...
@ Previewing update....
pulumi:pulumi:Stack hubverse-aws-hubverse  Collecting pulumi<4.0.0,>=3.0.0 (from -r requirements.txt (line 1))
pulumi:pulumi:Stack hubverse-aws-hubverse    Using cached pulumi-3.112.0-py3-none-any.whl.metadata (11 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Collecting pulumi-aws<7.0.0,>=6.0.2 (from -r requirements.txt (line 2))
pulumi:pulumi:Stack hubverse-aws-hubverse    Using cached pulumi_aws-6.29.0-py3-none-any.whl.metadata (9.4 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Collecting PyYAML>=6.0.1 (from -r requirements.txt (line 3))
pulumi:pulumi:Stack hubverse-aws-hubverse    Using cached PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.1 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Collecting mypy>=1.9.0 (from -r requirements.txt (line 7))
pulumi:pulumi:Stack hubverse-aws-hubverse    Using cached mypy-1.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.9 kB)
@ Previewing update....
pulumi:pulumi:Stack hubverse-aws-hubverse  Collecting ruff>=0.3.5 (from -r requirements.txt (line 8))
pulumi:pulumi:Stack hubverse-aws-hubverse    Using cached ruff-0.3.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (23 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Collecting types-PyYAML>=6.0.12 (from -r requirements.txt (line 9))
pulumi:pulumi:Stack hubverse-aws-hubverse    Using cached types_PyYAML-6.0.12.20240311-py3-none-any.whl.metadata (1.5 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Collecting protobuf~=4.21 (from pulumi<4.0.0,>=3.0.0->-r requirements.txt (line 1))
pulumi:pulumi:Stack hubverse-aws-hubverse    Using cached protobuf-4.25.3-cp37-abi3-manylinux2014_x86_64.whl.metadata (541 bytes)
pulumi:pulumi:Stack hubverse-aws-hubverse  Collecting grpcio~=1.60.1 (from pulumi<4.0.0,>=3.0.0->-r requirements.txt (line 1))
pulumi:pulumi:Stack hubverse-aws-hubverse    Using cached grpcio-1.60.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (4.0 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Collecting dill~=0.3 (from pulumi<4.0.0,>=3.0.0->-r requirements.txt (line 1))
pulumi:pulumi:Stack hubverse-aws-hubverse    Using cached dill-0.3.8-py3-none-any.whl.metadata (10 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Collecting six~=1.12 (from pulumi<4.0.0,>=3.0.0->-r requirements.txt (line 1))
pulumi:pulumi:Stack hubverse-aws-hubverse    Using cached six-1.16.0-py2.py3-none-any.whl.metadata (1.8 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Collecting semver~=2.13 (from pulumi<4.0.0,>=3.0.0->-r requirements.txt (line 1))
pulumi:pulumi:Stack hubverse-aws-hubverse    Using cached semver-2.13.0-py2.py3-none-any.whl.metadata (5.0 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Collecting parver>=0.2.1 (from pulumi-aws<7.0.0,>=6.0.2->-r requirements.txt (line 2))
pulumi:pulumi:Stack hubverse-aws-hubverse    Using cached parver-0.5-py3-none-any.whl.metadata (2.7 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Collecting typing-extensions>=4.1.0 (from mypy>=1.9.0->-r requirements.txt (line 7))
pulumi:pulumi:Stack hubverse-aws-hubverse    Using cached typing_extensions-4.11.0-py3-none-any.whl.metadata (3.0 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Collecting mypy-extensions>=1.0.0 (from mypy>=1.9.0->-r requirements.txt (line 7))
pulumi:pulumi:Stack hubverse-aws-hubverse    Using cached mypy_extensions-1.0.0-py3-none-any.whl.metadata (1.1 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Collecting tomli>=1.1.0 (from mypy>=1.9.0->-r requirements.txt (line 7))
pulumi:pulumi:Stack hubverse-aws-hubverse    Using cached tomli-2.0.1-py3-none-any.whl.metadata (8.9 kB)
@ Previewing update....
pulumi:pulumi:Stack hubverse-aws-hubverse  Collecting arpeggio>=1.7 (from parver>=0.2.1->pulumi-aws<7.0.0,>=6.0.2->-r requirements.txt (line 2))
pulumi:pulumi:Stack hubverse-aws-hubverse    Using cached Arpeggio-2.0.2-py2.py3-none-any.whl.metadata (2.4 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Collecting attrs>=19.2 (from parver>=0.2.1->pulumi-aws<7.0.0,>=6.0.2->-r requirements.txt (line 2))
pulumi:pulumi:Stack hubverse-aws-hubverse    Using cached attrs-23.2.0-py3-none-any.whl.metadata (9.5 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Using cached pulumi-3.112.0-py3-none-any.whl (255 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Using cached pulumi_aws-6.29.0-py3-none-any.whl (8.8 MB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Using cached PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (705 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Using cached mypy-1.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.5 MB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Using cached ruff-0.3.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.7 MB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Using cached types_PyYAML-6.0.12.20240311-py3-none-any.whl (15 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Using cached dill-0.3.8-py3-none-any.whl (116 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Using cached grpcio-1.60.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.4 MB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Using cached mypy_extensions-1.0.0-py3-none-any.whl (4.7 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Using cached parver-0.5-py3-none-any.whl (15 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Using cached protobuf-4.25.3-cp37-abi3-manylinux2014_x86_64.whl (294 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Using cached semver-2.13.0-py2.py3-none-any.whl (12 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Using cached tomli-2.0.1-py3-none-any.whl (12 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Using cached typing_extensions-4.11.0-py3-none-any.whl (34 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Using cached Arpeggio-2.0.2-py2.py3-none-any.whl (55 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Using cached attrs-23.2.0-py3-none-any.whl (60 kB)
pulumi:pulumi:Stack hubverse-aws-hubverse  Installing collected packages: arpeggio, typing-extensions, types-PyYAML, tomli, six, semver, ruff, PyYAML, protobuf, mypy-extensions, grpcio, dill, attrs, pulumi, parver, mypy, pulumi-aws
@ Previewing update.............
pulumi:pulumi:Stack hubverse-aws-hubverse  Successfully installed PyYAML-6.0.1 arpeggio-2.0.2 attrs-23.2.0 dill-0.3.8 grpcio-1.60.1 mypy-1.9.0 mypy-extensions-1.0.0 parver-0.5 protobuf-4.25.3 pulumi-3.112.0 pulumi-aws-6.29.0 ruff-0.3.5 semver-2.13.0 six-1.16.0 tomli-2.0.1 types-PyYAML-6.0.12.20240311 typing-extensions-4.11.0
@ Previewing update....
pulumi:pulumi:Stack hubverse-aws-hubverse  Finished installing dependencies
@ Previewing update.........

@ Previewing update.......
pulumi:pulumi:Stack hubverse-aws-hubverse running Finished installing dependencies
@ Previewing update.....
aws:s3:Bucket hubverse-infrastructure-test  [diff: ~provider]
aws:s3:BucketPublicAccessBlock hubverse-infrastructure-test-public-access-block  [diff: ~provider]
aws:s3:BucketPolicy hubverse-infrastructure-test-read-bucket-policy  [diff: ~provider]
aws:iam:Role hubverse-infrastructure-test  [diff: ~provider]
aws:iam:Policy hubverse-infrastructure-test-write-bucket-policy  [diff: ~provider]
aws:s3:Bucket hubverse-cloud  [diff: ~provider]
aws:iam:RolePolicyAttachment hubverse-infrastructure-test  [diff: ~provider]
aws:s3:BucketPublicAccessBlock hubverse-cloud-public-access-block  [diff: ~provider]
aws:s3:BucketPolicy hubverse-cloud-read-bucket-policy  [diff: ~provider]
aws:iam:Role hubverse-cloud  [diff: ~provider]
aws:iam:Policy hubverse-cloud-write-bucket-policy  [diff: ~provider]
aws:iam:RolePolicyAttachment hubverse-cloud  [diff: ~provider]
pulumi:pulumi:Stack hubverse-aws-hubverse  
Resources:
13 unchanged

Copy link
Collaborator

@elray1 elray1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks -- I worked through and all looked good to me.

@bsweger bsweger merged commit e1b35d0 into main Apr 8, 2024
4 checks passed
@bsweger bsweger deleted the bsweger/add-code-checks branch April 8, 2024 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Get IaC production-ready: add linting and type checking
2 participants