Skip to content

Commit b5ef752

Browse files
committed
chore: bump python to 3.12, bump linters
1 parent 23a23bb commit b5ef752

File tree

6 files changed

+139
-138
lines changed

6 files changed

+139
-138
lines changed

.github/workflows/main.yml

Lines changed: 65 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,75 @@
11
name: CI
22
on:
3-
pull_request:
4-
branches:
5-
- "*"
6-
push:
7-
branches:
8-
- develop
3+
pull_request:
4+
branches:
5+
- "*"
6+
push:
7+
branches:
8+
- develop
99

1010
env:
11-
IMAGE_NAME: unitystation/central-command
11+
IMAGE_NAME: unitystation/central-command
1212

1313
jobs:
14-
lint:
15-
runs-on: ubuntu-latest
16-
steps:
17-
- uses: actions/checkout@v4
18-
- uses: actions/setup-python@v4
19-
with:
20-
python-version: '3.11'
21-
# because pre-commit uses external mypy
22-
- name: install mypy
23-
run: |
24-
pip install poetry
25-
poetry config virtualenvs.create false
26-
poetry install --only main,typecheck
27-
# https://github.com/typeddjango/django-stubs/issues/458
28-
- name: create .env file
29-
run: cp example.env .env
30-
- uses: pre-commit/[email protected]
14+
lint:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-python@v4
19+
with:
20+
python-version: '3.12'
21+
# because pre-commit uses external mypy
22+
- name: install mypy
23+
run: |
24+
pip install poetry
25+
poetry config virtualenvs.create false
26+
poetry install --only main,typecheck
27+
# https://github.com/typeddjango/django-stubs/issues/458
28+
- name: create .env file
29+
run: cp example.env .env
30+
- uses: pre-commit/[email protected]
3131

32-
unit_test:
33-
needs: [ lint ]
34-
runs-on: ubuntu-latest
35-
steps:
36-
- uses: actions/checkout@v4
37-
- uses: actions/setup-python@v4
38-
with:
39-
python-version: '3.11'
40-
- name: Install dependencies
41-
run: |
42-
pip install poetry
43-
poetry config virtualenvs.create false
44-
poetry install --only main
45-
- name: create .env file
46-
run: cp example.env .env
47-
- name: Run tests
48-
env:
49-
SECRET_KEY: secret
50-
DB_ENGINE: django.db.backends.sqlite3
51-
run: |
52-
cd src
53-
python manage.py makemigrations --check
54-
python manage.py migrate
55-
python manage.py test tests/
32+
unit_test:
33+
needs: [ lint ]
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v4
37+
- uses: actions/setup-python@v4
38+
with:
39+
python-version: '3.12'
40+
- name: Install dependencies
41+
run: |
42+
pip install poetry
43+
poetry config virtualenvs.create false
44+
poetry install --only main
45+
- name: create .env file
46+
run: cp example.env .env
47+
- name: Run tests
48+
env:
49+
SECRET_KEY: secret
50+
DB_ENGINE: django.db.backends.sqlite3
51+
run: |
52+
cd src
53+
python manage.py makemigrations --check
54+
python manage.py migrate
55+
python manage.py test tests/
5656
57-
docker:
58-
needs: [ lint, unit_test ]
59-
runs-on: ubuntu-latest
60-
steps:
61-
- uses: actions/checkout@v4
62-
- name: Build docker image
63-
run: |
64-
docker pull $IMAGE_NAME
65-
docker build --pull --cache-from $IMAGE_NAME -t $IMAGE_NAME:latest .
57+
docker:
58+
needs: [ lint, unit_test ]
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: actions/checkout@v4
62+
- name: Build docker image
63+
run: |
64+
docker pull $IMAGE_NAME
65+
docker build --pull --cache-from $IMAGE_NAME -t $IMAGE_NAME:latest .
6666
67-
- name: Log in into Docker Hub
68-
if: ${{ github.event_name == 'push' }}
69-
run: |
70-
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
67+
- name: Log in into Docker Hub
68+
if: ${{ github.event_name == 'push' }}
69+
run: |
70+
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
7171
72-
- name: Push image to registry
73-
if: ${{ github.event_name == 'push' }}
74-
run: |
75-
docker push $IMAGE_NAME
72+
- name: Push image to registry
73+
if: ${{ github.event_name == 'push' }}
74+
run: |
75+
docker push $IMAGE_NAME

