Skip to content

Commit 8ad0b06

Browse files
committed
clean up
1 parent 6bcfdd7 commit 8ad0b06

File tree

6 files changed

+67
-88
lines changed

6 files changed

+67
-88
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ jobs:
2929
if: |
3030
github.repository_owner_id == 2088731 &&
3131
github.ref_name == github.event.repository.default_branch
32+
env:
33+
CONFIG: releaserc.toml
3234
steps:
3335
- name: 🛫 Checkout
3436
uses: actions/checkout@v4
@@ -59,7 +61,7 @@ jobs:
5961
run: |
6062
PYTHON_SCRIPT="from codeforlife import __version__; print(__version__)"
6163
echo OLD_VERSION=$(python -c "$PYTHON_SCRIPT") >> $GITHUB_ENV
62-
semantic-release version
64+
semantic-release --config=${{ env.CONFIG }} version
6365
echo NEW_VERSION=$(python -c "$PYTHON_SCRIPT") >> $GITHUB_ENV
6466
6567
- name: 🏗️ Build Distributions
@@ -70,7 +72,7 @@ jobs:
7072
if: env.OLD_VERSION != env.NEW_VERSION
7173
env:
7274
GH_TOKEN: ${{ secrets.CFL_BOT_GH_TOKEN }}
73-
run: semantic-release publish
75+
run: semantic-release --config=${{ env.CONFIG }} publish
7476

7577
- name: 🚀 Publish to PyPI
7678
if: env.OLD_VERSION != env.NEW_VERSION

.vscode/settings.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"black-formatter.args": [
1010
"--config",
11-
"pyproject.toml"
11+
"../configs/backend/pyproject.toml"
1212
],
1313
"black-formatter.path": [
1414
".venv/bin/python",
@@ -37,23 +37,23 @@
3737
"**/__pycache__": true
3838
},
3939
"isort.args": [
40-
"--settings-file=pyproject.toml"
40+
"--settings-file=../configs/backend/pyproject.toml"
4141
],
4242
"isort.path": [
4343
".venv/bin/python",
4444
"-m",
4545
"isort"
4646
],
4747
"mypy-type-checker.args": [
48-
"--config-file=pyproject.toml"
48+
"--config-file=../configs/backend/pyproject.toml"
4949
],
5050
"mypy-type-checker.path": [
5151
".venv/bin/python",
5252
"-m",
5353
"mypy"
5454
],
5555
"pylint.args": [
56-
"--rcfile=pyproject.toml"
56+
"--rcfile=../configs/backend/pyproject.toml"
5757
],
5858
"pylint.path": [
5959
".venv/bin/python",
@@ -65,7 +65,7 @@
6565
"-n=auto",
6666
"--cov=.",
6767
"--cov-report=html",
68-
"-c=pyproject.toml",
68+
"-c=../configs/backend/pyproject.toml",
6969
"."
7070
],
7171
"python.testing.pytestEnabled": true,

manage.py

Lines changed: 19 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,27 @@
22
© Ocado Group
33
Created on 12/04/2024 at 16:53:51(+01:00).
44
5-
This file manages Django but also acts a settings file.
5+
Django's command-line utility for administrative tasks.
66
"""
77

8-
# pylint: disable-next=wildcard-import,unused-wildcard-import
9-
from codeforlife.settings import *
10-
11-
# NOTE: This is only used locally for testing purposes.
12-
SECRET_KEY = "XTgWqMlZCMI_E5BvCArkif9nrJIIhe_6Ic6Q_UcWJDk="
13-
14-
INSTALLED_APPS = [
15-
"django.contrib.admin",
16-
"django.contrib.auth",
17-
"django.contrib.contenttypes",
18-
"django.contrib.sessions",
19-
"django.contrib.messages",
20-
"django.contrib.staticfiles",
21-
"django.contrib.sites",
22-
"codeforlife.user",
23-
"game", # TODO: remove this
24-
"common", # TODO: remove this
25-
"portal", # TODO: remove this
26-
]
27-
28-
MIDDLEWARE = [
29-
"codeforlife.middlewares.SessionMiddleware",
30-
"django.contrib.auth.middleware.AuthenticationMiddleware",
31-
"django.contrib.messages.middleware.MessageMiddleware",
32-
]
8+
import os
9+
import sys
10+
11+
12+
def main():
13+
"""Run administrative tasks."""
14+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
15+
try:
16+
# pylint: disable-next=import-outside-toplevel
17+
from django.core.management import execute_from_command_line
18+
except ImportError as exc:
19+
raise ImportError(
20+
"Couldn't import Django. Are you sure it's installed and "
21+
"available on your PYTHONPATH environment variable? Did you "
22+
"forget to activate a virtual environment?"
23+
) from exc
24+
execute_from_command_line(sys.argv)
3325

34-
ROOT_URLCONF = "codeforlife.user.urls"
3526

3627
if __name__ == "__main__":
37-
import os
38-
import sys
39-
40-
from django.core.management import execute_from_command_line
41-
42-
# Set the path of the settings file to the path of this file.
43-
os.environ.setdefault("DJANGO_SETTINGS_MODULE", Path(__file__).stem)
44-
45-
execute_from_command_line(sys.argv)
28+
main()

pyproject.toml

Lines changed: 0 additions & 45 deletions
This file was deleted.

releaserc.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# https://github.com/python-semantic-release/python-semantic-release/blob/v9/docs/configuration.rst
2+
[semantic_release]
3+
version_variables = ["codeforlife/__init__.py:__version__"]
4+
commit_message = "v{version} [skip ci]"
5+
commit_author = "cfl-bot <[email protected]>"

settings.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"""
2+
© Ocado Group
3+
Created on 14/03/2025 at 15:34:28(+00:00).
4+
5+
The min settings required to manage the `codeforlife.user` Django app-module.
6+
"""
7+
8+
# pylint: disable-next=wildcard-import,unused-wildcard-import
9+
from codeforlife.settings import *
10+
11+
# NOTE: This is only used locally for testing purposes.
12+
SECRET_KEY = "XTgWqMlZCMI_E5BvCArkif9nrJIIhe_6Ic6Q_UcWJDk="
13+
14+
INSTALLED_APPS = [
15+
"django.contrib.admin",
16+
"django.contrib.auth",
17+
"django.contrib.contenttypes",
18+
"django.contrib.sessions",
19+
"django.contrib.messages",
20+
"django.contrib.staticfiles",
21+
"django.contrib.sites",
22+
"codeforlife.user",
23+
"game", # TODO: remove this
24+
"common", # TODO: remove this
25+
"portal", # TODO: remove this
26+
]
27+
28+
MIDDLEWARE = [
29+
"codeforlife.middlewares.SessionMiddleware",
30+
"django.contrib.auth.middleware.AuthenticationMiddleware",
31+
"django.contrib.messages.middleware.MessageMiddleware",
32+
]
33+
34+
ROOT_URLCONF = "codeforlife.user.urls"

0 commit comments

Comments
 (0)