Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
reidjohnson committed Mar 23, 2022
0 parents commit 27574fe
Show file tree
Hide file tree
Showing 39 changed files with 5,356 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Quantile Forest Docs

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r ./requirements.txt
pip install -r ./docs/sphinx_requirements.txt
python setup.py build_ext --inplace && pip install .
- name: Build documents
run: |
cd ./docs/
make clean
make html
env:
GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: ./docs/_build/html/
42 changes: 42 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Quantile Forest CI

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: '3.10'

- name: Cache dependencies
id: cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install -r requirements.txt
pip install -r ./docs/sphinx_requirements.txt
python setup.py build_ext --inplace && pip install .
- name: Linting with flake8
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics || exit 1
flake8 . --count --exit-zero --max-line-length=100 --statistics
- name: Test with pytest
run: |
python -m pytest
78 changes: 78 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Quantile Forest CD

on:
push:
branches:
- main
tags:
- 'v*.*.*'

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-2019, macOS-latest]

steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.3.1

- name: Build wheels for Linux
if: matrix.os == 'ubuntu-20.04'
run: |
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_SKIP: "pp* *i686* *musllinux*"
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.7"
CIBW_BEFORE_BUILD: pip install -r requirements.txt && python setup.py build_ext --inplace && pip install .

- name: Build wheels for Windows
if: matrix.os == 'windows-2019'
run: |
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_SKIP: "pp* cp310-* *i686*"
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.7"
CIBW_BEFORE_BUILD: pip install -r requirements.txt && python setup.py build_ext --inplace && pip install .

- name: Build wheels for macOS
if: matrix.os == 'macos-latest'
run: |
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_SKIP: "pp* *i686*"
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.7"
CIBW_BEFORE_BUILD: pip install -r requirements.txt && python setup.py build_ext --inplace && pip install .

- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl

upload_pypi:
needs: build_wheels
runs-on: ubuntu-latest

if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install twine
- name: Publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload dist/*
73 changes: 73 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so
*.cpp

# scikit-learn specific
doc/_build/
doc/auto_examples/
doc/modules/generated/
doc/datasets/generated/

# Distribution / packaging

.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
*/version.py

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

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

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
doc/_build/
doc/generated/

# PyBuilder
target/

# OS generated files #
######################
.DS_Store
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Reid Johnson <[email protected]>
30 changes: 30 additions & 0 deletions CONTRIBUTING
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Contributions
=============

Contributions are welcome and greatly appreciated.

Install
-------

To build and install the package, run::

python setup.py build_ext --inplace
python setup.py install

Testing
-------
To run unit tests, run::

pytest quantile_forest -v

Troubleshooting
---------------
If the build fails because SciPy is not installed, ensure OpenBLAS and LAPACK are available and accessible.

On macOS, run::

brew install openblas
brew install lapack
export SYSTEM_VERSION_COMPAT=1

Then try rebuilding.
Loading

0 comments on commit 27574fe

Please sign in to comment.