.pre-commit-config.yaml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
repos:
2-
3-
- repo: https://github.com/astral-sh/ruff-pre-commit
4-
rev: v0.3.0
5-
hooks:
6-
- id: ruff-format
7-
- id: ruff
8-
args: [ --fix, --exit-non-zero-on-fix ]
9-
102
- repo: https://github.com/pre-commit/pre-commit-hooks
11-
rev: v4.5.0
3+
rev: v5.0.0
124
hooks:
135
- id: check-added-large-files
146
- id: check-case-conflict
@@ -24,12 +16,19 @@ repos:
2416
exclude: >-
2517
^.*.md$
2618
19+
- repo: https://github.com/astral-sh/ruff-pre-commit
20+
rev: v0.6.9
21+
hooks:
22+
- id: ruff
23+
args: [ --fix ]
24+
- id: ruff-format
25+
2726
# local mypy because of stub dependencies
2827
- repo: local
2928
hooks:
30-
- id: typecheck
31-
name: Typecheck
32-
entry: mypy .
33-
types: [python]
34-
language: system
35-
pass_filenames: false
29+
- id: typecheck
30+
name: Typecheck
31+
entry: mypy .
32+
types: [python]
33+
language: system
34+
pass_filenames: false

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.11-alpine3.19
1+
FROM python:3.12-alpine3.20
22

33
# in order:
44
# proper stdout flushing for alpine

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Copy `example.env` to `.env` and customize it. You can then start development by
2121

2222
### Setting up python to run the project locally
2323

24-
You will need python 3.11+
24+
You will need python 3.12+
2525

2626
<details>
2727
<summary>Extra steps if don't want to install poetry globally for some reason</summary>

poetry.lock

Lines changed: 26 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,35 @@
1+
[tool.poetry]
2+
name = "central-command"
3+
version = "0.1.0"
4+
description = "All-in-one backend application for Unitystation"
5+
authors = ["Andrés Riquelme <[email protected]>"]
6+
7+
[tool.poetry.dependencies]
8+
python = "^3.12"
9+
Django = "^3.2.12"
10+
djangorestframework = "^3.12.1"
11+
psycopg2-binary = "2.9.9"
12+
django-rest-knox = "^4.1.0"
13+
gunicorn = "^20.1.0"
14+
python-dotenv = "^0.19.2"
15+
whitenoise = "^6.2.0"
16+
django-post-office = "^3.8.0"
17+
drf-spectacular = "^0.27.1"
18+
19+
[tool.poetry.group.lint.dependencies]
20+
pre-commit = "4.0.1"
21+
ruff = "0.6.9"
22+
23+
# typecheck is separate for CI
24+
[tool.poetry.group.typecheck.dependencies]
25+
mypy = "1.*"
26+
django-stubs = {extras = ["compatible-mypy"], version = "4.*"}
27+
djangorestframework-stubs = {extras = ["compatible-mypy"], version = "3.*"}
28+
29+
[build-system]
30+
requires = ["poetry-core>=1.0.0"]
31+
build-backend = "poetry.core.masonry.api"
32+
133
[tool.ruff]
234
exclude = ["migrations"]
335
line-length = 121
@@ -83,35 +115,3 @@ module = [
83115
"knox.*",
84116
]
85117
ignore_missing_imports = true
86-
87-
[tool.poetry]
88-
name = "central-command"
89-
version = "0.1.0"
90-
description = "All-in-one backend application for Unitystation"
91-
authors = ["Andrés Riquelme <[email protected]>"]
92-
93-
[tool.poetry.dependencies]
94-
python = "^3.11"
95-
Django = "^3.2.12"
96-
djangorestframework = "^3.12.1"
97-
psycopg2-binary = "2.9.9"
98-
django-rest-knox = "^4.1.0"
99-
gunicorn = "^20.1.0"
100-
python-dotenv = "^0.19.2"
101-
whitenoise = "^6.2.0"
102-
django-post-office = "^3.8.0"
103-
drf-spectacular = "^0.27.1"
104-
105-
[tool.poetry.group.lint.dependencies]
106-
pre-commit = "3.*"
107-
ruff = "0.3.*"
108-
109-
# typecheck is separate for CI
110-
[tool.poetry.group.typecheck.dependencies]
111-
mypy = "1.*"
112-
django-stubs = {extras = ["compatible-mypy"], version = "4.*"}
113-
djangorestframework-stubs = {extras = ["compatible-mypy"], version = "3.*"}
114-
115-
[build-system]
116-
requires = ["poetry-core>=1.0.0"]
117-
build-backend = "poetry.core.masonry.api"

0 commit comments

Comments
 (0)