-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
format, linter and associated workflow --------- Co-authored-by: Amogh Joshi <[email protected]>
- Loading branch information
1 parent
ddeca32
commit f0fb6ae
Showing
128 changed files
with
12,189 additions
and
9,386 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: ci | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
test: | ||
name: Test - ${{ matrix.python-version }} - ${{matrix.os}} | ||
runs-on: ${{matrix.os}} | ||
|
||
strategy: | ||
matrix: | ||
python-version: ["3.11", "3.12"] | ||
os: [ubuntu-latest, macOs-latest] | ||
fail-fast: false | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install the latest version of uv | ||
uses: astral-sh/setup-uv@v3 | ||
with: | ||
version: "latest" | ||
enable-cache: true | ||
cache-dependency-glob: "**/pyproject.toml" | ||
|
||
- name: Check if cache used | ||
if: steps.setup-uv.outputs.cache-hit == 'true' | ||
run: echo "Cache was restored" | ||
|
||
- name: Set up python env | ||
run: | | ||
uv venv --python ${{ matrix.python-version }} | ||
uv sync --dev | ||
- name: Run pre-commit | ||
continue-on-error: true | ||
run: make pre-commit | ||
|
||
- name: Run tests | ||
# For example, using `pytest` | ||
run: make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
|
||
SHELL := bash | ||
|
||
version := 0.7.0 | ||
|
||
src.python := $(shell find ./agml -type f -name "*.py" || :) | ||
test.python := $(shell find ./tests -type f -name "*.py" || :) | ||
|
||
uv.project.enviroment := .venv | ||
dist.dir := dist | ||
build.wheel := $(dist.dir)/agml-$(version).tar.gz | ||
|
||
|
||
|
||
|
||
|
||
.PHONY: help | ||
help: ## Print the help screen. | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":|:[[:space:]].*?##"}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
# Setup and Build | ||
|
||
|
||
install: setup ## Installing dependencies | ||
uv sync | ||
|
||
setup: ## Setup the project. | ||
uv venv $(uv.project.enviroment) | ||
|
||
|
||
$(build.wheel): $(src.python) ## Build wheels | ||
uv build -o $(dist.dir) | ||
|
||
build: $(build.wheel) ## Build the distribution wheel. | ||
|
||
test: $(test.python) $(src.python) ## Run tests | ||
uv run pytest -c=config/pytest.ini $(test.python) | ||
|
||
|
||
# Quality Checks | ||
|
||
.PHONY: pre-commit | ||
pre-commit: check-format lint check-types docstring-coverage | ||
|
||
|
||
.PHONY: check-types | ||
check-types: ## Run mypy to check type definitions. | ||
uv run mypy --config=config/mypy.ini $(src.python) $(test.python) | ||
|
||
|
||
.PHONY: check-format | ||
check-format: ## Check ruff format | ||
uv run ruff format --check --config=config/ruff.toml $(src.python) $(test.python) | ||
|
||
|
||
.PHONY: lint | ||
lint: ## Run ruff Code Linter | ||
uv run ruff check --config=config/ruff.toml $(src.python) $(test.python) | ||
|
||
.PHONY:docstring-coverage | ||
docstring-coverage: ## Compute docstring coverage | ||
uv run interrogate -c config/interrogate.toml . | ||
|
||
# Automated Quality fixes | ||
|
||
.PHONY: lint-fix | ||
lint-fix: ## Fix ruff Lint issues | ||
uv run ruff check --fix --config=config/ruff.toml $(src.python) $(test.python) | ||
|
||
|
||
.PHONY: format | ||
format: ## Run ruff format (Includes sorting of imports) | ||
uv run ruff check --select I --config=config/ruff.toml --fix | ||
uv run ruff format --config=config/ruff.toml $(src.python) $(test.python) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.