Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
whoahbot committed Aug 19, 2024
0 parents commit 4f4bbef
Show file tree
Hide file tree
Showing 46 changed files with 3,720 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .cbfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[languages]
"{testcode}" = ["ruff format -"]
python = ["ruff format -"]
rust = ["rustfmt"]
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
time: "13:00"
open-pull-requests-limit: 10
allow:
- dependency-type: direct
commit-message:
prefix: "fix: "
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: daily
time: "13:00"
commit-message:
prefix: "fix: "
149 changes: 149 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
name: CI

on:
push:
branches:
- main
release:
types:
- published
pull_request: {}
merge_group:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
repo-checks:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install uv
run: pipx install uv
- uses: extractions/setup-just@v2
- name: Install cbfmt
run: |
mkdir /tmp/cbfmt && cd $_
curl -fsSL -o cbfmt.tar.gz "https://github.com/lukas-reineke/cbfmt/releases/download/v0.2.0/cbfmt_linux-x86_64_v0.2.0.tar.gz"
tar --strip-components 1 -xvf cbfmt.tar.gz
mv cbfmt /usr/local/bin/
- name: Prep venv
shell: bash
run: |
uv venv -p 3.12 venv
. venv/bin/activate
uv pip sync --strict requirements/dev.txt
- name: Check pre-commit hooks
shell: bash
run: |
. venv/bin/activate
just lint-pc
- name: Run lints
shell: bash
run: |
. venv/bin/activate
just lint
- name: Run documentation tests
shell: bash
run: |
. venv/bin/activate
just test-doc
build:
strategy:
matrix:
# Build on just 3.12 since this is a pure Python project.
python-version: ['3.12']
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
run: pipx install uv
- uses: extractions/setup-just@v2
- name: Prep test venv
shell: bash
run: |
uv venv -p ${{ matrix.python-version }} venv/
. venv/bin/activate
uv pip sync --strict requirements/build-py${{ matrix.python-version }}.txt
- name: Build and install the wheel
shell: bash
run: |
. venv/bin/activate
uv pip install build
python -m build --wheel .
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

test:
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
run: pipx install uv
- uses: extractions/setup-just@v2
- name: Prep test venv
shell: bash
run: |
uv venv -p ${{ matrix.python-version }} venv/
. venv/bin/activate
uv pip sync --strict requirements/build-py${{ matrix.python-version }}.txt
- name: Run Python tests
shell: bash
run: |
. venv/bin/activate
WHEEL_FILE=$(ls ./dist/*.whl)
uv pip install -v --no-deps $WHEEL_FILE
just test-py
publish-to-pypi:
name: Publish to PyPI
if: github.event_name == 'release' && github.event.action == 'published'
needs:
- build
- test
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/bytewax-ordering
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
89 changes: 89 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/target

# Byte-compiled / optimized / DLL files
__pycache__/
.pytest_cache/
*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
.venv/
.devenv/
env/
bin/
build/
develop-eggs/
dist/
eggs/
lib/
lib64/
parts/
sdist/
var/
include/
man/
venv/
venvs/
*.egg-info/
.installed.cfg
*.egg

# Installer logs
pip-log.txt
pip-delete-this-directory.txt
pip-selfcheck.json

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

# Rope
.ropeproject

# Django stuff:
*.log
*.pot

.DS_Store

# Sphinx documentation
docs/_build/
# This is autogenerated by sphinx-autodoc2.
docs/api/

# PyCharm
.idea/

# VSCode
.vscode/

# Pyenv
.python-version

# Data generated during examples' execution
parquet_demo_out/
.ipynb_checkpoints/
registry.db

# Pyright / pylsp
pyrightconfig.json
.dir-locals.el

# Devenv stuff
.devenv.flake.nix
devenv.*
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.4.0
hooks:
- id: check-merge-conflict
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
args: ["--fix=lf"]
- id: trailing-whitespace
- repo: local
hooks:
- id: ruff-format
name: "format Python"
language: system
types: ["python"]
entry: "just fmt-py"
- id: cbfmt
name: "format Markdown code blocks"
language: system
types: ["markdown"]
entry: "just fmt-md"
- repo: https://github.com/doublify/pre-commit-rust
rev: v1.0
hooks:
- id: fmt
name: "format Rust"
14 changes: 14 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2

build:
os: "ubuntu-22.04"
tools:
python: "3.12"

python:
install:
- requirements: requirements/doc.txt

sphinx:
configuration: docs/conf.py
fail_on_warning: true
Loading

0 comments on commit 4f4bbef

Please sign in to comment.