Skip to content

Commit 9131da2

Browse files
committed
use bun
1 parent f8ee296 commit 9131da2

20 files changed

+88
-3342
lines changed

.editorconfig

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ end_of_line = lf
1414
indent_size = 4
1515
max_line_length = 120
1616

17+
[*.yml]
18+
indent_size = 4
19+
1720
[*.md]
1821
indent_size = 4
1922

.github/workflows/publish-develop-docs.yml

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ jobs:
1111
- uses: actions/checkout@v4
1212
with:
1313
fetch-depth: 0
14+
- uses: oven-sh/setup-bun@v2
15+
with:
16+
bun-version: latest
1417
- uses: actions/setup-python@v5
1518
with:
1619
python-version: 3.x

.github/workflows/publish-py.yml

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@v4
15+
- uses: oven-sh/setup-bun@v2
16+
with:
17+
bun-version: latest
1518
- name: Set up Python
1619
uses: actions/setup-python@v5
1720
with:

.github/workflows/publish-release-docs.yml

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ jobs:
1111
- uses: actions/checkout@v4
1212
with:
1313
fetch-depth: 0
14+
- uses: oven-sh/setup-bun@v2
15+
with:
16+
bun-version: latest
1417
- uses: actions/setup-python@v5
1518
with:
1619
python-version: 3.x

.github/workflows/test-docs.yml

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ jobs:
1717
- uses: actions/checkout@v4
1818
with:
1919
fetch-depth: 0
20+
- uses: oven-sh/setup-bun@v2
21+
with:
22+
bun-version: latest
2023
- uses: actions/setup-python@v5
2124
with:
2225
python-version: 3.x

.github/workflows/test-src.yml

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ jobs:
1818
python-version: ["3.9", "3.10", "3.11", "3.12"]
1919
steps:
2020
- uses: actions/checkout@v4
21+
- uses: oven-sh/setup-bun@v2
22+
with:
23+
bun-version: latest
2124
- name: Use Python ${{ matrix.python-version }}
2225
uses: actions/setup-python@v5
2326
with:

docs/src/about/code.md

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
If you plan to make code changes to this repository, you will need to install the following dependencies first:
2020

2121
- [Python 3.9+](https://www.python.org/downloads/)
22+
- [Bun](https://bun.sh/)
2223
- [Git](https://git-scm.com/downloads)
2324

2425
Once done, you should clone this repository:

noxfile.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ def test_python(session: Session) -> None:
3131
settings_files = glob(settings_glob)
3232
assert settings_files, f"No Django settings files found at '{settings_glob}'!"
3333
for settings_file in settings_files:
34-
settings_module = settings_file.strip(".py").replace("/", ".").replace("\\", ".")
34+
settings_module = (
35+
settings_file.strip(".py").replace("/", ".").replace("\\", ".")
36+
)
3537
session.run(
3638
"python",
3739
"manage.py",
3840
"test",
3941
*posargs,
40-
"-v",
41-
"2",
4242
"--settings",
4343
settings_module,
4444
)
@@ -62,8 +62,8 @@ def test_style(session: Session) -> None:
6262
def test_javascript(session: Session) -> None:
6363
install_requirements_file(session, "test-env")
6464
session.chdir(ROOT_DIR / "src" / "js")
65-
session.run("python", "-m", "nodejs.npm", "install", external=True)
66-
session.run("python", "-m", "nodejs.npm", "run", "check")
65+
session.run("bun", "install", external=True)
66+
session.run("bun", "run", "check", external=True)
6767

6868

6969
def install_requirements_file(session: Session, name: str) -> None:

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools>=42", "wheel", "nodejs-bin==18.4.0a4"]
2+
requires = ["setuptools>=42", "wheel"]
33
build-backend = "setuptools.build_meta"
44

55
[tool.mypy]

setup.py

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
from __future__ import annotations, print_function
22

33
import shutil
4+
import subprocess
45
import sys
56
import traceback
67
from distutils import log
78
from pathlib import Path
89

9-
from nodejs import npm
1010
from setuptools import find_namespace_packages, setup
1111
from setuptools.command.develop import develop
1212
from setuptools.command.sdist import sdist
@@ -102,14 +102,27 @@ class Command(build_cls):
102102
def run(self):
103103

104104
log.info("Installing Javascript...")
105-
result = npm.call(["install"], cwd=str(js_dir))
105+
result = subprocess.run(
106+
["bun", "install"], cwd=str(js_dir), check=True
107+
).returncode
106108
if result != 0:
107109
log.error(traceback.format_exc())
108110
log.error("Failed to install Javascript")
109111
raise RuntimeError("Failed to install Javascript")
110112

111113
log.info("Building Javascript...")
112-
result = npm.call(["run", "build"], cwd=str(js_dir))
114+
result = subprocess.run(
115+
[
116+
"bun",
117+
"build",
118+
"./src/index.tsx",
119+
"--outfile",
120+
str(static_dir / "client.js"),
121+
"--minify",
122+
],
123+
cwd=str(js_dir),
124+
check=True,
125+
).returncode
113126
if result != 0:
114127
log.error(traceback.format_exc())
115128
log.error("Failed to build Javascript")

src/js/bun.lockb

99 KB
Binary file not shown.

src/js/eslint.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default [{}];

0 commit comments

Comments
 (0)