Skip to content

Commit

Permalink
Testing for Math Toolkit (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdreyer authored Dec 19, 2024
1 parent 70faf7a commit 1512d06
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 2 deletions.
21 changes: 21 additions & 0 deletions toolkits/math/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024, Arcade AI

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
53 changes: 53 additions & 0 deletions toolkits/math/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
.PHONY: help

help:
@echo "πŸ› οΈ math Commands:\n"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

.PHONY: install
install: ## Install the poetry environment and install the pre-commit hooks
@echo "πŸ“¦ Checking if Poetry is installed"
@if ! command -v poetry &> /dev/null; then \
echo "πŸ“¦ Installing Poetry with pip"; \
pip install poetry; \
else \
echo "πŸ“¦ Poetry is already installed"; \
fi
@echo "πŸš€ Installing package in development mode with all extras"
poetry install --all-extras

.PHONY: build
build: clean-build ## Build wheel file using poetry
@echo "πŸš€ Creating wheel file"
poetry build

.PHONY: clean-build
clean-build: ## clean build artifacts
@echo "πŸ—‘οΈ Cleaning dist directory"
rm -rf dist

.PHONY: test
test: ## Test the code with pytest
@echo "πŸš€ Testing code: Running pytest"
@poetry run pytest -W ignore -v --cov --cov-config=pyproject.toml --cov-report=xml

.PHONY: coverage
coverage: ## Generate coverage report
@echo "coverage report"
coverage report
@echo "Generating coverage report"
coverage html

.PHONY: bump-version
bump-version: ## Bump the version in the pyproject.toml file
@echo "πŸš€ Bumping version in pyproject.toml"
poetry version patch

.PHONY: check
check: ## Run code quality tools.
@echo "πŸš€ Checking Poetry lock file consistency with 'pyproject.toml': Running poetry check --lock"
@poetry check --lock
@echo "πŸš€ Linting code: Running pre-commit"
@poetry run pre-commit run -a
@echo "πŸš€ Static type checking: Running mypy"
@poetry run mypy --config-file=pyproject.toml
28 changes: 26 additions & 2 deletions toolkits/math/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,41 @@
[tool.poetry]
name = "arcade_math"
version = "0.0.13"
version = "0.1.7"
description = "Math toolkit for Arcade"
authors = ["Arcade AI <[email protected]>"]


[tool.poetry.dependencies]
python = "^3.10"
arcade-ai = "0.1.*"

[tool.poetry.dev-dependencies]
pytest = "^8.3.0"
pytest-cov = "^4.0.0"
pytest-asyncio = "^0.24.0"
pytest-mock = "^3.11.1"
mypy = "^1.5.1"
pre-commit = "^3.4.0"
tox = "^4.11.1"
ruff = "^0.7.4"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.mypy]
files = ["arcade_math/**/*.py"]
python_version = "3.10"
disallow_untyped_defs = "True"
disallow_any_unimported = "True"
no_implicit_optional = "True"
check_untyped_defs = "True"
warn_return_any = "True"
warn_unused_ignores = "True"
show_error_codes = "True"
ignore_missing_imports = "True"

[tool.pytest.ini_options]
testpaths = ["tests"]

[tool.coverage.report]
skip_empty = true

0 comments on commit 1512d06

Please sign in to comment.