Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
ASEM000 committed Sep 26, 2023
0 parents commit f8231cd
Show file tree
Hide file tree
Showing 55 changed files with 9,674 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
38 changes: 38 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: docs

on:
pull_request:
branches:
- main
push:
branches:
- main

jobs:
test-ubuntu:
name: "docs on ${{ matrix.python-version }} on ${{ matrix.os }}"
runs-on: "${{ matrix.os }}"
strategy:
matrix:
python-version: ["3.10"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt install -y pandoc
python -m pip install --upgrade pip
pip install .
pip install -r docs/requirements.txt
- name: Test doctests
run: |
cd docs
make doctest
- name: Test docs to HTML
run: |
cd docs
make html
25 changes: 25 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: pypi
on:
release:
types: [published]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
pip install twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m build
python -m twine upload dist/*
38 changes: 38 additions & 0 deletions .github/workflows/test_default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: default

on:
- push
- pull_request

jobs:
test:
runs-on: ${{ matrix.os }}
env:
PYTREECLASS_BACKEND: numpy
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install optree numpy
python -m pip install typing-extensions
python -m pip install pytest pytest-benchmark wheel coverage
- name: Pytest Check
run: |
export PYTREECLASS_BACKEND=default
python -m pip install .
coverage run -m pytest tests
- name: Codecov
uses: codecov/[email protected]
35 changes: 35 additions & 0 deletions .github/workflows/test_jax.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: jax backend

on:
- push
- pull_request

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install jaxlib jax
python -m pip install typing-extensions
python -m pip install pytest pytest-benchmark wheel coverage
- name: Pytest Check
run: |
export PYTREECLASS_BACKEND=jax
python -m pip install .
coverage run -m pytest tests
- name: Codecov
uses: codecov/[email protected]
38 changes: 38 additions & 0 deletions .github/workflows/test_numpy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: numpy backend

on:
- push
- pull_request

jobs:
test:
runs-on: ${{ matrix.os }}
env:
PYTREECLASS_BACKEND: numpy
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install optree numpy
python -m pip install typing-extensions
python -m pip install pytest pytest-benchmark wheel coverage
- name: Pytest Check
run: |
export PYTREECLASS_BACKEND=numpy
python -m pip install .
coverage run -m pytest tests
- name: Codecov
uses: codecov/[email protected]
38 changes: 38 additions & 0 deletions .github/workflows/test_torch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: torch backend

on:
- push
- pull_request

jobs:
test:
runs-on: ${{ matrix.os }}
env:
PYTREECLASS_BACKEND: numpy
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install optree torch numpy
python -m pip install typing-extensions
python -m pip install pytest pytest-benchmark wheel coverage
- name: Pytest Check
run: |
export PYTREECLASS_BACKEND=torch
python -m pip install .
coverage run -m pytest tests
- name: Codecov
uses: codecov/[email protected]
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*.pyc
**/__pycache__
**/.ipynb_checkpoints
**/.DS_Store
*.Icon
*.egg-info/
*.trunk/
*.vscode/
dist
test.ipynb
build
experimental
docs/_build
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changelog

## v0.10.0

- successor of the `jax`-specific `pytreeclass`

- Supports multibackend:

- `numpy` + `optree` via `export sepes_BACKEND=numpy` (lightweight option)
- `jax` via `export sepes_BACKEND=jax` - The default -
- `torch` + `optree` via `export sepes_BACKEND=torch`
- no array + `optree` via `export sepes_BACKEND=default`

- drop `callback` option in parallel options in `is_parallel`
- Add parallel processing via `is_parallel` to `.{get,set}`
- `register_excluded_type` to `autoinit` to exclude certain types to be in `field` defaults.
- add `doc` in `field` to add extra documentation for the descriptor `__doc__`
Loading

0 comments on commit f8231cd

Please sign in to comment.