-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6612af9
Showing
46 changed files
with
5,122 additions
and
0 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,32 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- '*' | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
python-version: ["3.12",] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: 'pip' | ||
- name: Install | ||
run: python -m pip install --upgrade pip && pip install .[dev] -c constraints | ||
- name: Lint | ||
run: ruff check --output-format=github ./src ./tests | ||
- name: Test | ||
run: pytest --rootdir= ./tests --doctest-modules --junitxml=junit/test-results.xml | ||
|
||
|
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,83 @@ | ||
## macOS | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
._* | ||
.fseventsd | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
## Python | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
*.so | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
*.manifest | ||
*.spec | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
*.mo | ||
*.pot | ||
.ipynb_checkpoints | ||
.python-version | ||
.env | ||
.venv | ||
.dev_venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
.ropeproject | ||
/site | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
.venv/ | ||
[Bb]in | ||
[Ii]nclude | ||
[Ll]ib | ||
[Ll]ib64 | ||
[Ll]ocal | ||
[Ss]cripts | ||
pyvenv.cfg | ||
pip-selfcheck.json | ||
|
||
## Editors | ||
.vscode/ | ||
.idea/ | ||
local_cache/ |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Miquido | ||
|
||
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. |
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,78 @@ | ||
SHELL := sh | ||
.ONESHELL: | ||
.SHELLFLAGS := -eu -c | ||
.DELETE_ON_ERROR: | ||
|
||
SOURCES_PATH := src | ||
TESTS_PATH := tests | ||
|
||
# load environment config from .env if able | ||
-include .env | ||
|
||
ifndef PYTHON_ALIAS | ||
PYTHON_ALIAS := python | ||
endif | ||
|
||
ifndef INSTALL_OPTIONS | ||
INSTALL_OPTIONS := .[dev] | ||
endif | ||
|
||
ifndef UV_VERSION | ||
UV_VERSION := 0.4.22 | ||
endif | ||
|
||
.PHONY: venv sync lock update format lint test release | ||
|
||
# Setup virtual environment for local development. | ||
venv: | ||
@echo '# Preparing development environment...' | ||
@echo '...preparing git hooks...' | ||
@cp -n ./config/pre-push ./.git/hooks/pre-push || : | ||
@echo '...installing uv...' | ||
@curl -LsSf https://github.com/astral-sh/uv/releases/download/$(UV_VERSION)/uv-installer.sh | sh | ||
@echo '...preparing venv...' | ||
@$(PYTHON_ALIAS) -m venv .venv --prompt="VENV[DEV]" --clear --upgrade-deps | ||
@. ./.venv/bin/activate && pip install --upgrade pip && uv pip install --editable $(INSTALL_OPTIONS) --constraint constraints | ||
@echo '...development environment ready! Activate venv using `. ./.venv/bin/activate`.' | ||
|
||
# Sync environment with uv based on constraints | ||
sync: | ||
@echo '# Synchronizing dependencies...' | ||
@$(if $(findstring $(UV_VERSION), $(shell uv --version | head -n1 | cut -d" " -f2)), , @echo '...updating uv...' && curl -LsSf https://github.com/astral-sh/uv/releases/download/$(UV_VERSION)/uv-installer.sh | sh) | ||
@uv pip install --editable $(INSTALL_OPTIONS) --constraint constraints | ||
@echo '...finished!' | ||
|
||
# Generate a set of locked dependencies from pyproject.toml | ||
lock: | ||
@echo '# Locking dependencies...' | ||
@uv pip compile pyproject.toml -o constraints --all-extras | ||
@echo '...finished!' | ||
|
||
# Update and lock dependencies from pyproject.toml | ||
update: | ||
@echo '# Updating dependencies...' | ||
@$(if $(shell printf '%s\n%s\n' "$(UV_VERSION)" "$$(uv --version | head -n1 | cut -d' ' -f2)" | sort -V | head -n1 | grep -q "$(UV_VERSION)"), , @echo '...updating uv...' && curl -LsSf https://github.com/astral-sh/uv/releases/download/$(UV_VERSION)/uv-installer.sh | sh) | ||
# @$(if $(findstring $(UV_VERSION), $(shell uv --version | head -n1 | cut -d" " -f2)), , @echo '...updating uv...' && curl -LsSf https://github.com/astral-sh/uv/releases/download/$(UV_VERSION)/uv-installer.sh | sh) | ||
@uv --no-cache pip compile pyproject.toml -o constraints --all-extras --upgrade | ||
@uv pip install --editable $(INSTALL_OPTIONS) --constraint constraints | ||
@echo '...finished!' | ||
|
||
# Run formatter. | ||
format: | ||
@ruff check --quiet --fix $(SOURCES_PATH) $(TESTS_PATH) | ||
@ruff format --quiet $(SOURCES_PATH) $(TESTS_PATH) | ||
|
||
# Run linters and code checks. | ||
lint: | ||
@bandit -r $(SOURCES_PATH) | ||
@ruff check $(SOURCES_PATH) $(TESTS_PATH) | ||
@pyright --project ./ | ||
|
||
# Run tests suite. | ||
test: | ||
@$(PYTHON_ALIAS) -B -m pytest -vv --cov=$(SOURCES_PATH) --rootdir=$(TESTS_PATH) | ||
|
||
release: lint test | ||
@echo '# Preparing release...' | ||
@python -m build && python -m twine upload --skip-existing dist/* | ||
@echo '...finished!' |
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,41 @@ | ||
# 🚗 haiway 🚕 🚚 🚙 | ||
|
||
haiway is a framework helping to build better project codebase by leveraging concepts of structured concurrency and functional programming. | ||
|
||
## 🖥️ Install | ||
|
||
With pip: | ||
|
||
```bash | ||
pip install haiway | ||
``` | ||
|
||
## 👷 Contributing | ||
|
||
As an open-source project in a rapidly evolving field, we welcome all contributions. Whether you can add a new feature, enhance our infrastructure, or improve our documentation, your input is valuable to us. | ||
|
||
We welcome any feedback and suggestions! Feel free to open an issue or pull request. | ||
|
||
## ⚖️ License | ||
|
||
MIT License | ||
|
||
Copyright (c) 2024 Miquido | ||
|
||
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. |
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,57 @@ | ||
#!/bin/sh | ||
|
||
if git rev-parse --verify HEAD >/dev/null 2>&1 | ||
then | ||
against=HEAD | ||
else | ||
against=$(git hash-object -t tree /dev/null) | ||
fi | ||
|
||
remote="$1" | ||
url="$2" | ||
|
||
zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0') | ||
|
||
while read local_ref local_oid remote_ref remote_oid | ||
do | ||
if test "$local_oid" = "$zero" | ||
then | ||
# Handle delete | ||
: | ||
else | ||
if test "$remote_oid" = "$zero" | ||
then | ||
# New branch, examine all commits | ||
range="$local_oid" | ||
else | ||
# Update to existing branch, examine new commits | ||
range="$remote_oid..$local_oid" | ||
fi | ||
|
||
# Check for WIP commit | ||
commit=$(git rev-list -n 1 --grep '^WIP' "$range") | ||
if test -n "$commit" | ||
then | ||
echo >&2 "Found WIP commit in $local_ref, not pushing" | ||
exit 1 | ||
fi | ||
fi | ||
done | ||
|
||
. ./.venv/bin/activate | ||
|
||
make lint | ||
|
||
if test $? != 0 | ||
then | ||
cat <<\EOF | ||
Error: Linting failed. | ||
Ensure project quality and make all linting rules pass! | ||
EOF | ||
exit 1 | ||
fi | ||
|
||
exec git diff-index --check --cached $against -- |
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,43 @@ | ||
# This file was autogenerated by uv via the following command: | ||
# uv --no-cache pip compile pyproject.toml -o constraints --all-extras | ||
bandit==1.7.10 | ||
# via haiway (pyproject.toml) | ||
coverage==7.6.3 | ||
# via pytest-cov | ||
iniconfig==2.0.0 | ||
# via pytest | ||
markdown-it-py==3.0.0 | ||
# via rich | ||
mdurl==0.1.2 | ||
# via markdown-it-py | ||
nodeenv==1.9.1 | ||
# via pyright | ||
packaging==24.1 | ||
# via pytest | ||
pbr==6.1.0 | ||
# via stevedore | ||
pluggy==1.5.0 | ||
# via pytest | ||
pygments==2.18.0 | ||
# via rich | ||
pyright==1.1.384 | ||
# via haiway (pyproject.toml) | ||
pytest==7.4.4 | ||
# via | ||
# haiway (pyproject.toml) | ||
# pytest-asyncio | ||
# pytest-cov | ||
pytest-asyncio==0.23.8 | ||
# via haiway (pyproject.toml) | ||
pytest-cov==4.1.0 | ||
# via haiway (pyproject.toml) | ||
pyyaml==6.0.2 | ||
# via bandit | ||
rich==13.9.2 | ||
# via bandit | ||
ruff==0.5.7 | ||
# via haiway (pyproject.toml) | ||
stevedore==5.3.0 | ||
# via bandit | ||
typing-extensions==4.12.2 | ||
# via pyright |
Oops, something went wrong.