Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
1082321
Ignore extracted compareExpressions-packages nested repo
m-messer Sep 11, 2026
710a92a
Depend on the extracted compareexpressions packages
m-messer Sep 12, 2026
c88110e
Use compareexpressions.criteria and slr_parsing; add an app-local result
m-messer Sep 12, 2026
60e58b5
Use compareexpressions.expression_parsing for symbolic expressions
m-messer Sep 12, 2026
93909cd
Use compareexpressions.units for physical quantities
m-messer Sep 12, 2026
377cfbb
Drop the lambda-feedback latex2sympy fork
m-messer Sep 12, 2026
0c70e71
Document the compareexpressions packages
m-messer Sep 12, 2026
6accd12
Install the packages from m-messer/compare-expressions-packages
m-messer Sep 12, 2026
6e31934
"Added physical quantity preview implementation and associated tests"
m-messer Sep 15, 2026
572c547
Add symbolic_preview.py and feedback/tags.py, moved from expression_p…
m-messer Sep 16, 2026
f0551d1
Wire up the moved symbolic preview in preview.py and context/symbolic.py
m-messer Sep 16, 2026
416aed0
Rebuild physical_quantity_preview.py against the new expression_parsi…
m-messer Sep 16, 2026
a8f1837
Catch typed notation exceptions in evaluation.py instead of checking …
m-messer Sep 16, 2026
c48fe3a
Update physical_quantity to handle reverted_unit feedback
m-messer Sep 16, 2026
53ac036
Replace `add_feedback_from_tags` with `CriteriaGraph.export_feedback`…
m-messer Sep 25, 2026
686d3d9
Pin the packages at 2848e58 (CriteriaGraph.export_feedback)
m-messer Sep 25, 2026
541162c
Use the renamed lambdafeedback packages
m-messer Sep 25, 2026
3f4dff3
Ignore extracted compareExpressions-packages nested repo
m-messer Sep 11, 2026
08454d7
Merge branch 'main' into refactor/adopt-packages
m-messer Oct 12, 2026
8e27807
Refactor symbolic and quantity contexts for updated lambdafeedback APIs
m-messer Oct 13, 2026
bd9c991
Simplify LaTeX outputs: Remove unnecessary parentheses and update not…
m-messer Oct 13, 2026
9807764
Use SympyParsingConfig.replace for extra unsplittable symbols
m-messer Oct 13, 2026
8f0c5d0
Update lambdafeedback dependencies to v0.3.0-rc.2
m-messer Oct 13, 2026
c7d375b
Remove unused benchmarking scripts, Mermaid documentation files, and …
m-messer Oct 13, 2026
f7a1b32
Add development container setup with Dockerfile and configuration files
m-messer Oct 13, 2026
7a091d9
Remove redundant `pytest.main` calls, outdated imports, and update do…
m-messer Oct 13, 2026
8e95025
Mark slow-running tests with `@pytest.mark.slow` and update healthche…
m-messer Oct 13, 2026
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
37 changes: 37 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
ARG PYTHON_VERSION=3.12
FROM python:${PYTHON_VERSION}-slim

# Matches the Python version used by GitHub Actions (test-lint.yml, staging-deploy.yml)
# and the production image (app/Dockerfile), so tests behave the same locally.

RUN apt-get update && apt-get install -y --no-install-recommends \
git \
build-essential \
curl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*

