Skip to content
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
ae47392
migrated src tracing here and add infra
juiwenchen Jun 11, 2025
f347c64
refactor name
juiwenchen Jun 11, 2025
482cba0
add ci and update ignore for mypy
juiwenchen Jun 11, 2025
3cbde6e
add action
juiwenchen Jun 11, 2025
7e7deb5
updated gitignore
juiwenchen Jun 11, 2025
384343d
add docs
juiwenchen Jun 12, 2025
1e600e4
remove leading spaces
juiwenchen Jun 12, 2025
177adfd
updated remote-url
juiwenchen Jun 12, 2025
c822c4f
adapted new repo
juiwenchen Jun 12, 2025
d55a864
fix bugs and improve config validation
juiwenchen Jun 16, 2025
d47566f
added configuration for src-trace
juiwenchen Jun 16, 2025
c2c2ba6
fixed mypy errors
juiwenchen Jun 16, 2025
d897edb
improve config validation
juiwenchen Jun 24, 2025
d5bc060
fixed mypy
juiwenchen Jun 25, 2025
edefdbe
improve config validation
juiwenchen Jun 25, 2025
4b0bf7a
disabled color for testing
juiwenchen Jun 25, 2025
97a2c19
strip ANSI
juiwenchen Jun 25, 2025
85e1592
set NO_COLOR
juiwenchen Jun 25, 2025
9a57ed3
removed first two lines
juiwenchen Jun 25, 2025
bdc569d
ignore format from typer
juiwenchen Jun 25, 2025
3fb60a2
improved docs
juiwenchen Jun 25, 2025
1988da7
updated pyproject
juiwenchen Jul 7, 2025
2b8dc69
added installation doc
juiwenchen Jul 7, 2025
b8e60ef
update docs
juiwenchen Jul 7, 2025
9d79598
add development docs
juiwenchen Jul 8, 2025
790050a
changed layout of docs
juiwenchen Jul 8, 2025
c3524aa
added CLI docs
juiwenchen Jul 8, 2025
57b1ac0
added typer ext
juiwenchen Jul 8, 2025
b5c0981
updated build cmd
juiwenchen Jul 8, 2025
1b8ff12
added contributing docs
juiwenchen Jul 8, 2025
33eedf8
update docs
juiwenchen Jul 8, 2025
f5a60b4
update oneline docs
juiwenchen Jul 9, 2025
fe6a476
updated docs
juiwenchen Jul 9, 2025
67c2ed7
added caution
juiwenchen Jul 9, 2025
a7600ab
enhance online docs
juiwenchen Jul 10, 2025
1eba831
added release action
juiwenchen Jul 10, 2025
ed0b2d0
test release action
juiwenchen Jul 10, 2025
1f99f62
test github_page
juiwenchen Jul 10, 2025
da93659
update release action
juiwenchen Jul 10, 2025
4eba349
use rye build
juiwenchen Jul 10, 2025
a916a49
remove test gh page
juiwenchen Jul 10, 2025
baaf83c
specified package location
juiwenchen Jul 10, 2025
95e1bdd
updated permission
juiwenchen Jul 10, 2025
2e7dd45
updated package-dir
juiwenchen Jul 10, 2025
a4ed9fb
updated
juiwenchen Jul 10, 2025
b304b51
updated
juiwenchen Jul 10, 2025
5ab9d39
updated
juiwenchen Jul 10, 2025
a3a5d7c
updated
juiwenchen Jul 10, 2025
54fa062
Reformatted docs
ubmarco Jul 10, 2025
c0af6b2
Rewrite some docs
ubmarco Jul 10, 2025
6521dbb
Wording
ubmarco Jul 10, 2025
8ffee7a
updated according to the review
juiwenchen Jul 10, 2025
a68da45
make CI happy
juiwenchen Jul 10, 2025
65663b5
confirm relative path
juiwenchen Jul 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/actions/setup_rye/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Set up rye
runs:
using: 'composite'
steps:
# rye uses uv under the hood, so we need to set the cache directory correctly, based on the OS
- name: Set UV_CACHE_DIR for Linux
if: runner.os == 'Linux'
run: |
echo "UV_CACHE_DIR=/home/runner/.cache/uv" >> $GITHUB_ENV
shell: bash
- name: Set MATURIN_PEP517_ARGS for Linux
if: runner.os == 'Linux'
# make sure we always use zig, to get manylinux2014 compatible rust binaries
run: |
echo "MATURIN_PEP517_ARGS=--zig" >> $GITHUB_ENV
shell: bash
- name: Set UV_CACHE_DIR for MacOS
if: runner.os == 'macOS'
run: echo "UV_CACHE_DIR=/Users/gh-runner/Library/Caches/uv" >> $GITHUB_ENV
shell: bash
- name: Set UV_CACHE_DIR for Windows
if: runner.os == 'Windows'
run: echo "UV_CACHE_DIR=C:\\Users\\useblocks\\AppData\\Local\\uv-${{ runner.name }}" >> $env:GITHUB_ENV
shell: pwsh
# now install rye and sync the dependencies
- uses: eifinger/setup-rye@v4
with:
version: "0.42.0"
enable-cache: false
- run: rye sync
shell: ${{ runner.os == 'Windows' && 'powershell' || 'bash' }}
121 changes: 121 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: ci

on:
push:
branches: [main]
tags:
- "v[0-9]+.[0-9]+.[0-9]+*"
pull_request:
types: [closed, labeled, reopened, unlabeled, synchronize, opened]

