-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add dependencies to pixi.toml * Pixi-ize pre-commit * Add pixi tasks * Update CI * Fix build dependencies * update lockfile * Fix doctest * Try to fix readthedocs * Use latest pixi on conda-forge * Find some minimum versions * Bump minimum formulaic version * Find minimum numpy version * Make polars a test dependency * Update lockfile * Fix typing issues * Fix benchmarks * Update contributing docs * Make ruff happy * Remove unnecessary pre-commit option from CI
- Loading branch information
Showing
22 changed files
with
18,382 additions
and
266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# GitHub syntax highlighting | ||
pixi.lock linguist-language=YAML linguist-generated=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,87 +3,55 @@ on: [push] | |
|
||
jobs: | ||
pre-commit-checks: | ||
name: pre-commit checks | ||
name: Linux - pre-commit checks | ||
timeout-minutes: 30 | ||
runs-on: ubuntu-latest | ||
env: | ||
PRE_COMMIT_USE_MICROMAMBA: 1 | ||
steps: | ||
- name: Checkout branch | ||
uses: actions/checkout@v4 | ||
- name: Set up micromamba | ||
uses: mamba-org/setup-micromamba@f8b8a1e23a26f60a44c853292711bacfd3eac822 | ||
- name: Add micromamba to GITHUB_PATH | ||
run: echo "${HOME}/micromamba-bin" >> "$GITHUB_PATH" | ||
- name: Install Python 3.10 | ||
uses: actions/setup-python@v5 | ||
- name: Set up pixi | ||
uses: prefix-dev/[email protected] | ||
with: | ||
python-version: "3.10" | ||
- name: Run pre-commit checks | ||
uses: pre-commit/[email protected] | ||
environments: lint default | ||
- name: pre-commit | ||
run: pixi run -e lint pre-commit-run --color=always --show-diff-on-failure | ||
|
||
unit-tests: | ||
name: Tests - ${{ matrix.os }} - Py${{ matrix.python-version }} - ${{ matrix.note }} | ||
name: Tests | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
CI: True | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
include: | ||
- { os: ubuntu-latest, python-version: '3.9', note: 'Default Builds' } | ||
- { os: ubuntu-latest, python-version: '3.10', note: 'Default Builds' } | ||
- { os: ubuntu-latest, python-version: '3.11', note: 'Default Builds' } | ||
- { os: ubuntu-latest, python-version: '3.12', note: 'Default Builds' } | ||
- { os: ubuntu-latest, python-version: '3.12', note: 'Nightly Builds' } | ||
- { os: macos-latest, python-version: '3.12', note: 'Default Builds' } | ||
- { os: windows-latest, python-version: '3.12', note: 'Default Builds' } | ||
- { os: ubuntu-latest, environment: 'py310' } | ||
- { os: ubuntu-latest, environment: 'py311' } | ||
- { os: ubuntu-latest, environment: 'py312' } | ||
- { os: windows-latest, environment: 'py312' } | ||
- { os: macos-latest, environment: 'py312' } | ||
- { os: ubuntu-latest, environment: 'oldies' } | ||
- { os: ubuntu-latest, environment: 'nightly' } | ||
steps: | ||
- name: Checkout branch | ||
uses: actions/checkout@v4 | ||
- name: Set up conda env | ||
uses: mamba-org/setup-micromamba@f8b8a1e23a26f60a44c853292711bacfd3eac822 | ||
- name: Set up pixi | ||
uses: prefix-dev/setup-pixi@992a3081e2f87829e0fff9fb29f4fe6a5d1e80a2 | ||
with: | ||
environment-file: ${{ matrix.os == 'windows-latest' && 'environment-win.yml' || 'environment.yml' }} | ||
init-shell: ${{ matrix.os == 'windows-latest' && 'powershell' || 'bash' }} | ||
cache-environment: true | ||
create-args: >- | ||
python=${{ matrix.python-version }} | ||
environments: ${{ matrix.environment }} | ||
- name: Install nightlies | ||
if: matrix.note == 'Nightly Builds' | ||
shell: bash -el {0} | ||
run: | | ||
PRE_WHEELS="https://pypi.anaconda.org/scientific-python-nightly-wheels/simple/" | ||
for pkg in numpy pandas scipy; do | ||
echo "Installing $pkg nightly" | ||
micromamba remove -y --force $pkg | ||
pip install --pre --no-deps --only-binary :all: --upgrade --timeout=60 -i $PRE_WHEELS $pkg | ||
done | ||
micromamba remove -y --force formulaic | ||
pip install --no-deps git+https://github.com/matthewwardrop/formulaic | ||
micromamba list | ||
- name: Install repository (unix) | ||
if: matrix.os != 'windows-latest' | ||
shell: bash -el {0} | ||
run: pip install --no-use-pep517 --no-deps --disable-pip-version-check -e . | ||
- name: Install repository (windows) | ||
if: matrix.os == 'windows-latest' | ||
shell: powershell | ||
run: pip install --no-use-pep517 --no-deps --disable-pip-version-check -e . | ||
- name: Run pytest (unix) | ||
if: matrix.os != 'windows-latest' | ||
shell: bash -el {0} | ||
run: pytest -nauto tests -m "not high_memory" --doctest-modules src/ | ||
- name: Run pytest (windows) | ||
if: matrix.os == 'windows-latest' | ||
shell: powershell | ||
run: pytest -nauto tests -m "not high_memory" | ||
if: matrix.NOTE == 'Nightly Builds' | ||
run: pixi run -e ${{ matrix.environment }} install-nightlies | ||
- name: Install repository | ||
run: pixi run -e ${{ matrix.environment }} postinstall | ||
- name: Run pytest | ||
run: pixi run -e ${{ matrix.environment }} test -nauto -m "not high_memory" | ||
- name: Run doctest | ||
if: matrix.os != 'windows-latest' | ||
shell: bash -el {0} | ||
# Check that the readme example will work by running via doctest. | ||
# We run outside the repo to make the test a bit more similar to | ||
# a user running after installing with conda. | ||
run: | | ||
mkdir ../temp | ||
cp README.md ../temp | ||
cd ../temp | ||
python -m doctest -v README.md | ||
pixi run --manifest-path ../tabmat/pixi.toml -e ${{ matrix.environment }} python -m doctest -v README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,47 @@ | ||
exclude: ^.pixi$ | ||
repos: | ||
- repo: https://github.com/Quantco/pre-commit-mirrors-ruff | ||
rev: 0.6.2 | ||
- repo: local | ||
hooks: | ||
- id: ruff-conda | ||
- id: ruff-format-conda | ||
- repo: https://github.com/Quantco/pre-commit-mirrors-mypy | ||
rev: "1.10.1" | ||
hooks: | ||
- id: mypy-conda | ||
- repo: https://github.com/Quantco/pre-commit-mirrors-cython-lint | ||
rev: 0.16.2 | ||
hooks: | ||
- id: cython-lint-conda | ||
args: [--no-pycodestyle] | ||
- id: double-quote-cython-strings-conda | ||
# ensure pixi environments are up to date | ||
# workaround for https://github.com/prefix-dev/pixi/issues/1482 | ||
- id: pixi-install | ||
name: pixi-install | ||
entry: pixi install -e default -e lint | ||
language: system | ||
always_run: true | ||
require_serial: true | ||
pass_filenames: false | ||
# ruff | ||
- id: ruff | ||
name: ruff | ||
entry: pixi run -e lint ruff check --fix --exit-non-zero-on-fix --force-exclude | ||
language: system | ||
types_or: [python, pyi] | ||
require_serial: true | ||
- id: ruff-format | ||
name: ruff-format | ||
entry: pixi run -e lint ruff format --force-exclude | ||
language: system | ||
types_or: [python, pyi] | ||
require_serial: true | ||
# mypy | ||
- id: mypy | ||
name: mypy | ||
entry: pixi run -e default mypy --allow-redefinition | ||
exclude: (^tests/) | ||
language: system | ||
types: [python] | ||
require_serial: true | ||
# cython-lint | ||
- id: cython-lint | ||
name: cython-lint | ||
entry: pixi run -e lint cython-lint --no-pycodestyle | ||
language: system | ||
types: [cython] | ||
require_serial: true | ||
- id: cython-double-quote | ||
name: cython-double-quote | ||
entry: pixi run -e lint double-quote-cython-strings | ||
language: system | ||
types: [cython] | ||
require_serial: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,51 +28,51 @@ Releases | |
|
||
Development installation | ||
------------------------ | ||
For development, you should do an editable installation: | ||
We use [pixi](https://prefix.dev/) for setting up the project dependencies. [Install it](https://pixi.sh/latest/#installation) first if you do not have it already. The following commands will set up the project for development: | ||
|
||
```bash | ||
# First, make sure you have conda-forge as your primary conda channel: | ||
conda config --add channels conda-forge | ||
# And install pre-commit | ||
conda install -y pre-commit | ||
|
||
git clone [email protected]:Quantco/tabmat.git | ||
cd tabmat | ||
|
||
# Set up our pre-commit hooks for ruff, mypy, and cython-lint. | ||
pre-commit install | ||
pixi run pre-commit-install | ||
|
||
# Set up a pixi environment with the dependencies and install the package in editable mode. | ||
pixi run postinstall | ||
|
||
# If you want to install the dependencies necessary for benchmarking against other GLM packages: | ||
pixi run -e benchmark postinstall | ||
|
||
# Set up a conda environment with name "tabmat" | ||
conda env create | ||
# If you want to work on the documentation: | ||
pixi run -e docs postinstall | ||
|
||
# Install this package in editable mode. | ||
conda activate tabmat | ||
pip install --no-use-pep517 --disable-pip-version-check -e . | ||
# You can run any command in the pixi environment with `pixi run <command>`. For example: | ||
pixi run [-e ENVIRONMENT] ipython | ||
|
||
# Alternatively, you can create a shell with the pixi environment activated: | ||
pixi shell | ||
|
||
# A number of pixi tasks are available for commonly used commands. | ||
# You can run them with `pixi run <task>`. | ||
# To get a list of available tasks, run: | ||
pixi task list | ||
``` | ||
|
||
Testing and continuous integration | ||
-------------------------------------------------- | ||
The test suite is in ``tests/`` and can be run using ``pytest``. | ||
The test suite is in ``tests/`` and can be run using ``pixi run test``. | ||
|
||
Developing the documentation | ||
---------------------------------------- | ||
|
||
The documentation is built with Sphinx. To develop the documentation: | ||
|
||
:: | ||
|
||
cd docs | ||
make html | ||
python -m http.server --directory _build/html | ||
|
||
Then, navigate to `<http://localhost:8000>`_ to view the documentation. | ||
The documentation is built with Sphinx. To develop the documentation: ``pixi run serve-docs``. Then, navigate to `<http://localhost:8000>`_ to view the documentation. | ||
|
||
Alternatively, if you install `entr <http://eradman.com/entrproject/>`_, then you can auto-rebuild the documentation any time a file changes with: | ||
|
||
:: | ||
|
||
```bash | ||
cd docs | ||
./dev | ||
``` | ||
|
||
Conda-forge packaging | ||
--------------------- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.