Skip to content

Commit bc7ae9f

Browse files
authored
Modernize tooling #1 (#333)
1 parent 069e82a commit bc7ae9f

File tree

6 files changed

+433
-130
lines changed

6 files changed

+433
-130
lines changed

.github/workflows/ci.yml

Lines changed: 55 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -12,57 +12,32 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
python: ['3.8', '3.9', '3.10', '3.11']
16-
django: ['3.2', '4.2']
15+
python: ['3.10', '3.11', '3.12']
16+
django: ['4.2']
1717
steps:
18-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@v4
1919
- name: Set up Python ${{ matrix.python }}
20-
uses: actions/setup-python@v1
20+
uses: astral-sh/setup-uv@v5
2121
with:
2222
python-version: ${{ matrix.python }}
2323
- name: Install Dependencies
2424
run: |
25-
python -m pip install --upgrade pip
26-
pip install .[files,huey,celery]
27-
pip uninstall django-spirit -y
28-
pip install --upgrade Django==${{ matrix.django }}
29-
pip install --upgrade coveralls
25+
uv sync --all-extras
26+
uv pip install --upgrade Django~=${{ matrix.django }}
27+
- name: Test build
28+
run: |
29+
uv build --sdist
3030
- name: Run Tests
3131
run: |
32-
python setup.py -q build
33-
python ./spirit/extra/bin/spirit.py startproject project
32+
uv run ./spirit/extra/bin/spirit.py startproject project
3433
export PYTHONWARNINGS="default"
35-
coverage run --source=. runtests.py
36-
- name: Submit to coveralls
37-
env:
38-
COVERALLS_FLAG_NAME: run-${{ matrix.python }}-${{ matrix.django }}
39-
COVERALLS_PARALLEL: true
40-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41-
run: |
42-
coveralls --service=github
43-
coveralls:
44-
name: Finish Coveralls
45-
needs: test
46-
runs-on: ubuntu-latest
47-
steps:
48-
- uses: actions/checkout@v2
49-
- name: Set up Python 3.11
50-
uses: actions/setup-python@v1
51-
with:
52-
python-version: 3.11
53-
- name: Finished
54-
run: |
55-
python -m pip install --upgrade pip
56-
pip install --upgrade coveralls
57-
coveralls --finish
58-
env:
59-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
make test
6035
test_js:
6136
name: JS
6237
runs-on: ubuntu-latest
6338
strategy:
6439
matrix:
65-
node: [12.x]
40+
node: [22.x]
6641
steps:
6742
- uses: actions/checkout@v2
6843
- name: Set Up NodeJS ${{ matrix.node }}
@@ -82,23 +57,21 @@ jobs:
8257
runs-on: ubuntu-latest
8358
strategy:
8459
matrix:
85-
python: ['3.11']
60+
python: ['3.10', '3.11', '3.12']
8661
django: ['4.2']
8762
steps:
88-
- uses: actions/checkout@v2
63+
- uses: actions/checkout@v4
8964
- name: Set up Python ${{ matrix.python }}
90-
uses: actions/setup-python@v1
65+
uses: astral-sh/setup-uv@v5
9166
with:
9267
python-version: ${{ matrix.python }}
9368
- name: Install Dependencies
9469
run: |
95-
python -m pip install --upgrade pip
96-
pip install .
97-
pip uninstall django-spirit -y
98-
pip install --upgrade Django==${{ matrix.django }}
70+
uv sync
71+
uv pip install --upgrade Django~=${{ matrix.django }}
9972
- name: Run Tests
10073
run: |
101-
python ./spirit/extra/bin/spirit.py startproject project
74+
uv run ./spirit/extra/bin/spirit.py startproject project
10275
export PYTHONWARNINGS="default"
10376
export ST_UPLOAD_FILE_ENABLED=0
10477
export ST_INSTALL_HUEY=0
@@ -108,24 +81,53 @@ jobs:
10881
runs-on: ubuntu-latest
10982
strategy:
11083
matrix:
111-
python: ['3.11']
84+
python: ['3.10', '3.11', '3.12']
11285
django: ['4.2']
11386
steps:
114-
- uses: actions/checkout@v2
87+
- uses: actions/checkout@v4
11588
- name: Set up Python ${{ matrix.python }}
116-
uses: actions/setup-python@v1
89+
uses: astral-sh/setup-uv@v5
11790
with:
11891
python-version: ${{ matrix.python }}
11992
- name: Install Dependencies
12093
run: |
121-
python -m pip install --upgrade pip
122-
pip install .[huey]
123-
pip uninstall django-spirit -y
124-
pip install --upgrade Django==${{ matrix.django }}
94+
uv sync --all-extras
95+
uv pip install --upgrade Django~=${{ matrix.django }}
12596
- name: Run Tests
12697
run: |
127-
python ./spirit/extra/bin/spirit.py startproject project
98+
uv run ./spirit/extra/bin/spirit.py startproject project
12899
export PYTHONWARNINGS="default"
129100
export ST_UPLOAD_FILE_ENABLED=0
130101
export ST_TASK_MANAGER="huey"
131102
make test
103+
coverage:
104+
name: Coverage / Py ${{ matrix.python }} / Django ${{ matrix.django }}
105+
runs-on: ubuntu-latest
106+
strategy:
107+
matrix:
108+
python: ['3.12']
109+
django: ['4.2']
110+
steps:
111+
- uses: actions/checkout@v4
112+
- name: Set up Python ${{ matrix.python }}
113+
uses: astral-sh/setup-uv@v5
114+
with:
115+
python-version: ${{ matrix.python }}
116+
- name: Install Dependencies
117+
run: |
118+
uv sync --all-extras
119+
uv pip install --upgrade Django~=${{ matrix.django }}
120+
uv pip install --upgrade coveralls
121+
- name: Run Tests
122+
run: |
123+
uv run ./spirit/extra/bin/spirit.py startproject project
124+
export PYTHONWARNINGS="default"
125+
uv run coverage run --source=. runtests.py
126+
- name: Submit to coveralls
127+
env:
128+
COVERALLS_FLAG_NAME: run-${{ matrix.python }}-${{ matrix.django }}
129+
COVERALLS_PARALLEL: true
130+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
131+
run: |
132+
uv run coveralls --service=github
133+
uv run coveralls --finish

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ Docs can be found at [spirit.readthedocs.io](http://spirit.readthedocs.io/en/lat
1313

1414
## Compatibility
1515

16-
* Python 3.8, 3.9, 3.10, and 3.11 (recommended)
17-
* Django 3.2 LTS, and 4.2 LTS
16+
* Python 3.8, 3.9, 3.10, 3.11, and 3.12
17+
* Django 4.2 LTS
1818
* PostgreSQL (recommended), MySQL, Oracle Database and SQLite
1919

2020
Constrained by "[What Python version can I use with Django?](https://docs.djangoproject.com/en/dev/faq/install/#what-python-version-can-i-use-with-django)"

pyproject.toml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
[project]
2+
name = "django-spirit"
3+
dynamic = ["version"]
4+
description = "Spirit is a Python based forum powered by Django."
5+
authors = [
6+
{ name = "Esteban Castro Borsani", email = "[email protected]" }
7+
]
8+
readme = "README.md"
9+
license = { text = "MIT License" }
10+
requires-python = ">=3.8"
11+
dependencies = [
12+
"Django>=4.2,<5",
13+
"django-haystack==3.3.0",
14+
"whoosh==2.7.4",
15+
"mistune==0.8.4",
16+
"Pillow==10.4.0",
17+
"olefile==0.46",
18+
"django-infinite-scroll-pagination>=1.1.0,<1.2",
19+
"django-djconfig>=0.11.0,<0.12",
20+
"pytz",
21+
"tzdata",
22+
]
23+
classifiers = [
24+
"Development Status :: 5 - Production/Stable",
25+
"Environment :: Web Environment",
26+
"Framework :: Django",
27+
"Intended Audience :: Developers",
28+
"License :: OSI Approved :: MIT License",
29+
"Operating System :: OS Independent",
30+
"Programming Language :: Python",
31+
"Programming Language :: Python :: 3",
32+
"Topic :: Internet :: WWW/HTTP",
33+
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
34+
]
35+
36+
[project.optional-dependencies]
37+
files = [
38+
"python-magic==0.4.27",
39+
"python-magic-bin==0.4.14; sys_platform == 'win32' or sys_platform == 'darwin'",
40+
]
41+
huey = ["huey == 2.4.5"]
42+
43+
[project.urls]
44+
Documentation = "https://spirit.readthedocs.io"
45+
Source = "https://github.com/nitely/Spirit"
46+
Donate = "https://ko-fi.com/nitely_"
47+
48+
[build-system]
49+
requires = ["setuptools"]
50+
build-backend = "setuptools.build_meta"
51+
52+
[project.scripts]
53+
spirit = "spirit.extra.bin.spirit:main"
54+
55+
[tool.setuptools]
56+
packages = ["spirit"]
57+
58+
[tool.setuptools.dynamic]
59+
version = { attr = "spirit.__version__" }
60+
61+
[tool.ruff]
62+
line-length = 120
63+
64+
[dependency-groups]
65+
dev = [
66+
"django-debug-toolbar>=4.4.6",
67+
]

requirements.txt

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

setup.py

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

0 commit comments

Comments
 (0)