concurrency:
# For PRs, cancel in progress runs, if a new commit is pushed
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

# These permissions are needed to interact with GitHub's OIDC Token endpoint.
permissions:
id-token: write
contents: read

jobs:
pre-commit:
name: Pre-commit
runs-on: [self-hosted, linux, x64]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version-file: ".python-version"
- run: python -m pip install pre-commit pre-commit-uv
# - uses: pre-commit/action@v3.0.1 # note we don't use this, since it calls ations/cache, which actually takes longer than without it
- run: pre-commit run --all --show-diff-on-failure --color=always

mypy:
name: MyPy
runs-on: [self-hosted, linux, x64]

steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup_rye
- run: rye run mypy:all

pytest:
name: Pytest (${{ matrix.os }}-${{ matrix.arch }})
strategy:
fail-fast: false
matrix:
include:
- os: linux
arch: x64
- os: linux
arch: arm64
- os: windows
arch: x64
- os: macos
arch: arm64

runs-on: [self-hosted, "${{ matrix.os }}", "${{ matrix.arch }}"]

steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup_rye
- run: rye test -a

pytest-prod:
Comment thread
juiwenchen marked this conversation as resolved.
Outdated
# pytest against packages installed as they would be in production
# i.e. as wheels that may contain obfuscated code

name: Pytest prod (${{ matrix.os }}-${{ matrix.arch }})
strategy:
fail-fast: false
matrix:
include:
- os: linux
arch: x64
- os: linux
arch: arm64
- os: windows
arch: x64
- os: macos
arch: arm64

runs-on: [self-hosted, "${{ matrix.os }}", "${{ matrix.arch }}"]

steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup_rye
- run: rye run pytest:prod

docs:
name: Documentation build
runs-on: [self-hosted, linux, x64]

steps:
- uses: actions/checkout@v4
- name: Install graphviz
Comment thread
juiwenchen marked this conversation as resolved.
Outdated
run: sudo apt-get --yes install graphviz
- uses: ./.github/actions/setup_rye
- name: Run documentation build
run: rye run docs

all_good:
# This job does nothing and is only used for the branch protection
# see https://github.com/marketplace/actions/alls-green#why

if: ${{ !cancelled() }}

needs:
- pre-commit
- mypy
- pytest
- pytest-prod
Comment thread
juiwenchen marked this conversation as resolved.
Outdated
- docs

runs-on: [self-hosted, linux, x64]

steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
55 changes: 55 additions & 0 deletions .github/workflows/gh_pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Workflow for building and deploying the Sphinx site to GitHub Pages
#
name: Deploy docs to GH Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
name: Build
runs-on: [self-hosted, linux, x64]
steps:
- uses: actions/checkout@v4
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Install graphviz
Comment thread
juiwenchen marked this conversation as resolved.
Outdated
run: sudo apt-get --yes install graphviz
- uses: eifinger/setup-rye@v4
- run: rye sync
- name: Run documentation build
run: rye run docs
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/_build/html

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: [self-hosted, linux, x64]
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
56 changes: 56 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Release
on:
push:
# tags:
Comment thread
juiwenchen marked this conversation as resolved.
Outdated
# - '[0-9].[0-9]+.[0-9]+'

permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
contents: read

jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install pypa/build
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use flit instead to build, just check this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm can we change it in the next PR? all i know now is it works now and it's from papy

run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
needs:
- build
runs-on: ubuntu-latest
# environment:
# name: pypi
# url: https://pypi.org/p/<package-name> # Replace <package-name> with your PyPI project name
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
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# python generated files
.ruff_cache
.pytest_cache
.mypy_cache
__pycache__/
*.py[oc]
build/
dist/
wheels/
*.egg-info
.venv

# lock files
requirements.lock
requirements-dev.lock

# Sphinx build output
**/_build

# rye is the primary tool, uv is only used for on-the-fly setups
uv.lock
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: v5.0.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: pretty-format-json
Comment thread
juiwenchen marked this conversation as resolved.
Outdated
args: [--autofix, --no-sort-keys]
files: (package\.json|tsconfig\.json)$
types: [file]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.1
Comment thread
juiwenchen marked this conversation as resolved.
Outdated
hooks:
- id: ruff-format
name: python format
- id: ruff
alias: ruff-check
name: python lint
args: [--fix]

- repo: https://github.com/ComPWA/taplo-pre-commit
rev: v0.9.3
hooks:
- id: taplo-format
# lint fetches schemas online at each call, deactivate for now
- id: taplo-lint
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12.7
19 changes: 19 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""
Global pytest conftest.py.

This is needed due to:

pytest test discovery error for workspace: /home/marco/ub/ubtrace
Comment thread
juiwenchen marked this conversation as resolved.
Outdated
Failed: Defining 'pytest_plugins' in a non-top-level conftest is no longer supported:
It affects the entire test suite instead of just below the conftest as expected.
/home/marco/ub/ubtrace/python/ubt_connect_core/tests/conftest.py
Please move it to a top level conftest file at the rootdir:
/home/marco/ub/ubtrace
For more information, visit:
https://docs.pytest.org/en/stable/deprecations.html#pytest-plugins-in-non-top-level-conftest-files

See also the root README.md.
"""

# Makes make_app avaialble
pytest_plugins = ("sphinx.testing.fixtures",)
Comment thread
juiwenchen marked this conversation as resolved.
Outdated
Loading
Loading