Skip to content

Commit

Permalink
Merge pull request #6 from normal-computing/ruff
Browse files Browse the repository at this point in the history
Remove black and add CI
  • Loading branch information
SamDuffield authored Jan 22, 2024
2 parents 1e8217c + 407c78b commit 97f012f
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 6 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Tests

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

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/action@v3.0.0

tests:
name: Run tests for Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
needs:
- pre-commit
strategy:
matrix:
python-version: ['3.10']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dev environment
run: |
python -m pip install --upgrade pip
pip install .[test]
- name: Run the tests with pytest
run: |
python -m pytest
7 changes: 2 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
repos:
- repo: https://github.com/psf/black
rev: 23.11.0
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.4
hooks:
- id: ruff
args: ["--fix"]
args: ["--fix"]
- id: ruff-format
2 changes: 1 addition & 1 deletion examples/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def parse_devices(devices):
for device in devices:
try:
device = int(device)
except:
except ValueError:
pass
devices_list.append(device)
return devices_list
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ classifiers = [
]
dependencies = ["torch>=2.0.0", "torchopt>=0.7.3", "optree>=0.10.0"]

[project.optional-dependencies]
test = ["pre-commit", "pytest"]

[tool.setuptools]
packages = ["uqlib"]

Expand Down

0 comments on commit 97f012f

Please sign in to comment.