Skip to content

Commit ad497b6

Browse files
committed
refactoring and updating packaging
1 parent c6f4885 commit ad497b6

File tree

7 files changed

+604
-51
lines changed

7 files changed

+604
-51
lines changed

.github/workflows/docs.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,31 @@ jobs:
2424
url: ${{ steps.deployment.outputs.page_url }}
2525
steps:
2626
- name: Checkout
27-
uses: actions/checkout@v4
27+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
2828

29-
- name: Install Python
30-
uses: actions/setup-python@v5
31-
with:
32-
python-version: 3.9
29+
30+
- name: Install uv
31+
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
32+
33+
- name: Set up Python
34+
run: uv python install
3335

3436
- name: Install dependencies
35-
run: pip install .[dev]
37+
run: uv sync --extra dev
3638

3739
- name: Build docs
3840
run: |
3941
cd docs
40-
make html
42+
uv run make html
4143
4244
- name: Setup Pages
43-
uses: actions/configure-pages@v5
45+
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
4446

4547
- name: Upload artifact
46-
uses: actions/upload-pages-artifact@v3
48+
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0
4749
with:
4850
path: 'docs/build/html'
4951

5052
- name: Deploy to GitHub Pages
5153
id: deployment
52-
uses: actions/deploy-pages@v4
53-
54+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5

.github/workflows/main.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,19 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@v3
14+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
1515

16-
- name: Install Pytest
17-
run: pip install pytest
16+
- name: Install uv
17+
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
18+
19+
- name: Set up Python
20+
run: uv python install
21+
22+
- name: Install dependencies
23+
run: uv sync --extra dev
1824

1925
- name: Run Tests
20-
run: pytest tests
26+
run: uv run pytest tests
2127
env:
2228
PREDICTIONGUARD_API_KEY: ${{ secrets.PREDICTIONGUARD_API_KEY }}
2329
PREDICTIONGUARD_URL: ${{ vars.PREDICTIONGUARD_URL }}
@@ -27,8 +33,11 @@ jobs:
2733
TEST_VISION_MODEL: ${{ vars.TEST_VISION_MODEL }}
2834
TEST_RERANK_MODEL: ${{ vars.TEST_RERANK_MODEL }}
2935

30-
- name: To PyPI using Flit
31-
uses: AsifArmanRahman/to-pypi-using-flit@v1
32-
with:
33-
password: ${{ secrets.TESTPYPI_API_TOKEN }}
34-
repository-url: https://test.pypi.org/legacy/
36+
- name: Build package
37+
run: uv build
38+
39+
- name: Publish to TestPyPI
40+
env:
41+
UV_PUBLISH_TOKEN: ${{ secrets.TESTPYPI_API_TOKEN }}
42+
UV_PUBLISH_URL: https://test.pypi.org/legacy/
43+
run: uv publish

.github/workflows/pr.yml

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,32 @@ on:
66
- main
77

88
jobs:
9-
109
tests:
1110
name: Installing requirements and testing functions
1211
runs-on: ubuntu-latest
1312
steps:
14-
- name: Checkout
15-
uses: actions/checkout@v2
13+
- name: Checkout
14+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
15+
16+
- name: Install uv
17+
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
18+
19+
- name: Set up Python
20+
run: uv python install
1621

17-
- name: Install Dependencies
18-
run: pip install pytest ruff
22+
- name: Install dependencies
23+
run: uv sync --extra dev
1924

20-
- name: Run Ruff
21-
run: ruff check --ignore F401 --output-format=github .
25+
- name: Run Ruff
26+
run: uv run ruff check --ignore F401 --output-format=github .
2227

23-
- name: Run Tests
24-
run: pytest tests
25-
env:
26-
PREDICTIONGUARD_API_KEY: ${{ secrets.PREDICTIONGUARD_API_KEY}}
27-
PREDICTIONGUARD_URL: ${{ vars.PREDICTIONGUARD_URL}}
28-
TEST_CHAT_MODEL: ${{ vars.TEST_CHAT_MODEL }}
29-
TEST_TEXT_EMBEDDINGS_MODEL: ${{ vars.TEST_TEXT_EMBEDDINGS_MODEL }}
30-
TEST_MULTIMODAL_EMBEDDINGS_MODEL: ${{ vars.TEST_MULTIMODAL_EMBEDDINGS_MODEL }}
31-
TEST_VISION_MODEL: ${{ vars.TEST_VISION_MODEL }}
32-
TEST_RERANK_MODEL: ${{ vars.TEST_RERANK_MODEL }}
28+
- name: Run Tests
29+
run: uv run pytest tests
30+
env:
31+
PREDICTIONGUARD_API_KEY: ${{ secrets.PREDICTIONGUARD_API_KEY }}
32+
PREDICTIONGUARD_URL: ${{ vars.PREDICTIONGUARD_URL }}
33+
TEST_CHAT_MODEL: ${{ vars.TEST_CHAT_MODEL }}
34+
TEST_TEXT_EMBEDDINGS_MODEL: ${{ vars.TEST_TEXT_EMBEDDINGS_MODEL }}
35+
TEST_MULTIMODAL_EMBEDDINGS_MODEL: ${{ vars.TEST_MULTIMODAL_EMBEDDINGS_MODEL }}
36+
TEST_VISION_MODEL: ${{ vars.TEST_VISION_MODEL }}
37+
TEST_RERANK_MODEL: ${{ vars.TEST_RERANK_MODEL }}

.github/workflows/pypi-release.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,18 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@v3
14+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
1515

16-
- name: Publish to PyPI using Flit
17-
uses: AsifArmanRahman/to-pypi-using-flit@v1
18-
with:
19-
password: ${{ secrets.PYPI_API_TOKEN }}
16+
- name: Install uv
17+
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
18+
19+
- name: Set up Python
20+
run: uv python install
21+
22+
- name: Build package
23+
run: uv build
24+
25+
- name: Publish to PyPI
26+
env:
27+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
28+
run: uv publish

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,3 @@ venv.bak/
107107

108108
# JetBrains Folder
109109
.idea
110-
111-
# uv package management
112-
uv.lock

pyproject.toml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
[build-system]
2-
requires = ["flit_core >=3.2,<4"]
3-
build-backend = "flit_core.buildapi"
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
44

55
[project]
66
name = "predictionguard"
77
authors = [
8-
{name = "Daniel Whitenack", email = "dan@predictionguard.com"},
9-
{name = "Jacob Mansdorfer", email = "jacob@predictionguard.com"}
8+
{name = "Jacob Mansdorfer", email = "jacob@predictionguard.com"},
9+
{name = "Daniel Whitenack", email = "dan@predictionguard.com"}
1010
]
1111
readme = "README.md"
12+
requires-python = ">=3.12.8"
1213
license = {file = "LICENSE"}
1314
classifiers = ["License :: OSI Approved :: MIT License"]
1415
dynamic = ["version", "description"]
1516
description-file = "README.md"
1617
dependencies = [
17-
"tabulate>=0.8.10",
18-
"requests>=2.27.1",
18+
"tabulate>=0.9.0",
19+
"requests>=2.32.5",
1920
]
2021

2122
[project.optional-dependencies]
2223
dev = [
24+
"pytest",
2325
"sphinx",
2426
"sphinx-autodoc-typehints",
2527
"sphinx_rtd_theme",
@@ -28,3 +30,6 @@ dev = [
2830

2931
[project.urls]
3032
Home = "https://predictionguard.com"
33+
34+
[tool.hatch.version]
35+
path = "predictionguard/version.py"

0 commit comments

Comments
 (0)