Skip to content

Commit fd175b3

Browse files
authored
Merge pull request #4 from flowdacity/migration
Migration to asyncio
2 parents bd0d06f + aa1dd66 commit fd175b3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1381
-1185
lines changed

.github/workflows/test.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Run tests and upload coverage
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
test:
14+
name: Run tests and collect coverage
15+
runs-on: ubuntu-latest
16+
17+
services:
18+
redis:
19+
image: redis:7-alpine
20+
ports:
21+
- 6379:6379
22+
options: >-
23+
--health-cmd "redis-cli ping"
24+
--health-interval 5s
25+
--health-timeout 5s
26+
--health-retries 5
27+
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
32+
- name: Install uv (with Python 3.12)
33+
uses: astral-sh/setup-uv@v4
34+
with:
35+
python-version: "3.12"
36+
37+
- name: Install dependencies via uv
38+
run: |
39+
# installs main deps from [project.dependencies]
40+
# plus dev group from [dependency-groups]
41+
uv sync --group dev
42+
43+
- name: Run tests
44+
run: |
45+
uv run pytest --cov=fq_server --cov-branch --cov-report=xml
46+
47+
- name: Upload results to Codecov
48+
uses: codecov/codecov-action@v5
49+
with:
50+
token: ${{ secrets.CODECOV_TOKEN }}
51+
slug: flowdacity/flowdacity-queue-server

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ docs/_build/
5454
Dockerfile0
5555
Dockerfile1
5656
Dockerfile_supervisor
57-
test_sharq.py
57+
test_fq.py
5858
.idea/*
5959
venv/*
6060
.vscode/

.pre-commit-config.yaml

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

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12

.secrets.baseline

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

CHANGELOG

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

Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# --- Build arguments with defaults ---
2+
ARG PYTHON_VERSION=3.12
3+
ARG PORT=8080
4+
5+
# --- Base image ---
6+
FROM python:${PYTHON_VERSION}-slim
7+
8+
# --- Re-declare build args as env for access after FROM ---
9+
ARG PORT
10+
ENV PYTHONDONTWRITEBYTECODE=1 \
11+
PYTHONUNBUFFERED=1 \
12+
FQ_CONFIG=/app/docker.conf \
13+
UV_LINK_MODE=copy \
14+
PORT=${PORT}
15+
16+
WORKDIR /app
17+
18+
RUN pip install --no-cache-dir --upgrade uv
19+
20+
COPY pyproject.toml uv.lock* ./
21+
22+
RUN uv pip install --system --no-cache .
23+
24+
COPY . .
25+
26+
EXPOSE ${PORT}
27+
28+
CMD ["sh", "-c", "uvicorn asgi:app --host 0.0.0.0 --port ${PORT}"]

Jenkinsfile

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

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include LICENSE.txt README.md sharq.conf
1+
include LICENSE.txt README.md fq.conf

Makefile

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,47 @@
1-
.PHONY: clean build install uninstall test run
1+
.PHONY: all clean build install uninstall test publish redis redis-down
22

3-
all: clean
3+
# Default target
4+
all: clean build
45

6+
# Remove Python + build artifacts
57
clean:
6-
find . -name \*.pyc -delete
7-
find . -name \*.pyo -delete
8-
find . -name \*~ -delete
9-
rm -rf build dist SharQServer.egg-info
8+
find . -name "*.pyc" -delete
9+
find . -name "*.pyo" -delete
10+
find . -name "*~" -delete
11+
rm -rf dist build *.egg-info
1012

13+
# Build package (requires: pip install build)
1114
build:
12-
python setup.py sdist
15+
python -m build
1316

17+
# Install locally built package
1418
install:
15-
pip install dist/SharQServer-*.tar.gz
19+
pip install --force-reinstall dist/*.whl
1620

21+
# Uninstall FQ completely
1722
uninstall:
18-
yes | pip uninstall sharqserver
23+
pip uninstall -y flowdacity-queue
1924

25+
# Run tests — prefers pytest, falls back to python modules
2026
test:
21-
python -m tests
27+
@if python -c "import pytest" 2>/dev/null; then \
28+
python -m pytest -q; \
29+
else \
30+
echo 'pytest not installed — running direct test modules'; \
31+
python -m tests.test_routes; \
32+
fi
2233

23-
run:
24-
sharq-server --config sharq.conf
34+
publish: clean
35+
uv sync --group dev
36+
uv run python -m build
37+
# @if [ -z "$$PYPI_API_TOKEN" ]; then echo "PYPI_API_TOKEN must be set"; exit 1; fi
38+
# uv run python -m twine upload dist/* -u __token__ -p "$$PYPI_API_TOKEN"
39+
uv run python -m twine upload dist/*
40+
41+
# Start Redis container
42+
redis:
43+
docker compose up -d redis
44+
45+
# Stop Redis container
46+
redis-down:
47+
docker compose down

0 commit comments

Comments
 (0)