# Node.js, required to run the Claude Code CLI
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y --no-install-recommends nodejs \
&& rm -rf /var/lib/apt/lists/*

RUN npm install -g @anthropic-ai/claude-code

# Claude Code refuses --dangerously-skip-permissions as root unless it knows
# it's already inside an isolated sandbox (this container).
ENV IS_SANDBOX=1

# Run `claude` in this container with permission prompts bypassed by default,
# since the container itself (not the CLI) is the safety boundary here. This
# alias only affects the container image, never the host's `claude` config.
RUN echo "alias claude='claude --dangerously-skip-permissions'" >> /etc/bash.bashrc

WORKDIR /workspace

COPY app/requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r /tmp/requirements.txt \
&& pip install --no-cache-dir pytest flake8

ENV PYTHONPATH=/workspace
37 changes: 37 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "compareExpressions",
"build": {
"dockerfile": "Dockerfile",
"context": ".."
},
"workspaceFolder": "/workspace",
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached",

"mounts": [
"source=${localEnv:HOME}/.claude,target=/root/.claude,type=bind,consistency=cached"
],

"containerEnv": {
"PYTHONPATH": "/workspace",
"IS_SANDBOX": "1"
},

"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-python.flake8",
"anthropic.claude-code"
],
"settings": {
"python.defaultInterpreterPath": "/usr/local/bin/python",
"python.testing.pytestEnabled": true,
"python.testing.pytestArgs": []
}
}
},

"postCreateCommand": "pip install --no-cache-dir -r app/requirements.txt",

"remoteUser": "root"
}
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,18 @@ app/benchmark.py
app/profiling_examples.py

.idea/

# Extracted packages live here as their own separate git repo
/compareExpressions-packages/

# OS / editor / local tool files
.DS_Store
.vscode/
.junie/
.mcp.json

# Local virtual environments (e.g. .venv38)
.venv*/

