From 629bb53f0898459769e98612621378be368eeaba Mon Sep 17 00:00:00 2001 From: timothyckl Date: Tue, 3 Mar 2026 00:47:57 +0800 Subject: [PATCH 1/3] Add CI workflow to run pytest on push and pull request to main Runs on ubuntu-latest with a Python 3.9/3.10/3.11 matrix, installs the package and dev extras, then executes pytest tests/. --- .github/workflows/tests.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..2e7b334 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,30 @@ +name: Tests + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11"] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install package and dev dependencies + run: pip install -e ".[dev]" + + - name: Run tests + run: pytest tests/ From b2d2256db41fd5c6c54281d5b23b399e51401765 Mon Sep 17 00:00:00 2001 From: timothyckl Date: Tue, 3 Mar 2026 00:47:33 +0800 Subject: [PATCH 2/3] Fix packaging metadata and update README constructor call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Set license="MIT" to match the OSI classifier already declared - Relax numpy pin from ==1.23.5 to >=1.23.5 to avoid unnecessary version lock - Fix typo extra_require → extras_require (setuptools ignores the misspelled key) - Fix typo python_require → python_requires (setuptools ignores the misspelled key) - Update README usage example constructor argument to dist_func= keyword --- README.md | 2 +- setup.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4eef55c..7a70e7d 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ X = np.random.rand(1000, 128) y = np.random.randint(0, 10, (1000,)) n_splits = 3 -s = SimilarityStratifiedSplit(n_splits, get_distances) +s = SimilarityStratifiedSplit(n_splits, dist_func=get_distances) for train_index, test_index in s.split(X, y): print(f"Train indices: {train_index}\nTest indices: {test_index}") diff --git a/setup.py b/setup.py index dfd6ce7..3ea4421 100644 --- a/setup.py +++ b/setup.py @@ -14,15 +14,15 @@ url="https://github.com/timothyckl/similarity-stratified-split", author="timothyckl", author_email="timothy.ckl@outlook.com", - license="", + license="MIT", classifiers=[ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.9", "Operating System :: OS Independent" ], - install_requires=["numpy==1.23.5"], - extra_require={ + install_requires=["numpy>=1.23.5"], + extras_require={ "dev": ["pytest==7.4.3"] }, - python_require=">=3.9" + python_requires=">=3.9" ) From bbd4d84d85ebd84356ae25c980c4f75b123b00dc Mon Sep 17 00:00:00 2001 From: timothyckl Date: Tue, 3 Mar 2026 00:59:58 +0800 Subject: [PATCH 3/3] Add scipy to dev extras so CI can import scipy.spatial.distance --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 3ea4421..ccd40c5 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ ], install_requires=["numpy>=1.23.5"], extras_require={ - "dev": ["pytest==7.4.3"] + "dev": ["pytest==7.4.3", "scipy"] }, python_requires=">=3.9" )