lavlab-shell 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lavlab_shell-0.1.0/.devcontainer/Dockerfile +43 -0
- lavlab_shell-0.1.0/.editorconfig +36 -0
- lavlab_shell-0.1.0/.github/dependabot.yml +16 -0
- lavlab_shell-0.1.0/.github/workflows/build.yml +22 -0
- lavlab_shell-0.1.0/.github/workflows/lint.yml +19 -0
- lavlab_shell-0.1.0/.github/workflows/publish.yml +35 -0
- lavlab_shell-0.1.0/.github/workflows/pytest.yml +36 -0
- lavlab_shell-0.1.0/.gitignore +87 -0
- lavlab_shell-0.1.0/.pre-commit-config.yaml +27 -0
- lavlab_shell-0.1.0/CONTRIBUTING.md +63 -0
- lavlab_shell-0.1.0/Dockerfile +46 -0
- lavlab_shell-0.1.0/LICENSE.txt +21 -0
- lavlab_shell-0.1.0/Makefile +57 -0
- lavlab_shell-0.1.0/PKG-INFO +264 -0
- lavlab_shell-0.1.0/README.md +234 -0
- lavlab_shell-0.1.0/docs/api.md +47 -0
- lavlab_shell-0.1.0/docs/index.md +50 -0
- lavlab_shell-0.1.0/mkdocs.yml +37 -0
- lavlab_shell-0.1.0/pyproject.toml +161 -0
- lavlab_shell-0.1.0/requirements/requirements-docs.txt +230 -0
- lavlab_shell-0.1.0/requirements/requirements-lint.txt +107 -0
- lavlab_shell-0.1.0/requirements/requirements-test.txt +129 -0
- lavlab_shell-0.1.0/requirements/requirements-types.txt +115 -0
- lavlab_shell-0.1.0/requirements.txt +104 -0
- lavlab_shell-0.1.0/src/shell/__about__.py +6 -0
- lavlab_shell-0.1.0/src/shell/__init__.py +14 -0
- lavlab_shell-0.1.0/src/shell/benchmark.py +634 -0
- lavlab_shell-0.1.0/src/shell/cli.py +323 -0
- lavlab_shell-0.1.0/src/shell/infer_omero_wsi.py +1664 -0
- lavlab_shell-0.1.0/src/shell/infer_wsi.py +150 -0
- lavlab_shell-0.1.0/src/shell/inference.py +126 -0
- lavlab_shell-0.1.0/src/shell/model.py +160 -0
- lavlab_shell-0.1.0/src/shell/preprocessing.py +337 -0
- lavlab_shell-0.1.0/src/shell/py.typed +0 -0
- lavlab_shell-0.1.0/src/shell/weights/model_v1.pth +0 -0
- lavlab_shell-0.1.0/tests/__init__.py +4 -0
- lavlab_shell-0.1.0/tests/conftest.py +4 -0
- lavlab_shell-0.1.0/tests/test_shell.py +16 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
ARG PY_VERSION=3.12
|
|
2
|
+
|
|
3
|
+
FROM python:${PY_VERSION}-slim AS base
|
|
4
|
+
|
|
5
|
+
# create non-root user (primarily for devcontainer)
|
|
6
|
+
RUN groupadd --gid 1000 vscode \
|
|
7
|
+
&& useradd --uid 1000 --gid 1000 -m vscode
|
|
8
|
+
|
|
9
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
10
|
+
libopenslide0 \
|
|
11
|
+
libvips42 \
|
|
12
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
13
|
+
|
|
14
|
+
WORKDIR /app
|
|
15
|
+
|
|
16
|
+
COPY pyproject.toml README.md LICENSE.txt ./
|
|
17
|
+
COPY src/ src/
|
|
18
|
+
|
|
19
|
+
RUN chown -R vscode:vscode /app
|
|
20
|
+
|
|
21
|
+
FROM base AS hatch
|
|
22
|
+
RUN pip3 install --no-cache-dir hatch
|
|
23
|
+
ENV HATCH_ENV=default
|
|
24
|
+
ENTRYPOINT ["hatch", "run"]
|
|
25
|
+
|
|
26
|
+
FROM base AS dev
|
|
27
|
+
COPY requirements/ requirements/
|
|
28
|
+
COPY requirements.txt ./
|
|
29
|
+
COPY tests/ tests/
|
|
30
|
+
COPY docs/ docs/
|
|
31
|
+
COPY mkdocs.yml ./
|
|
32
|
+
RUN pip3 install --no-cache-dir hatch \
|
|
33
|
+
&& hatch build \
|
|
34
|
+
&& pip3 install --no-cache-dir $(find /app -name 'requirement*.txt' -exec echo -n '-r {} ' \;)
|
|
35
|
+
USER vscode
|
|
36
|
+
|
|
37
|
+
FROM base AS prod
|
|
38
|
+
COPY --from=dev /app/dist/*.whl /tmp/
|
|
39
|
+
RUN pip3 install --no-cache-dir /tmp/*.whl \
|
|
40
|
+
&& rm -rf /tmp/*.whl
|
|
41
|
+
USER vscode
|
|
42
|
+
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
|
|
43
|
+
CMD python -c "import shell" || exit 1
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# EditorConfig — https://editorconfig.org
|
|
2
|
+
|
|
3
|
+
root = true
|
|
4
|
+
|
|
5
|
+
[*]
|
|
6
|
+
indent_style = space
|
|
7
|
+
indent_size = 4
|
|
8
|
+
end_of_line = lf
|
|
9
|
+
charset = utf-8
|
|
10
|
+
trim_trailing_whitespace = true
|
|
11
|
+
insert_final_newline = true
|
|
12
|
+
|
|
13
|
+
[*.py]
|
|
14
|
+
indent_size = 4
|
|
15
|
+
max_line_length = 88
|
|
16
|
+
|
|
17
|
+
[*.{yml,yaml}]
|
|
18
|
+
indent_size = 2
|
|
19
|
+
|
|
20
|
+
[*.{json,jsonc}]
|
|
21
|
+
indent_size = 2
|
|
22
|
+
|
|
23
|
+
[*.{toml,cfg,ini}]
|
|
24
|
+
indent_size = 4
|
|
25
|
+
|
|
26
|
+
[*.md]
|
|
27
|
+
trim_trailing_whitespace = false
|
|
28
|
+
|
|
29
|
+
[*.{sh,bash,zsh}]
|
|
30
|
+
indent_size = 2
|
|
31
|
+
|
|
32
|
+
[Makefile]
|
|
33
|
+
indent_style = tab
|
|
34
|
+
|
|
35
|
+
[Dockerfile*]
|
|
36
|
+
indent_size = 4
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: "pip"
|
|
4
|
+
directory: "/"
|
|
5
|
+
schedule:
|
|
6
|
+
interval: "weekly"
|
|
7
|
+
|
|
8
|
+
- package-ecosystem: "github-actions"
|
|
9
|
+
directory: "/"
|
|
10
|
+
schedule:
|
|
11
|
+
interval: "weekly"
|
|
12
|
+
|
|
13
|
+
- package-ecosystem: "docker"
|
|
14
|
+
directory: "/"
|
|
15
|
+
schedule:
|
|
16
|
+
interval: "weekly"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: Build Wheel using Hatch
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build-wheel:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
- name: Build Docker image
|
|
15
|
+
run: docker build --target hatch -t shell:hatch .
|
|
16
|
+
- name: Build wheel with hatch
|
|
17
|
+
run: docker run --rm --entrypoint hatch -v "${{ github.workspace }}:/app" shell:hatch build
|
|
18
|
+
- name: Upload wheel
|
|
19
|
+
uses: actions/upload-artifact@v4
|
|
20
|
+
with:
|
|
21
|
+
name: wheel
|
|
22
|
+
path: dist/*.whl
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
name: Lint and Format with Ruff
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
branches:
|
|
7
|
+
- main
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint-and-format:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
- name: Build Docker image
|
|
15
|
+
run: docker build --target hatch -t shell:hatch .
|
|
16
|
+
- name: Check formatting with Ruff
|
|
17
|
+
run: docker run --rm -e HATCH_ENV=lint -v "${{ github.workspace }}:/app" shell:hatch format-check
|
|
18
|
+
- name: Run Ruff linter
|
|
19
|
+
run: docker run --rm -e HATCH_ENV=lint -v "${{ github.workspace }}:/app" shell:hatch check
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: write
|
|
9
|
+
id-token: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
pypi:
|
|
13
|
+
name: Publish to PyPI
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
environment: pypi
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Set up Python 3.12
|
|
21
|
+
uses: actions/setup-python@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: "3.12"
|
|
24
|
+
|
|
25
|
+
- name: Install build tools
|
|
26
|
+
run: |
|
|
27
|
+
python -m pip install --upgrade pip setuptools wheel hatch
|
|
28
|
+
|
|
29
|
+
- name: Build wheel and sdist
|
|
30
|
+
run: hatch build
|
|
31
|
+
|
|
32
|
+
- name: Publish to PyPI
|
|
33
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
34
|
+
with:
|
|
35
|
+
packages-dir: dist/
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: Run Pytest and Codecov with Hatch
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
test:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
|
|
13
|
+
- name: Build Docker image
|
|
14
|
+
run: docker build --target hatch -t shell:hatch .
|
|
15
|
+
|
|
16
|
+
- name: Run pytest and generate coverage report
|
|
17
|
+
run: docker run --rm -e HATCH_ENV=test -v "${{ github.workspace }}:/app" shell:hatch cov
|
|
18
|
+
|
|
19
|
+
- name: Upload coverage artifact
|
|
20
|
+
uses: actions/upload-artifact@v4
|
|
21
|
+
with:
|
|
22
|
+
name: coverage-xml
|
|
23
|
+
path: ${{ github.workspace }}/coverage.xml
|
|
24
|
+
|
|
25
|
+
- name: Upload coverage report to Codecov
|
|
26
|
+
if: ${{ secrets.CODECOV_TOKEN != '' }}
|
|
27
|
+
uses: codecov/codecov-action@v4
|
|
28
|
+
with:
|
|
29
|
+
fail_ci_if_error: true
|
|
30
|
+
files: ${{ github.workspace }}/coverage.xml
|
|
31
|
+
env:
|
|
32
|
+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
33
|
+
|
|
34
|
+
- name: Skip Codecov upload (no token)
|
|
35
|
+
if: ${{ secrets.CODECOV_TOKEN == '' }}
|
|
36
|
+
run: echo "Skipping Codecov — CODECOV_TOKEN not set."
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# Distribution / packaging
|
|
7
|
+
dist/
|
|
8
|
+
build/
|
|
9
|
+
*.egg-info/
|
|
10
|
+
*.egg
|
|
11
|
+
*.whl
|
|
12
|
+
sdist/
|
|
13
|
+
|
|
14
|
+
# Virtual environments
|
|
15
|
+
.venv/
|
|
16
|
+
venv/
|
|
17
|
+
ENV/
|
|
18
|
+
env/
|
|
19
|
+
|
|
20
|
+
# Hatch
|
|
21
|
+
.hatch/
|
|
22
|
+
|
|
23
|
+
# IDE / Editor
|
|
24
|
+
.vscode/
|
|
25
|
+
.idea/
|
|
26
|
+
*.swp
|
|
27
|
+
*.swo
|
|
28
|
+
*~
|
|
29
|
+
.project
|
|
30
|
+
.settings/
|
|
31
|
+
|
|
32
|
+
# OS files
|
|
33
|
+
.DS_Store
|
|
34
|
+
Thumbs.db
|
|
35
|
+
|
|
36
|
+
# Testing / Coverage
|
|
37
|
+
htmlcov/
|
|
38
|
+
.coverage
|
|
39
|
+
.coverage.*
|
|
40
|
+
coverage.xml
|
|
41
|
+
*.cover
|
|
42
|
+
.pytest_cache/
|
|
43
|
+
.mypy_cache/
|
|
44
|
+
|
|
45
|
+
# Documentation builds
|
|
46
|
+
site/
|
|
47
|
+
|
|
48
|
+
# Jupyter Notebooks
|
|
49
|
+
.ipynb_checkpoints/
|
|
50
|
+
|
|
51
|
+
# Ruff
|
|
52
|
+
.ruff_cache/
|
|
53
|
+
|
|
54
|
+
# Environment variables
|
|
55
|
+
.env
|
|
56
|
+
.env.*
|
|
57
|
+
!.env.example
|
|
58
|
+
|
|
59
|
+
# Secrets — never commit these
|
|
60
|
+
*.pem
|
|
61
|
+
*.key
|
|
62
|
+
|
|
63
|
+
# Logs
|
|
64
|
+
*.log
|
|
65
|
+
|
|
66
|
+
# Type stubs
|
|
67
|
+
.pytype/
|
|
68
|
+
dmypy.json
|
|
69
|
+
|
|
70
|
+
# Pre-commit
|
|
71
|
+
.pre-commit-cache/
|
|
72
|
+
|
|
73
|
+
# Misc
|
|
74
|
+
*.bak
|
|
75
|
+
*.tmp
|
|
76
|
+
*.png
|
|
77
|
+
*.csv
|
|
78
|
+
*.json
|
|
79
|
+
|
|
80
|
+
# Data / model weights (too large for git)
|
|
81
|
+
*.pth
|
|
82
|
+
!src/shell/weights/*.pth
|
|
83
|
+
*.tiff
|
|
84
|
+
*.tif
|
|
85
|
+
data/
|
|
86
|
+
preprocessed/
|
|
87
|
+
evaluation_results/
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# See https://pre-commit.com for more information
|
|
2
|
+
# See https://pre-commit.com/hooks.html for more hooks
|
|
3
|
+
repos:
|
|
4
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
5
|
+
rev: v4.6.0
|
|
6
|
+
hooks:
|
|
7
|
+
- id: trailing-whitespace
|
|
8
|
+
- id: end-of-file-fixer
|
|
9
|
+
- id: check-yaml
|
|
10
|
+
- id: check-toml
|
|
11
|
+
- id: check-added-large-files
|
|
12
|
+
- id: check-merge-conflict
|
|
13
|
+
- id: debug-statements
|
|
14
|
+
|
|
15
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
16
|
+
rev: v0.4.8
|
|
17
|
+
hooks:
|
|
18
|
+
- id: ruff
|
|
19
|
+
args: [--fix]
|
|
20
|
+
- id: ruff-format
|
|
21
|
+
|
|
22
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
23
|
+
rev: v1.10.0
|
|
24
|
+
hooks:
|
|
25
|
+
- id: mypy
|
|
26
|
+
additional_dependencies: []
|
|
27
|
+
args: [--ignore-missing-imports]
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing! This document provides guidelines for working with this project.
|
|
4
|
+
|
|
5
|
+
## Development Setup
|
|
6
|
+
|
|
7
|
+
1. **Clone the repository:**
|
|
8
|
+
|
|
9
|
+
```console
|
|
10
|
+
git clone https://github.com/LavLabInfrastructure/shell.git
|
|
11
|
+
cd shell
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
2. **Install Hatch** (build & environment manager):
|
|
15
|
+
|
|
16
|
+
```console
|
|
17
|
+
pip install hatch
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
3. **Install pre-commit hooks:**
|
|
21
|
+
|
|
22
|
+
```console
|
|
23
|
+
pip install pre-commit
|
|
24
|
+
pre-commit install
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Common Tasks
|
|
28
|
+
|
|
29
|
+
| Task | Command |
|
|
30
|
+
|-------------------------|------------------------------|
|
|
31
|
+
| Run tests | `hatch run test:test` |
|
|
32
|
+
| Run tests with coverage | `hatch run test:cov` |
|
|
33
|
+
| Lint code | `hatch run lint:check` |
|
|
34
|
+
| Format code | `hatch run lint:format` |
|
|
35
|
+
| Auto-fix lint issues | `hatch run lint:fix` |
|
|
36
|
+
| Run all lint checks | `hatch run lint:all` |
|
|
37
|
+
| Type check | `hatch run types:check` |
|
|
38
|
+
| Build docs | `hatch run docs:build-docs` |
|
|
39
|
+
| Serve docs locally | `hatch run docs:serve-docs` |
|
|
40
|
+
| Build wheel | `hatch build` |
|
|
41
|
+
|
|
42
|
+
## Code Style
|
|
43
|
+
|
|
44
|
+
- **Formatter & Linter:** [Ruff](https://docs.astral.sh/ruff/) handles both formatting and linting.
|
|
45
|
+
- **Line length:** 88 characters.
|
|
46
|
+
- **Docstrings:** Sphinx-style (`:param:`, `:type:`, `:return:`, `:rtype:`).
|
|
47
|
+
- **Type hints:** Encouraged. The project includes a `py.typed` marker for PEP 561 compliance.
|
|
48
|
+
|
|
49
|
+
## Project Architecture
|
|
50
|
+
|
|
51
|
+
1. **Library modules** (`src/shell/`) contain all business logic as importable functions.
|
|
52
|
+
2. **CLI** (`src/shell/cli.py`) is a thin wrapper that delegates to library functions.
|
|
53
|
+
3. **Tests** (`tests/`) import directly from the library.
|
|
54
|
+
|
|
55
|
+
## Submitting Changes
|
|
56
|
+
|
|
57
|
+
1. Create a branch from `main`.
|
|
58
|
+
2. Make your changes and ensure all checks pass.
|
|
59
|
+
3. Open a Pull Request against `main`.
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
|
|
63
|
+
`shell` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
ARG PY_VERSION=3.12
|
|
2
|
+
|
|
3
|
+
FROM python:${PY_VERSION}-slim AS base
|
|
4
|
+
|
|
5
|
+
# create non-root user (primarily for devcontainer)
|
|
6
|
+
RUN groupadd --gid 1000 vscode \
|
|
7
|
+
&& useradd --uid 1000 --gid 1000 -m vscode
|
|
8
|
+
|
|
9
|
+
# System libraries required by openslide, pyvips, and macenko-pca (OpenBLAS)
|
|
10
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
11
|
+
libopenslide0 \
|
|
12
|
+
libvips42 \
|
|
13
|
+
libopenblas0 \
|
|
14
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
15
|
+
|
|
16
|
+
WORKDIR /app
|
|
17
|
+
|
|
18
|
+
# install dependencies first for better layer caching
|
|
19
|
+
COPY pyproject.toml README.md LICENSE.txt ./
|
|
20
|
+
COPY src/ src/
|
|
21
|
+
|
|
22
|
+
RUN chown -R vscode:vscode /app
|
|
23
|
+
|
|
24
|
+
FROM base AS hatch
|
|
25
|
+
RUN pip3 install --no-cache-dir hatch uv
|
|
26
|
+
ENV HATCH_ENV=default
|
|
27
|
+
ENTRYPOINT ["hatch", "run"]
|
|
28
|
+
|
|
29
|
+
FROM base AS dev
|
|
30
|
+
COPY requirements/ requirements/
|
|
31
|
+
COPY requirements.txt ./
|
|
32
|
+
COPY tests/ tests/
|
|
33
|
+
COPY docs/ docs/
|
|
34
|
+
COPY mkdocs.yml ./
|
|
35
|
+
RUN pip3 install --no-cache-dir hatch \
|
|
36
|
+
&& hatch build \
|
|
37
|
+
&& pip3 install --no-cache-dir $(find /app -name 'requirement*.txt' -exec echo -n '-r {} ' \;)
|
|
38
|
+
USER vscode
|
|
39
|
+
|
|
40
|
+
FROM base AS prod
|
|
41
|
+
COPY --from=dev /app/dist/*.whl /tmp/
|
|
42
|
+
RUN pip3 install --no-cache-dir /tmp/*.whl \
|
|
43
|
+
&& rm -rf /tmp/*.whl
|
|
44
|
+
USER vscode
|
|
45
|
+
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
|
|
46
|
+
CMD python -c "import shell" || exit 1
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-present barrettMCW
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
.DEFAULT_GOAL := help
|
|
2
|
+
|
|
3
|
+
.PHONY: help test cov lint format fix types docs serve-docs build clean install pre-commit
|
|
4
|
+
|
|
5
|
+
help: ## Show this help message
|
|
6
|
+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \
|
|
7
|
+
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
|
|
8
|
+
|
|
9
|
+
install: ## Install the package in development mode with hatch
|
|
10
|
+
pip install hatch
|
|
11
|
+
hatch env create
|
|
12
|
+
|
|
13
|
+
test: ## Run tests
|
|
14
|
+
hatch run test:test
|
|
15
|
+
|
|
16
|
+
cov: ## Run tests with coverage report
|
|
17
|
+
hatch run test:cov
|
|
18
|
+
|
|
19
|
+
lint: ## Run Ruff linter
|
|
20
|
+
hatch run lint:check
|
|
21
|
+
|
|
22
|
+
format: ## Format code with Ruff
|
|
23
|
+
hatch run lint:format
|
|
24
|
+
|
|
25
|
+
fix: ## Auto-fix lint issues and format
|
|
26
|
+
hatch run lint:all
|
|
27
|
+
|
|
28
|
+
types: ## Run mypy type checking
|
|
29
|
+
hatch run types:check
|
|
30
|
+
|
|
31
|
+
docs: ## Build documentation
|
|
32
|
+
hatch run docs:build-docs
|
|
33
|
+
|
|
34
|
+
serve-docs: ## Serve documentation locally
|
|
35
|
+
hatch run docs:serve-docs
|
|
36
|
+
|
|
37
|
+
build: ## Build wheel and sdist
|
|
38
|
+
hatch build
|
|
39
|
+
|
|
40
|
+
clean: ## Remove build artifacts and caches
|
|
41
|
+
rm -rf dist/ build/ site/ htmlcov/
|
|
42
|
+
rm -f coverage.xml .coverage
|
|
43
|
+
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
|
|
44
|
+
find . -type d -name .pytest_cache -exec rm -rf {} + 2>/dev/null || true
|
|
45
|
+
find . -type d -name .mypy_cache -exec rm -rf {} + 2>/dev/null || true
|
|
46
|
+
find . -type d -name .ruff_cache -exec rm -rf {} + 2>/dev/null || true
|
|
47
|
+
find . -type d -name '*.egg-info' -exec rm -rf {} + 2>/dev/null || true
|
|
48
|
+
|
|
49
|
+
pre-commit: ## Install and run pre-commit hooks
|
|
50
|
+
pre-commit install
|
|
51
|
+
pre-commit run --all-files
|
|
52
|
+
|
|
53
|
+
docker-dev: ## Build and run dev Docker image
|
|
54
|
+
docker build --target dev -t shell:dev .
|
|
55
|
+
|
|
56
|
+
docker-prod: ## Build production Docker image
|
|
57
|
+
docker build --target prod -t shell:prod .
|