Skip to content

Commit

Permalink
Merge pull request #4 from willow-ahrens/revert-2-build-update
Browse files Browse the repository at this point in the history
Revert "BLD: Move build to setuptools"
  • Loading branch information
willow-ahrens authored Jan 26, 2024
2 parents c6098f0 + 60d5b2d commit 37abf81
Show file tree
Hide file tree
Showing 15 changed files with 749 additions and 109 deletions.
34 changes: 7 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
name: CI
jobs:
test:
defaults:
Expand All @@ -14,43 +15,22 @@ jobs:
python: '3.9'
fail-fast: false
runs-on: ${{ matrix.os }}
env:
PYTHON_VERSION: ${{ matrix.python }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Cache conda
uses: actions/cache@v3
env:
# Increase this value to reset cache if ci/environment.yml has not changed
CACHE_NUMBER: 0
- uses: actions/setup-python@v5
with:
path: ~/conda_pkgs_dir
key:
test-${{ matrix.os }}-conda-py${{ matrix.python }}-${{ env.CACHE_NUMBER }}-${{
hashFiles('ci/environment.yml') }}
- uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: finch-tensor-dev
allow-softlinks: true
environment-file: ci/environment.yml
python-version: ${{ matrix.python }}
miniforge-version: latest
use-only-tar-bz2: true
use-mamba: true
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install package
run: |
pip install -e .[tests]
poetry install --with test
- name: Run tests
run: |
pytest --pyargs finch
poetry run pytest --junit-xml=test-${{ matrix.os }}-Python-${{ matrix.python }}.xml
- uses: codecov/codecov-action@v3
if: always()
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action/composite@v1
if: always()
with:
files: "**/test-*.xml"

on:
# Trigger the workflow on push or pull request,
# but only for the main branch
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Publish to PyPI
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: pip install toml
- name: Get version
run: echo "VERSION=$(python -c 'import toml; print(toml.load(\"pyproject.toml\")[\"tool\"][\"poetry\"][\"version\"])')" >> $GITHUB_ENV
- name: Build and publish to pypi
uses: JRubics/poetry-publish@v1.17
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}
- name: Create Release
uses: actions/create-release@v1
if: success()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.VERSION }}
release_name: Release v${{ env.VERSION }}
draft: false
prerelease: false
13 changes: 7 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ ipython_config.py
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
Expand Down Expand Up @@ -151,9 +158,3 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# macOS
**/.DS_Store

# Version file
finch/_version.py
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ repos:
args: ["--fix"]
types_or: [ python, pyi, jupyter ]
- id: ruff-format
types_or: [ python, pyi, jupyter ]
types_or: [ python, pyi, jupyter ]
29 changes: 17 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,39 @@
# finch-tensor
# Finch

This is the beginnings of a sparse tensor library for Python, backed by the
[Finch.jl](https://github.com/willow-ahrens/Finch.jl) tensor compiler.

## Installation

`finch-tensor` is available on PyPi, and can be installed with pip:
Finch is available on PyPi, and can be installed with pip:
```bash
pip install finch-tensor
pip install finch
```

## Contributing

### Local setup
### Packaging

`conda` can be used for creating a local development setup:
Finch uses [poetry](https://python-poetry.org/) for packaging.

To install for development, clone the repository and run:
```bash
git clone https://github.com/willow-ahrens/finch-tensor.git
cd finch-tensor/
conda create --name finch-tensor-dev python=3.9
conda activate finch-tensor-dev
pip install .
poetry install --with test
```
to install the current project and dev dependencies.

### Pre-commit hooks

To add pre-commit hooks, run:
```bash
poetry run pre-commit install
```

### Testing

`finch-tensor` uses [pytest](https://docs.pytest.org/en/latest/) for testing. To run the
Finch uses [pytest](https://docs.pytest.org/en/latest/) for testing. To run the
tests:

```bash
pytest tests
poetry run pytest
```
5 changes: 0 additions & 5 deletions ci/environment.yml

This file was deleted.

6 changes: 0 additions & 6 deletions finch/__init__.py

This file was deleted.

Loading

0 comments on commit 37abf81

Please sign in to comment.