Skip to content

Commit abb7a95

Browse files
upgrade packages (#22)
* upgrade packages * WIP : model improvements * WIP: switched to fastapi * up workflows * implemented multi embeddings * improved cluastering analysis * better reporting * minor updates * safer execution * safer execution * hungarian to ari * improved fit * added model serialization * clean up * better fit() * better solver: solve for dbcv + ari * exposed min-scale * improved docstings/predict pipeline * improved docstings/predict pipeline * render cluster labels * added PCA-based anomaly detection * better tracking/transforms * added negative samples * update sh parameters * upd readme.MD * added pars to loop * improved random seed; added screener * fixed multi word grouping bug * better prediction * added screener_2; update docs
1 parent 46df8b6 commit abb7a95

89 files changed

Lines changed: 18191 additions & 5103 deletions

File tree

Some content is hidden

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

.cursor/rules/docs.mdc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
description: "Documentation conventions"
3+
globs:
4+
- "docs/**/*.md"
5+
- "mkdocs.yaml"
6+
alwaysApply: false
7+
---
8+
9+
# Documentation Rules
10+
- Write docs in Markdown with clear headings and code examples.
11+
- Update `mkdocs.yaml` navigation when adding new docs.
12+
- Keep `README.md` concise, and move long explanations to `/docs`.
13+
- Use Python code fences (```python … ```) in examples.

.cursor/rules/pydantic-usage.mdc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
description: "Conventions for using Pydantic models and settings"
3+
globs:
4+
- "**/*.py"
5+
alwaysApply: false
6+
---
7+
8+
# Pydantic Rules
9+
- Use `pydantic.BaseModel` for request/response schemas.
10+
- For configuration, use `pydantic_settings.BaseSettings` (v2).
11+
- Always provide default values or use `...` for required fields.
12+
- Use model validators (`@field_validator`, `@model_validator`) instead of custom init logic.
13+
- Keep models small and focused on one purpose.

.cursor/rules/python-run.mdc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
description: "Use `uv run` for running Python code instead of raw python3"
3+
globs:
4+
- "**/*.py"
5+
alwaysApply: true
6+
---
7+
8+
# Running Python code
9+
- **Do not** run `python3 -c` directly.
10+
- Always invoke Python code using `uv run python <script>` or `uv run <module>` when executing project scripts.
11+
- Use the `uv` environment so that dependencies from `uv.lock` are respected.
12+
- This applies to both interactive code execution and testing.

.cursor/rules/python-style.mdc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
description: "Follow project style guidelines for Python code"
3+
globs:
4+
- "**/*.py"
5+
alwaysApply: true
6+
---
7+
8+
# Python Coding Rules
9+
- Use python 3.12 conventions: use `type | None` instead of `Optional` etc
10+
- Use type hints everywhere (PEP 484).
11+
- Use snake_case for functions and variables, PascalCase for classes.
12+
- Avoid unused imports.
13+
- Use `async`/`await` where appropriate.
14+
- Always keep functions small and composable.
15+
- Avoid using hasattr at all costs, it's not safe

.cursor/rules/tests.mdc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
description: "Testing guidelines"
3+
globs:
4+
- "test/**/*.py"
5+
alwaysApply: false
6+
---
7+
8+
# Testing Guidelines
9+
- Use `pytest` with descriptive test function names.
10+
- Prefer fixtures over global state.
11+
- For async code, use `pytest-asyncio`.
12+
- Ensure test coverage for:
13+
- Pydantic model validation
14+
- Env config via `BaseSettings`
15+
- Error cases and edge cases
16+
- Run tests with `uv run pytest test`.

.cursor/rules/uv-deps.mdc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
description: "Dependency management with uv"
3+
globs:
4+
- "pyproject.toml"
5+
- "uv.lock"
6+
alwaysApply: false
7+
---
8+
9+
# Dependency Management
10+
- Pin versions in `pyproject.toml` for reproducibility.
11+
- Run `uv pip check` to validate the dependency tree.

.github/workflows/build-docs.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build GitHub Pages
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- 'docs/**'
8+
- 'mkdocs.yml'
9+
- 'pelinker/**' # Check this path
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: write
14+
pages: write
15+
id-token: write
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v5
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: '3.10'
30+
- name: Install uv
31+
uses: astral-sh/setup-uv@v7
32+
with:
33+
version: "0.10.12"
34+
- name: Install dependencies
35+
run: |
36+
uv sync --extra docs
37+
- name: Build site
38+
run: |
39+
uv run mkdocs build --site-dir _site
40+
- name: Upload Pages artifact
41+
uses: actions/upload-pages-artifact@v3
42+
with:
43+
path: _site
44+
45+
deploy:
46+
needs: build
47+
environment:
48+
name: github-pages
49+
url: ${{ steps.deployment.outputs.page_url }}
50+
runs-on: ubuntu-latest
51+
steps:
52+
- name: Deploy to GitHub Pages
53+
id: deployment
54+
uses: actions/deploy-pages@v4

.github/workflows/pre-commit.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
pre-commit:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v5
13+
- name: Install uv
14+
uses: astral-sh/setup-uv@v7
15+
with:
16+
version: "0.10.12"
17+
- name: Install dependencies (including dev)
18+
run: uv sync --extra dev --no-install-project
19+
- name: Run pre-commit
20+
run: uv run pre-commit run --all-files

.github/workflows/pypi-publish.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Upload Python Package to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
pypi-publish:
12+
runs-on: ubuntu-latest
13+
environment:
14+
name: pypi
15+
url: https://pypi.org/p/pelinker
16+
permissions:
17+
id-token: write
18+
19+
steps:
20+
- uses: actions/checkout@v5
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: '3.10'
26+
- name: Install uv
27+
uses: astral-sh/setup-uv@v7
28+
with:
29+
version: "0.10.12"
30+
- name: Build and publish
31+
run: |
32+
uv build
33+
uv publish
34+
env:
35+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ fail_fast: false
33
repos:
44
# Python linting and formatting
55
- repo: https://github.com/astral-sh/ruff-pre-commit
6-
rev: v0.14.14
6+
rev: v0.15.7
77
hooks:
88
- id: ruff-check
99
args: [--fix, --ignore, E722]

0 commit comments

Comments
 (0)