Skip to content

Commit 1bfac35

Browse files
committed
PROJ-123 Add PyPI release pipeline for direct pip installation
1 parent f1c64a5 commit 1bfac35

4 files changed

Lines changed: 191 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: ci-${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
test-and-build:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
python-version: ["3.10", "3.11"]
22+
23+
steps:
24+
- name: Check out source
25+
uses: actions/checkout@v4
26+
27+
- name: Set up Python
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
cache: pip
32+
cache-dependency-path: |
33+
requirements.txt
34+
pyproject.toml
35+
36+
- name: Upgrade packaging tools
37+
run: python -m pip install --upgrade pip setuptools wheel
38+
39+
- name: Install dependencies
40+
run: pip install -r requirements.txt
41+
42+
- name: Install test/build tools
43+
run: pip install pytest build twine
44+
45+
- name: Run tests
46+
run: pytest tests/ -q
47+
48+
- name: Build package
49+
run: python -m build
50+
51+
- name: Validate package metadata
52+
run: twine check dist/*

.github/workflows/publish-pypi.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Publish Python Package to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Check out source
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.11"
22+
cache: pip
23+
cache-dependency-path: pyproject.toml
24+
25+
- name: Install build tooling
26+
run: python -m pip install --upgrade pip build twine
27+
28+
- name: Build distribution artifacts
29+
run: python -m build
30+
31+
- name: Validate package metadata
32+
run: twine check dist/*
33+
34+
- name: Upload artifacts
35+
uses: actions/upload-artifact@v4
36+
with:
37+
name: python-package-distributions
38+
path: dist/
39+
40+
publish:
41+
name: Publish to PyPI
42+
needs: build
43+
runs-on: ubuntu-latest
44+
environment:
45+
name: pypi
46+
url: https://pypi.org/p/graffiti-detection-ai-model
47+
permissions:
48+
id-token: write
49+
50+
steps:
51+
- name: Download distribution artifacts
52+
uses: actions/download-artifact@v4
53+
with:
54+
name: python-package-distributions
55+
path: dist/
56+
57+
- name: Publish to PyPI (trusted publishing)
58+
uses: pypa/gh-action-pypi-publish@release/v1

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,18 @@ source venv/bin/activate # Windows: venv\Scripts\activate
4141
pip install -r requirements.txt
4242
```
4343

44+
Install directly from pip (after the first PyPI release):
45+
46+
```bash
47+
pip install graffiti-detection-ai-model
48+
```
49+
50+
Quick import example:
51+
52+
```python
53+
from src.evaluation.metrics import calculate_iou
54+
```
55+
4456
## Quick Start
4557

4658
### 1. Prepare dataset

pyproject.toml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
[build-system]
2+
requires = ["setuptools>=69.0", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "graffiti-detection-ai-model"
7+
version = "0.1.0"
8+
description = "YOLOv8-based graffiti detection library with training, inference, surveillance, and API utilities."
9+
readme = "README.md"
10+
requires-python = ">=3.8"
11+
license = "MIT"
12+
license-files = ["LICENSE.md"]
13+
authors = [
14+
{ name = "Pierre-Henry Soria" }
15+
]
16+
keywords = ["computer-vision", "graffiti", "yolo", "object-detection", "surveillance", "fastapi"]
17+
classifiers = [
18+
"Development Status :: 3 - Alpha",
19+
"Intended Audience :: Developers",
20+
"Intended Audience :: Science/Research",
21+
"Operating System :: OS Independent",
22+
"Programming Language :: Python :: 3",
23+
"Programming Language :: Python :: 3 :: Only",
24+
"Programming Language :: Python :: 3.8",
25+
"Programming Language :: Python :: 3.9",
26+
"Programming Language :: Python :: 3.10",
27+
"Programming Language :: Python :: 3.11",
28+
"Programming Language :: Python :: 3.12",
29+
"Topic :: Scientific/Engineering :: Image Recognition"
30+
]
31+
dependencies = [
32+
"torch>=2.0.0",
33+
"torchvision>=0.15.0",
34+
"ultralytics>=8.0.0",
35+
"opencv-python>=4.8.0",
36+
"opencv-contrib-python>=4.8.0",
37+
"Pillow>=10.0.0",
38+
"numpy>=1.24.0",
39+
"pandas>=2.0.0",
40+
"albumentations>=1.3.0",
41+
"matplotlib>=3.7.0",
42+
"seaborn>=0.12.0",
43+
"tqdm>=4.65.0",
44+
"PyYAML>=6.0",
45+
"tensorboard>=2.13.0",
46+
"scikit-learn>=1.3.0",
47+
"scipy>=1.11.0",
48+
"imageio>=2.31.0",
49+
"pycocotools>=2.0.6",
50+
"fastapi>=0.104.0",
51+
"uvicorn>=0.24.0",
52+
"python-multipart>=0.0.6",
53+
"requests>=2.31.0",
54+
"twilio>=8.10.0",
55+
"python-dotenv>=1.0.0"
56+
]
57+
58+
[project.urls]
59+
Homepage = "https://github.com/pH-7/graffiti-detection-ai-model"
60+
Repository = "https://github.com/pH-7/graffiti-detection-ai-model"
61+
Issues = "https://github.com/pH-7/graffiti-detection-ai-model/issues"
62+
63+
[tool.setuptools]
64+
include-package-data = true
65+
66+
[tool.setuptools.packages.find]
67+
where = ["."]
68+
include = ["src*"]
69+
exclude = ["tests*", "notebooks*", "deployment*"]

0 commit comments

Comments
 (0)