Skip to content

Commit 6b38593

Browse files
committed
chore(release): v0.1.0
1 parent 4e307e1 commit 6b38593

24 files changed

+1339
-109
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,4 @@ cython_debug/
163163

164164
# vscode
165165
.vscode
166+
.direnv

Makefile

Lines changed: 76 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,114 @@
1-
SHELL := /bin/bash
2-
# =============================================================================
3-
# Variables
4-
# =============================================================================
5-
61
.DEFAULT_GOAL:=help
72
.ONESHELL:
8-
USING_PDM = $(shell grep "tool.pdm" pyproject.toml && echo "yes")
9-
ENV_PREFIX = $(shell python3 -c "if __import__('pathlib').Path('.venv/bin/pip').exists(): print('.venv/bin/')")
10-
VENV_EXISTS = $(shell python3 -c "if __import__('pathlib').Path('.venv/bin/activate').exists(): print('yes')")
11-
PDM_OPTS ?=
12-
PDM ?= pdm $(PDM_OPTS)
3+
ENV_PREFIX =.venv/bin/
4+
VENV_EXISTS = $(shell python3 -c "if __import__('pathlib').Path('.venv/bin/activate').exists(): print('yes')")
5+
BUILD_DIR =dist
6+
SRC_DIR =src
7+
BASE_DIR =$(shell pwd)
138

149
.EXPORT_ALL_VARIABLES:
1510

11+
ifndef VERBOSE
12+
.SILENT:
13+
endif
14+
1615

17-
.PHONY: help
18-
help: ## Display this help text for Makefile
16+
help: ## Display this help
1917
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
2018

21-
.PHONY: upgrade
22-
upgrade: ## Upgrade all dependencies to the latest stable versions
23-
@echo "=> Updating all dependencies"
24-
@if [ "$(USING_PDM)" ]; then $(PDM) update; fi
25-
@echo "=> Dependencies Updated"
26-
@$(ENV_PREFIX)pre-commit autoupdate
27-
@echo "=> Updated Pre-commit"
2819

2920
# =============================================================================
3021
# Developer Utils
3122
# =============================================================================
32-
.PHONY: install-pdm
33-
install-pdm: ## Install latest version of PDM
34-
@curl -sSLO https://pdm.fming.dev/install-pdm.py && \
35-
curl -sSL https://pdm.fming.dev/install-pdm.py.sha256 | shasum -a 256 -c - && \
36-
python3 install-pdm.py
37-
38-
install: ## Install the project and
39-
@if ! $(PDM) --version > /dev/null; then echo '=> Installing PDM'; $(MAKE) install-pdm; fi
40-
@if [ "$(VENV_EXISTS)" ]; then echo "=> Removing existing virtual environment"; fi
41-
if [ "$(VENV_EXISTS)" ]; then $(MAKE) destroy; fi
42-
if [ "$(VENV_EXISTS)" ]; then $(MAKE) clean; fi
43-
@if [ "$(USING_PDM)" ]; then $(PDM) config venv.in_project true && python3 -m venv --copies .venv && . $(ENV_PREFIX)/activate && $(ENV_PREFIX)/pip install --quiet -U wheel setuptools cython pip; fi
44-
@if [ "$(USING_PDM)" ]; then $(PDM) install -G:all; fi
23+
install-hatch: ## Install Hatch
24+
@sh ./scripts/install-hatch.sh
25+
26+
configure-hatch: ## Configure Hatch defaults
27+
@hatch config set dirs.env.virtual .direnv
28+
@hatch config set dirs.env.pip-compile .direnv
29+
30+
upgrade-hatch: ## Update Hatch, UV, and Ruff
31+
@hatch self update
32+
33+
install: ## Install the project and all dependencies
34+
@if [ "$(VENV_EXISTS)" ]; then echo "=> Removing existing virtual environment"; $(MAKE) destroy-venv; fi
35+
@$(MAKE) clean
36+
@if ! hatch --version > /dev/null; then echo '=> Installing `hatch` with standalone installation'; $(MAKE) install-hatch ; fi
37+
@echo "=> Creating Python environments..."
38+
@$(MAKE) configure-hatch
39+
@hatch env create local
4540
@echo "=> Install complete! Note: If you want to re-install re-run 'make install'"
4641

4742

