Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,17 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e .
pip install pytest pytest-cov black isort

- name: Check formatting with black
run: |
black --check anomaly_detection/ tests/
black --check .

- name: Check import sorting with isort
run: |
isort --check-only anomaly_detection/ tests/
isort --check-only .

- name: Run tests with coverage
run: |
pytest tests/ --cov=anomaly_detection --cov-report=xml -v

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
fail_ci_if_error: true
pytest tests/ --cov=anomaly_detection -v
27 changes: 27 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-merge-conflict
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-added-large-files

- repo: https://github.com/psf/black
rev: 24.1.1
hooks:
- id: black
language_version: python3.9

- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
args: ["--profile", "black"]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: no-commit-to-branch
args: [--branch, main]
21 changes: 12 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
.PHONY: install test lint format check-format check-imports clean
.PHONY: install test lint format check-format check-imports clean setup-pre-commit

install:
pip install -e .
pip install pytest pytest-cov black isort
pip install pytest pytest-cov black isort pre-commit

setup-pre-commit:
pre-commit install

test:
pytest tests/ --cov=anomaly_detection --cov-report=term-missing -v

lint:
black --check anomaly_detection/ tests/
isort --check-only anomaly_detection/ tests/
black --check .
isort --check-only .

format:
black anomaly_detection/ tests/
isort anomaly_detection/ tests/
black .
isort .

check-format:
black --check anomaly_detection/ tests/
black --check .

check-imports:
isort --check-only anomaly_detection/ tests/
isort --check-only .

clean:
find . -type d -name "__pycache__" -exec rm -r {} +
Expand All @@ -32,4 +35,4 @@ clean:
find . -type d -name ".pytest_cache" -exec rm -r {} +
find . -type d -name ".coverage" -exec rm -r {} +
find . -type d -name "htmlcov" -exec rm -r {} +
find . -type f -name "coverage.xml" -delete
find . -type f -name "coverage.xml" -delete
17 changes: 9 additions & 8 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
numpy>=1.21.0
pandas>=1.3.0
scikit-learn>=0.24.2
black>=21.7b0
boto3>=1.26.0
fastapi>=0.68.0
uvicorn>=0.15.0
flake8>=3.9.2
httpx>=0.24.0
isort>=5.9.3
numpy>=1.21.0
pandas>=1.3.0
pre-commit>=3.6.0
python-dotenv>=0.19.0
pytest>=6.2.5
pytest-cov>=2.12.1
black>=21.7b0
isort>=5.9.3
flake8>=3.9.2
httpx>=0.24.0
scikit-learn>=0.24.2
uvicorn>=0.15.0
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from setuptools import setup, find_packages
from setuptools import find_packages, setup

setup(
name="anomaly_detection",
Expand All @@ -16,4 +16,4 @@
"pytest-cov>=2.12.0",
],
python_requires=">=3.8",
)
)