Skip to content

Commit

Permalink
Black lint fix 20230311 (#859)
Browse files Browse the repository at this point in the history
Fix black linting, add dependency to have unit test run after lint
  • Loading branch information
swotai committed Mar 13, 2024
1 parent 7feb449 commit 93033f1
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 43 deletions.
33 changes: 4 additions & 29 deletions .github/workflows/black.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,8 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
# - uses: actions/checkout@v3
# - uses: psf/black@stable
# Currently only checking instead of auto formatting
# - uses: jpetrucciani/black-check@master
# - name: Install Dependencies
# run: |
# python -m pip install --upgrade pip
# pip install -r requirements-test.txt
# pip install black --upgrade
# - name: black check diff
# run: black --diff .
- name: Check out repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: psf/black@stable
with:
python-version: 3.9 # Set to your preferred Python version

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-test.txt
pip install black --upgrade
# - name: Run Black Check
# run: black --check . # conforms Black's style without changing it

- name: Show Black Diff
run: black --diff . # shows the diff of Black changes, if any
options: "--check --verbose --color"
jupyter: true
2 changes: 1 addition & 1 deletion .github/workflows/pypi-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# separate terms of service, privacy policy, and support
# documentation.

name: Deploy package to PyPI
name: Deploy Package to PyPI

on:
release:
Expand Down
19 changes: 11 additions & 8 deletions .github/workflows/build.yaml → .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: build
name: Build and Test

on: [push]
on:
workflow_run:
workflows: [Lint]
types: [completed]

jobs:
build:
on_success:
# [macos-latest, macos-latest, windows-latest]
runs-on: ubuntu-latest
strategy:
Expand All @@ -23,9 +26,9 @@ jobs:
run: python -c "import sys; print(sys.version)"
- name: Install dependencies
run: |
pip install -U pip
pip install -U setuptools
pip install -r requirements.txt
python -m pip install -U --editable ".[dev]"
pip install -U pip
pip install -U setuptools
pip install -r requirements.txt
python -m pip install -U --editable ".[dev]"
- name: Test with pytest
run: python -m pytest tests/
run: python -m pytest tests/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ tutorial/_build/
!.jenkins/
!.scaffold.yaml
!.readthedocs.yml
!.github/

# Java
*.class
Expand Down
12 changes: 7 additions & 5 deletions orbit/utils/stan.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@


def get_compiled_stan_model(
stan_model_name: str = "",
stan_model_name: str = "",
stan_file_path: Optional[str] = None,
exe_file_path: Optional[str] = None,
force_compile: bool = False,
Expand All @@ -43,12 +43,12 @@ def get_compiled_stan_model(
----------
stan_model_name :
The name of the Stan model to use. Use this for the built in models (dlt, ets, ktrlite, lgt)
stan_file_path :
stan_file_path :
The path to the Stan file to use. If not provided, the default is to search for the file in the 'orbit' package.
If provided, function will ignore the stan_model_name parameter, and will compile the provide stan_file_path
into executable in place (same folder as stan_file_path)
exe_file_path :
The path to the Stan-exe file to use. If not provided, the default is to search for the file
exe_file_path :
The path to the Stan-exe file to use. If not provided, the default is to search for the file
in the 'orbit' package. If provided, function will ignore the stan_model_name parameter,
and will compile the provide stan_file_path into executable in place (same folder as stan_file_path)
Returns
Expand All @@ -57,7 +57,9 @@ def get_compiled_stan_model(
A compiled Stan model.
"""
if (stan_file_path is not None) or (exe_file_path is not None):
sm = CmdStanModel(stan_file=stan_file, exe_file=exe_file_path, force_compile=force_compile)
sm = CmdStanModel(
stan_file=stan_file, exe_file=exe_file_path, force_compile=force_compile
)
else:
# Load orbit included cmdstan models
# Some oddities here. if not providing exe_file, CmdStanModel would delete the actual executable file.
Expand Down

0 comments on commit 93033f1

Please sign in to comment.