48-
clean: ## Cleanup temporary build artifacts
43+
.PHONY: upgrade
44+
upgrade: ## Upgrade all dependencies to the latest stable versions
45+
@echo "=> Updating all dependencies"
46+
@hatch-pip-compile --upgrade --all
47+
@echo "=> Python Dependencies Updated"
48+
@hatch run lint:pre-commit autoupdate
49+
@echo "=> Updated Pre-commit"
50+
51+
52+
.PHONY: clean
53+
clean: ## remove all build, testing, and static documentation files
4954
@echo "=> Cleaning working directory"
50-
@if [ "$(USING_PDM)" ]; then $(PDM) run pre-commit clean; fi
51-
@rm -rf .pytest_cache .ruff_cache .hypothesis build/ -rf dist/ .eggs/
55+
@rm -rf .pytest_cache .ruff_cache .hypothesis build/ dist/ .eggs/ .coverage coverage.xml coverage.json htmlcov/ .mypy_cache
5256
@find . -name '*.egg-info' -exec rm -rf {} +
5357
@find . -name '*.egg' -exec rm -f {} +
5458
@find . -name '*.pyc' -exec rm -f {} +
5559
@find . -name '*.pyo' -exec rm -f {} +
5660
@find . -name '*~' -exec rm -f {} +
5761
@find . -name '__pycache__' -exec rm -rf {} +
62+
@find . -name '.pytest_cache' -exec rm -rf {} +
5863
@find . -name '.ipynb_checkpoints' -exec rm -rf {} +
59-
@rm -rf .coverage coverage.xml coverage.json htmlcov/ .pytest_cache tests/.pytest_cache tests/**/.pytest_cache .mypy_cache
60-
$(MAKE) docs-clean
64+
@echo "=> Source cleaned successfully"
65+
66+
deep-clean: clean destroy-venv ## Clean everything up
67+
@hatch python remove all
68+
@echo "=> Hatch environments pruned and python installations trimmed"
69+
70+
destroy-venv: ## Destroy the virtual environment
71+
@hatch env prune
72+
@hatch env remove lint
73+
@rm -Rf .venv
74+
@rm -Rf .direnv
75+
76+
.PHONY: build
77+
build: clean ## Build and package the collectors
78+
@echo "=> Building package..."
79+
@hatch build
80+
@echo "=> Package build complete..."
81+
82+
83+
###############
84+
# docs #
85+
###############
86+
.PHONY: serve-docs
87+
serve-docs: ## Serve HTML documentation
88+
@hatch run docs:serve
89+
90+
.PHONY: docs
91+
docs: ## generate HTML documentation and serve it to the browser
92+
@hatch run docs:build
6193

62-
destroy: ## Destroy the virtual environment
63-
@rm -rf .venv
6494

6595
# =============================================================================
6696
# Tests, Linting, Coverage
6797
# =============================================================================
6898
.PHONY: lint
6999
lint: ## Runs pre-commit hooks; includes ruff linting, codespell, black
70100
@echo "=> Running pre-commit process"
71-
@$(ENV_PREFIX)pre-commit run --all-files
101+
@hatch run lint:fix
72102
@echo "=> Pre-commit complete"
73103

74-
.PHONY: coverage
75-
coverage: ## Run the tests and generate coverage report
76-
@echo "=> Running tests with coverage"
77-
@$(ENV_PREFIX)pytest tests --cov=litestar_asyncg
78-
@$(ENV_PREFIX)coverage html
79-
@$(ENV_PREFIX)coverage xml
80-
@echo "=> Coverage report generated"
81-
82104
.PHONY: test
83105
test: ## Run the tests
84106
@echo "=> Running test cases"
85-
@$(ENV_PREFIX)pytest tests
107+
@hatch run +py=3.12 test:cov
86108
@echo "=> Tests complete"
87109

88-
89-
.PHONY: check-all
90-
check-all: lint test coverage ## Run all linting, tests, and coverage checks
91-
92-
# =============================================================================
93-
# Docs
94-
# =============================================================================
95-
.PHONY: docs-install
96-
docs-install: ## Install docs dependencies
97-
@echo "=> Installing documentation dependencies"
98-
@$(PDM) install --group docs
99-
@echo "=> Installed documentation dependencies"
100-
101-
docs-clean: ## Dump the existing built docs
102-
@echo "=> Cleaning documentation build assets"
103-
@rm -rf docs/_build
104-
@echo "=> Removed existing documentation build assets"
105-
106-
docs-serve: docs-clean ## Serve the docs locally
107-
@echo "=> Serving documentation"
108-
$(ENV_PREFIX)sphinx-autobuild docs docs/_build/ -j auto --watch litestar_asyncg --watch docs --watch tests --watch CONTRIBUTING.rst --port 8002
109-
110-
docs: docs-clean ## Dump the existing built docs and rebuild them
111-
@echo "=> Building documentation"
112-
@$(ENV_PREFIX)sphinx-build -M html docs docs/_build/ -E -a -j auto --keep-going
110+
.PHONY: test-all
111+
test-all: ## Run the tests for all python versions
112+
@echo "=> Running test cases"
113+
@hatch run test:cov
114+
@echo "=> Tests complete"

0 commit comments

Comments
 (0)