# Test reports written by CI
reports/
16 changes: 10 additions & 6 deletions README.md
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,26 @@ This version is specifically for python, however the ultimate goal is to make si
- [Production API Gateway Integrations](https://eu-west-2.console.aws.amazon.com/apigateway/main/develop/integrations/attach?api=cttolq2oph&integration=qpbgva8&region=eu-west-2&routes=0xsoy4q)

4. Merge commits into the default branch
- This will trigger the `test-and-deploy.yml` workflow, which will build the docker image, push it to a shared ECR repository, then call the backend `grading-function/ensure` route to build the necessary infrastructure to make the function available from the client app.
- This will trigger the `staging-deploy.yml` workflow (and `production-deploy.yml` on release), which will build the docker image, push it to a shared ECR repository, then call the backend `grading-function/ensure` route to build the necessary infrastructure to make the function available from the client app.

5. You are now ready to start developing your function:

- Edit the `app/evaluation.py` file, which ultimately gets called when the function is given the `eval` command
- Edit the `app/evaluation_tests.py` file to add tests which get run:
- Every time you commit to this repo, before the image is built and deployed
- Whenever the `healthcheck` command is supplied to the deployed function
- Edit the `app/docs.md` file to reflect your changes. This file is baked into the function's image, and is made available using the `docs` command. This feature is used to display this function's documentation on our [Documentation](https://lambda-feedback.github.io/Documentation/) website once it's been hooked up!
- Add pytest tests to `app/evaluation_test.py`, `app/preview_test.py` or `app/tests/`. They get run:
- On every pull request and before the image is built and deployed (`pytest` from the repo root)
- Whenever the `healthcheck` command is supplied to the deployed function (via `app/evaluation_tests.py`)
- Edit `app/docs/user.md` and `app/docs/dev.md` to reflect your changes. These files are baked into the function's image, and is made available using the `docs` command. This feature is used to display this function's documentation on our [Documentation](https://lambda-feedback.github.io/Documentation/) website once it's been hooked up!

---

## How it works

The function is built on top of a custom base layer, [BaseEvaluationFunctionLayer](https://github.com/lambda-feedback/BaseEvalutionFunctionLayer), which tools, tests and schema checking relevant to all evaluation functions.

### Packages

Expression parsing, unit handling and the criteria machinery come from the [lambda-feedback-packages](https://github.com/lambda-feedback/lambda-feedback-packages) repository (currently the `v0.3.0-rc.2` release candidate), installed as git dependencies in `app/requirements.txt`. See the "Packages" section of `app/docs/dev.md` for what each package does and how to develop against a local checkout.

### Docker & Amazon Web Services (AWS)

The grading scripts are hosted AWS Lambda, using containers to run a docker image of the app. Docker is a popular tool in software development that allows programs to be hosted on any machine by bundling all its requirements and dependencies into a single file called an **image**.
Expand All @@ -57,7 +61,7 @@ Once the code passes all these tests, it will then be uploaded to AWS and will b
## Pre-requisites
Although all programming can be done through the GitHub interface, it is recommended you do this locally on your machine. To do this, you must have installed:

- Python 3.8 or higher.
- Python 3.12 (the version used by CI and the production image).

- GitHub Desktop or the `git` CLI.

Expand Down
Empty file removed __init__.py
Empty file.
12 changes: 12 additions & 0 deletions app/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Build files
Dockerfile
.dockerignore

# The base image provides the app package's __init__.py and handler
__init__.py

# Local and generated files
**/__pycache__
**/*.py[cod]
**/.DS_Store
**/.pytest_cache
49 changes: 6 additions & 43 deletions app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Base image that bundles AWS Lambda Python 3.8 image with some middleware functions
# FROM base-eval-tmp
# FROM rabidsheep55/python-base-eval-layer
# Base image that bundles the AWS Lambda Python image with the lambda-feedback middleware (app.handler)
FROM ghcr.io/lambda-feedback/baseevalutionfunctionlayer:main-3.12

RUN dnf install -y git findutils && dnf clean all
Expand All @@ -13,46 +11,11 @@ ENV PYTHONPATH=/app
COPY requirements.txt .
RUN pip3 install -r requirements.txt

# Copy main scripts
COPY evaluation.py ./app/
COPY evaluation_test.py ./app/
COPY preview.py ./app/
COPY preview_test.py ./app/

# Copy contexts
COPY context/physical_quantity.py ./app/context/
COPY context/symbolic.py ./app/context/

# Copy feedback messages
COPY feedback/physical_quantity.py ./app/feedback/
COPY feedback/symbolic.py ./app/feedback/

# Copy preview implementations
COPY preview_implementations/physical_quantity_preview.py ./app/preview_implementations/
COPY preview_implementations/symbolic_preview.py ./app/preview_implementations/

# Copy tests
COPY tests/example_test.py ./app/tests/
COPY tests/physical_quantity_evaluation_test.py ./app/tests/
COPY tests/physical_quantity_preview_test.py ./app/tests/
COPY tests/slr_quantity_test.py ./app/tests/
COPY tests/symbolic_evaluation_test.py ./app/tests/
COPY tests/symbolic_preview_test.py ./app/tests/

# Copy utility code
COPY utility/criteria_graph_utilities.py ./app/utility/
COPY utility/criteria_parsing.py ./app/utility/
COPY utility/evaluation_result_utilities.py ./app/utility/
COPY utility/expression_utilities.py ./app/utility/
COPY utility/physical_quantity_utilities.py ./app/utility/
COPY utility/preview_utilities.py ./app/utility/
COPY utility/slr_parsing_utilities.py ./app/utility/
COPY utility/syntactical_comparison_utilities.py ./app/utility/
COPY utility/unit_system_conversions.py ./app/utility/

# Copy Documentation
COPY docs/dev.md ./app/docs/dev.md
COPY docs/user.md ./app/docs/user.md
# The healthcheck command runs the pytest suite (see evaluation_tests.py)
RUN pip3 install pytest

# Copy the evaluation function source, tests and docs (exclusions in .dockerignore)
COPY . ./app/

# Set permissions so files and directories can be accessed on AWS
RUN chmod 644 $(find . -type f)
Expand Down
57 changes: 0 additions & 57 deletions app/benchmarking.py

This file was deleted.

2 changes: 2 additions & 0 deletions app/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def pytest_configure(config):
config.addinivalue_line("markers", "slow: excluded from the deployed healthcheck (see evaluation_tests.py)")
Loading
Loading