Skip to content

Commit 987d4e4

Browse files
committed
chore: change to use uv and pyproject.toml to manage dependencies and environment
1 parent 417031d commit 987d4e4

File tree

10 files changed

+914
-105
lines changed

10 files changed

+914
-105
lines changed

.github/workflows/coverage.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ jobs:
1313
- name: Checkout code
1414
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1515

16-
- name: Set up Python
17-
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
16+
- name: Install uv (faster alternative to pip)
17+
uses: astral-sh/setup-uv@v5
1818
with:
19+
version: "0.4.4"
1920
python-version: "3.10"
20-
cache: 'pip'
21+
enable-cache: true
2122

2223
- name: Install dependencies
2324
run: |
24-
pip install -r src/requirements.txt
25-
pip install coveralls
26-
pip install pytest
27-
25+
uv pip install coveralls pytest
26+
uv pip install -r pyproject.toml
27+
2828
- name: Generate Coverage Report
2929
env:
3030
PYTHONPATH: ./src

.github/workflows/deploy_sphinx.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@ jobs:
1212

1313
permissions:
1414
contents: write
15-
15+
1616
steps:
1717
- name: Checkout code
1818
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1919

20-
- name: Set up Python
21-
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
20+
- name: Install uv (faster alternative to pip)
21+
uses: astral-sh/setup-uv@v5
2222
with:
23-
python-version: '3.10'
24-
cache: 'pip'
23+
version: "0.4.4"
24+
python-version: "3.10"
25+
enable-cache: true
2526

2627
- name: Install dependencies
2728
run: |
28-
pip install -r src/requirements.txt
29-
pip install -r docs/requirements.txt
29+
uv pip install -r pyproject.toml --extra docs
3030
3131
- name: Generate rst files
3232
run: sphinx-apidoc -o docs/source src/mastermind -f --templatedir=docs/source/_templates --maxdepth=2 --module-first

.github/workflows/release_pypi.yaml

Lines changed: 13 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -15,54 +15,25 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1717

18-
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
18+
- name: Install uv (faster alternative to pip)
19+
uses: astral-sh/setup-uv@v5
1920
with:
21+
version: "0.4.4"
2022
python-version: "3.10"
23+
enable-cache: true
2124

2225
- name: Install dependencies
23-
run: |
24-
python -m pip install --upgrade pip pytest
25-
pip install -r src/requirements.txt
26+
run: uv pip install -r pyproject.toml
2627

27-
- name: Build release distributions
28-
run: |
29-
python -m pip install --upgrade pip pytest setuptools wheel
30-
python setup.py sdist bdist_wheel
28+
- name: Build release
29+
run: uv build
3130

32-
- name: Install and test the package
33-
run: |
34-
pip install dist/*.whl
35-
pytest tests
31+
- name: Test release (wheel)
32+
run: uv run --isolated --all-extras --with dist/*.whl pytest --doctest-modules src
3633

37-
- name: Upload distributions
38-
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
39-
with:
40-
name: release-dists
41-
path: dist/
42-
43-
pypi-publish:
44-
name: Publish release distributions to PyPI
45-
runs-on: ubuntu-latest
46-
47-
needs:
48-
- release-build
49-
50-
permissions:
51-
id-token: write
5234

53-
environment:
54-
name: pypi
55-
url: https://pypi.org/p/mastermind-ai
35+
- name: Test release (source distribution)
36+
run: uv run --isolated --all-extras --with dist/*.tar.gz pytest --doctest-modules src
5637

57-
steps:
58-
- name: Retrieve release distributions
59-
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
60-
with:
61-
name: release-dists
62-
path: dist/
63-
64-
- name: Publish release distributions to PyPI
65-
uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc # release/v1
66-
with:
67-
verbose: true
68-
print-hash: true
38+
- name: Upload release
39+
run: uv publish --trusted-publishing always

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ __pycache__/
33
/coverage.xml
44
/data
55
/.env
6+
*egg-info/

.python-version

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

docs/requirements.txt

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

pyproject.toml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "mastermind-ai"
7+
version = "2.0.1-beta"
8+
requires-python = ">=3.10"
9+
authors = [{name = "FlysonBot"}]
10+
11+
# Descriptions
12+
description = "A Python package that simulates the Mastermind game with an AI solver."
13+
readme = "README.md"
14+
15+
# Tags
16+
keywords = ["mastermind", "game", "ai", "puzzle"]
17+
classifiers = [
18+
"Development Status :: 4 - Beta",
19+
"Environment :: Console",
20+
"Framework :: Pytest",
21+
"Framework :: Sphinx",
22+
"Intended Audience :: End Users/Desktop",
23+
"Intended Audience :: Education",
24+
"License :: OSI Approved :: MIT License",
25+
"Natural Language :: English",
26+
"Operating System :: OS Independent",
27+
"Programming Language :: Python :: 3.10",
28+
"Topic :: Games/Entertainment :: Puzzle Games",
29+
]
30+
31+
# Dependencies
32+
dependencies = [
33+
"shortuuid>=1.0.13",
34+
"appdirs>=1.4.4",
35+
"dataclasses-json>=0.6.7",
36+
"clear-screen>=0.1.14",
37+
"pandas>=2.2.2",
38+
]
39+
40+
[project.urls]
41+
Homepage = "https://github.com/FlysonBot/Mastermind"
42+
Documentation = "https://flysonbot.github.io/Mastermind/"
43+
Repository = "https://github.com/FlysonBot/Mastermind"
44+
Issues = "https://github.com/FlysonBot/Mastermind/issues"
45+
Changelog = "https://github.com/FlysonBot/Mastermind/blob/main/CHANGELOG.md"
46+
47+
[project.optional-dependencies]
48+
dev = [
49+
"types-appdirs",
50+
"types-dataclasses-json",
51+
"pandas-stubs",
52+
]
53+
test = [
54+
"pytest",
55+
"pytest-cov",
56+
]
57+
docs = [
58+
"sphinx>=8.1.3",
59+
"sphinx-nefertiti>=0.5.2",
60+
]
61+
62+
[tool.setuptools]
63+
packages = ["mastermind"]
64+
package-dir = { "" = "src" }
65+
66+
[project.scripts]
67+
mastermind = "mastermind.client.display.tui.main:main"

setup.py

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

src/requirements.txt

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

0 commit comments

Comments
 (0)