Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Normalise line endings to LF in the repository, and check out LF on every
# platform - including Windows, where core.autocrlf would otherwise produce
# CRLF working copies.
#
# This is not cosmetic. The compiled bundles in batchcode_plugin/static/ are
# committed, and a sourcemap embeds its sources verbatim in "sourcesContent",
# line endings included. A CRLF checkout of frontend/src therefore builds
# different .js.map files than a LF one, which would make the CI check for
# up-to-date artifacts fail on Windows even when nothing had changed.
* text=auto eol=lf

# Generated artifacts: never transform them, so they stay byte-identical to
# whatever the build produced.
batchcode_plugin/static/** -text
frontend/src/locales/**/messages.ts -text
frontend/src/locales/**/messages.d.ts -text

# Lockfiles are generated; keep them out of diff review noise
frontend/package-lock.json -diff linguist-generated
uv.lock -diff linguist-generated
79 changes: 79 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Ensure that the plugin meets the required style guidelines
# Ensure that the tests pass, that the plugin builds, and that the committed
# frontend artifacts match their sources

name: CI Checks

on: ["push", "pull_request"]

jobs:
backend:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
# Honours .python-version
- name: Install Deps
run: uv sync --locked
- name: Style Checks
run: |
uv run ruff format --check .
uv run ruff check .
- name: Tests
run: uv run pytest
- name: Build Plugin
run: uv run python -m build

frontend:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
cache-dependency-path: frontend/package-lock.json
# `npm ci`, not `npm install`: several dependencies are declared as
# "latest", so only the lockfile makes the build reproducible - and the
# artifact checks below depend on that.
- name: Install Deps
run: npm ci
working-directory: frontend
- name: Lint
run: npm run lint
working-directory: frontend
- name: Build
run: |
npm run translate
npm run build
working-directory: frontend

# Both the message catalogs and the compiled bundles are committed, so a
# change to a source file must come with its rebuilt artifacts. Staging
# first, because `git diff` alone would not notice new files - and the
# bundle filenames carry a content hash, so they change with the content.
- name: Check Committed Artifacts Are Up To Date
run: |
git add -A frontend/src/locales batchcode_plugin/static

if ! git diff --cached --exit-code --stat -- frontend/src/locales; then
echo ""
echo "ERROR: Translation catalogs are out of date."
echo "Run 'cd frontend && npm run translate' and commit the result."
exit 1
fi

if ! git diff --cached --exit-code --stat -- batchcode_plugin/static; then
echo ""
echo "ERROR: Compiled frontend bundles are out of date."
echo "Run 'cd frontend && npm run build' and commit the result."
echo "The bundles are committed so that installing this plugin"
echo "from a git URL includes the user interface."
exit 1
fi
165 changes: 165 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# Ruff
.ruff_cache/
26 changes: 0 additions & 26 deletions .gitlab-ci.yml

This file was deleted.

19 changes: 19 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.12.0
hooks:
- id: ruff-format
args: [ --preview ]
- id: ruff
args: [
--fix,
# --unsafe-fixes,
--preview
]
- repo: https://github.com/biomejs/pre-commit
rev: v2.0.0-beta.5
hooks:
- id: biome-check
additional_dependencies: ["@biomejs/biome@2.0.0"]
files: ^frontend/src.*\.(js|ts|tsx)$
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13
Loading
Loading