Skip to content

Commit

Permalink
Check build (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
flying-sheep authored Mar 15, 2024
1 parent dd21b4f commit c22140f
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 27 deletions.
40 changes: 28 additions & 12 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Run tests

on: [push, workflow_dispatch]
on:
push:
branches: [main]
pull_request:
workflow_dispatch:

jobs:
test:
Expand All @@ -9,12 +13,15 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
filter: blob:none
fetch-depth: 0

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"
cache: pip

- name: Install project and dependencies
Expand All @@ -23,14 +30,23 @@ jobs:
- name: Run test suite
run: pytest -v --color=yes

check: # TODO: replace with pre-commit.ci
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
with:
python-version: "3.10"
cache: pip
- uses: pre-commit/[email protected]
env:
SKIP: no-commit-to-branch # only for local development
filter: blob:none
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: "3.12"
# cache: pip # TODO: cache tools

- name: Install tools
run: pip install twine build

- name: Build and check
run: |
python -m build
twine check dist/*.whl
11 changes: 4 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,13 @@ repos:
- id: detect-private-key
- id: no-commit-to-branch
args: ["--branch=main"]
- repo: https://github.com/psf/black
rev: "23.12.0"
hooks:
- id: black
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.1.7
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.2
hooks:
- id: ruff
args: ["--fix"]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.4
rev: v4.0.0-alpha.8
hooks:
- id: prettier
5 changes: 4 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
.. -*- mode: rst -*-
|ReadTheDocs|_
|PyPI|_ |ReadTheDocs|_

.. |PyPI| image:: https://img.shields.io/pypi/v/sklearn-ann
.. _PyPI: https://pypi.org/project/sklearn-ann/

.. |ReadTheDocs| image:: https://readthedocs.org/projects/sklearn-ann/badge/?version=latest
.. _ReadTheDocs: https://sklearn-ann.readthedocs.io/en/latest/?badge=latest
Expand Down
1 change: 0 additions & 1 deletion examples/rnn_dbscan_big.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
Tests RnnDBSCAN on a large dataset. Requires pandas.
"""
print(__doc__)

import numpy as np
from joblib import Memory
Expand Down
1 change: 0 additions & 1 deletion examples/rnn_dbscan_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
Mostly copypasted from sklearn's DBSCAN example.
"""
print(__doc__)

import numpy as np
from sklearn import metrics
Expand Down
8 changes: 3 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ addopts = [
# this will notify us when a test considered broken starts succeeding.
xfail_strict = true

[tool.ruff]
# TODO: remove `target-version` when switching to PEP 621
target-version = "py39"
[tool.ruff.lint]
select = [
"F", # Pyflakes
"E", # Pycodestyle errors
Expand All @@ -72,9 +70,9 @@ ignore = [
# Don’t complain about “confusables”
"RUF001", "RUF002", "RUF003"
]
[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"examples/*.py" = ["E402"]
[tool.ruff.isort]
[tool.ruff.lint.isort]
known-first-party = ["sklearn_ann"]

[tool.hatch.envs.default]
Expand Down

0 comments on commit c22140f

Please sign in to comment.