Skip to content

Commit ee4946d

Browse files
committed
Update Python version and dependencies
Also use a TOML file instead of requirements.txt to make it easier to develop using uv. Also move to using a __main__ file so that the gunicorn and command-line ways to run the server are the same: using the module `checker.server`.
1 parent 44f7682 commit ee4946d

File tree

7 files changed

+28
-24
lines changed

7 files changed

+28
-24
lines changed

Dockerfile

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
FROM python:3.12-slim
2-
3-
RUN ln -sf /bin/bash /bin/sh
1+
FROM python:3.14-slim
42

53
# To ensure output printed correctly, alter buffering:
64
ENV PYTHONUNBUFFERED=0
75

86
RUN mkdir -p /usr/src/app
97
WORKDIR /usr/src/app
108

11-
COPY requirements.txt /usr/src/app/
12-
RUN pip install --no-cache-dir -r requirements.txt
9+
COPY pyproject.toml /usr/src/app/
10+
RUN pip install --no-cache-dir -e .
1311

1412
COPY . /usr/src/app
1513

1614
EXPOSE 5000
1715

18-
CMD gunicorn --config=checker/server/gunicorn_conf.py checker.server:app
16+
CMD ["gunicorn", "--config", "checker/server/gunicorn_conf.py", "checker.server:app"]

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ This project now uses Python 3. The last version using Python 2.7 was [v0.8.0](h
99

1010
### Development Setup Instructions
1111
#### Simple Setup
12-
1. Install [Python 3.10](https://www.python.org/)
12+
1. Install [Python 3.14](https://www.python.org/)
1313
2. Clone this repository
14-
3. Run `pip install -r requirements.txt`
15-
4. Run `python server\api.py`
14+
3. Run `pip install -e .`
15+
4. Run `python -m checker.server`
1616

1717
Your server should be running at `http://localhost:5000/check`.
1818
Now make JSON-based POST requests with target and test expression strings, e.g.
@@ -48,12 +48,12 @@ To develop the Docker container as well:
4848

4949
5. Install [Docker](https://www.docker.com/)
5050
7. Run `docker build -t ucamcldtg/equality-checker --pull .`
51-
8. Test using `docker run -p 5000:5000 -it ucamcldtg/equality-checker` rather than running Python locally
51+
8. Test using `docker run --rm -p 5000:5000 -it ucamcldtg/equality-checker` rather than running Python locally
5252
9. Optionally deploy to dockerhub: `docker push ucamcldtg/equality-checker` (requires authentication)
5353

5454
### Production Use
5555

56-
The Docker container is available from [dockerhub](https://registry.hub.docker.com/u/ucamcldtg/equality-checker/) by running: `docker pull ucamcldtg/equality-checker` or by listing it as an image in a Docker Compose file. Port 5000 of the container will need to be mapped to the port the checker is expected to listen on.
56+
The Docker container is available from [dockerhub](https://hub.docker.com/r/ucamcldtg/equality-checker) by running: `docker pull ucamcldtg/equality-checker` or by listing it as an image in a Docker Compose file. Port 5000 of the container will need to be mapped to the port the checker is expected to listen on.
5757

5858
For instance, run:
5959
```

checker/server/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from .server import *
1+
from .server import *

checker/server/__main__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from .server import app
2+
3+
# Run the app:
4+
app.run(port=5000, host="0.0.0.0", debug=False)

checker/server/server.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,3 @@ def ping():
183183
# This will only work provided debug=False - otherwise the debugger hijacks them!
184184
for code in default_exceptions.keys():
185185
app.register_error_handler(code, _make_json_error)
186-
187-
if __name__ == '__main__':
188-
# Run the app:
189-
app.run(port=5000, host="0.0.0.0", debug=False)

pyproject.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[project]
2+
name = "equality-checker"
3+
version = "0.14.2"
4+
description = "Lightweight server for testing equivalence of two symbolic expressions."
5+
requires-python = ">=3.14"
6+
dependencies = [
7+
"flask==3.1.2",
8+
"gunicorn==23.0.0",
9+
"mpmath==1.3.0",
10+
"numpy==2.4.0",
11+
"pytest>=9.0.2",
12+
"pytest-cov>=7.0.0",
13+
"sympy==1.14.0",
14+
]

requirements.txt

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

0 commit comments

Comments
 (0)