Skip to content

Commit 0c09415

Browse files
authored
chore: Added Ruff (Python code formatter) (#536)
1 parent 20f6aae commit 0c09415

File tree

3 files changed

+458
-317
lines changed

3 files changed

+458
-317
lines changed

.github/workflows/test.yml

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: Tests
22

33
env:
44
PYTEST_VERSION: 7.4.4
5+
RUFF_VERSION: 0.1.13
6+
RUFF_PY_VERSION: 3.12
57

68
on:
79
push:
@@ -19,19 +21,40 @@ jobs:
1921
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
2022
fail-fast: false
2123
steps:
22-
- uses: actions/checkout@v3
24+
- uses: actions/checkout@v4.1.1
2325

2426
- name: Set up Python ${{ matrix.python_version }}
25-
uses: actions/setup-python@v3
27+
uses: actions/setup-python@v5.0.0
2628
with:
2729
python-version: ${{ matrix.python_version }}
2830

29-
- name: Install poetry and tox
31+
- name: Install poetry
3032
shell: bash
3133
run: |
32-
pip install pytest==${PYTEST_VERSION}
34+
pip install pytest==${{ env.PYTEST_VERSION }}
3335
34-
- name: Run tox
36+
- name: Run pytest
3537
shell: bash
3638
run: |
3739
python -m pytest -vvv tests/
40+
41+
format:
42+
name: Ruff Format check
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/[email protected]
46+
47+
- name: Set up Python
48+
uses: actions/[email protected]
49+
with:
50+
python-version: ${{ env.RUFF_PY_VERSION }}
51+
52+
- name: Install ruff
53+
shell: bash
54+
run: |
55+
pip install ruff==${{ env.RUFF_VERSION }}
56+
57+
- name: Run ruff format check
58+
shell: bash
59+
run: |
60+
ruff format --check .

examples/fixtures/python3.8-app2/index.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,17 @@
77
logger = logging.getLogger()
88
logger.setLevel(logging.INFO)
99

10-
logging.getLogger('boto3').setLevel(logging.DEBUG)
11-
logging.getLogger('botocore').setLevel(logging.DEBUG)
10+
logging.getLogger("boto3").setLevel(logging.DEBUG)
11+
logging.getLogger("botocore").setLevel(logging.DEBUG)
12+
13+
bucketName = os.environ["BUCKET_NAME"]
14+
regionName = os.environ["REGION_NAME"]
1215

13-
bucketName = os.environ['BUCKET_NAME']
14-
regionName = os.environ['REGION_NAME']
1516

1617
def lambda_handler(event, context):
17-
client = boto3.client('s3', regionName)
18+
client = boto3.client("s3", regionName)
1819
response = client.put_object(
19-
Bucket=bucketName,
20-
Key=str(uuid4()),
21-
Body=bytearray("Hello, World!", 'utf-8')
20+
Bucket=bucketName, Key=str(uuid4()), Body=bytearray("Hello, World!", "utf-8")
2221
)
2322

2423
logger.info(response)

0 commit comments

Comments
 (0)