Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infrastructure #40

Merged
merged 14 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
38 changes: 28 additions & 10 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,28 @@ on:
workflow_dispatch:

jobs:

fmt:
name: formatting quality
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Ruff
run: |
python -m pip install ruff
- name: Lint with Ruff
run: |
# code quality check, stop the build for any errors
ruff check . --show-fixes --exit-non-zero-on-fix

test:
needs: fmt
name: ${{ matrix.os }} py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -23,13 +44,9 @@ jobs:
run:
shell: bash -l {0}
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
uses: conda-incubator/setup-miniconda@v2
- uses: actions/checkout@v4
- name: Install Python and Dependencies
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
miniforge-version: latest
Expand All @@ -48,10 +65,11 @@ jobs:
conda list
- name: Lint with Ruff
run: |
# code quality check
# stop the build if there are Python syntax errors or undefined names
ruff check . --select=E9,F63,F7,F82 --statistics
# exit-zero treats all errors as warnings.
ruff check . --exit-zero --statistics
ruff check . --select=E9,F63,F7,F82 --no-fix
# stop the build for any other configured Ruff linting errors
ruff check . --show-fixes --exit-non-zero-on-fix
- name: Test with pytest
run: |
python -m pytest
Expand Down
25 changes: 10 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
Expand All @@ -13,19 +13,14 @@ repos:
hooks:
- id: nbstripout

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.274
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.11
hooks:
# Run the linter.
- id: ruff
args: [--fix, --exit-non-zero-on-fix]

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: ["--profile", "black", "--filter-files"]

- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
types_or: [ python, pyi, jupyter ]
args: [ --fix ]
# Run the formatter.
- id: ruff-format
types_or: [ python, pyi, jupyter ]
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,45 @@
# sharrow
numba for ActivitySim-style spec files

## Building a Wheel

To build a wheel for sharrow, you need to have `build` installed. You can
install it with `python -m pip install build`.

Then run the builder:

```shell
python -m build .
```


## Building the documentation

Building the documentation for sharrow requires JupyterBook.

```shell
jupyterbook build docs
```

## Developer Note

This repository's continuous integration testing will use `ruff` to check code
quality. There is a pre-commit hook that will run `ruff` on all staged files
to ensure that they pass the quality checks. To install and use this hook,
run the following commands:

```shell
python -m pip install pre-commit # if needed
pre-commit install
```

Then, when you try to make a commit, your code will be checked locally to ensure
that your code passes the quality checks. If you want to run the checks manually,
you can do so with the following command:

```shell
pre-commit run --all-files
```

If you don't use `pre-commit`, a service will run the checks for you when you
open a pull request, and make fixes to your code when possible.
Loading