Skip to content

Commit

Permalink
add pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jmoralez committed Mar 14, 2024
1 parent 21d23aa commit 16a7651
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 8 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Lint

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@v2

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

- name: Install dependencies
run: pip install black nbdev pre-commit

- name: Run pre-commit
run: pre-commit run
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Please write to `[email protected]` if you're insterested in contributing to this pr
Before doing any changes to the code, please install the git hooks that run automatic scripts during each commit and merge to strip the notebooks of superfluous metadata (and avoid merge conflicts).
```
nbdev_install_hooks
pre-commit install
```

### Preview Changes
Expand Down
4 changes: 0 additions & 4 deletions nbs/docs/tutorials/5_finetuning.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,6 @@
"display_name": "python3",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python",
"version": "3.10.13"
}
},
"nbformat": 4,
Expand Down
1 change: 1 addition & 0 deletions nixtlats/distributed/timegpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def _cotransform(

# %% ../../nbs/distributed.timegpt.ipynb 4
class _DistributedTimeGPT:

def __init__(
self,
token: Optional[str] = None,
Expand Down
10 changes: 7 additions & 3 deletions nixtlats/timegpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@

# %% ../nbs/timegpt.ipynb 6
class _TimeGPTModel:

def __init__(
self,
client: Nixtla,
Expand Down Expand Up @@ -575,9 +576,11 @@ def detect_anomalies(self, df: pd.DataFrame):
y=y,
x=x,
freq=self.freq,
level=[self.level]
if (isinstance(self.level, int) or isinstance(self.level, float))
else [self.level[0]],
level=(
[self.level]
if (isinstance(self.level, int) or isinstance(self.level, float))
else [self.level[0]]
),
clean_ex_first=self.clean_ex_first,
model=self.model,
),
Expand Down Expand Up @@ -1024,6 +1027,7 @@ def plot(

# %% ../nbs/timegpt.ipynb 11
class TimeGPT(_TimeGPT):

def _instantiate_distributed_timegpt(self):
from nixtlats.distributed.timegpt import _DistributedTimeGPT

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
with open("README.md", "r", encoding="utf8") as fh:
long_description = fh.read()

dev = ["black", "nbdev", "plotly", "python-dotenv", "statsforecast", "datasetsforecast"]
dev = ["black", "datasetsforecast", "nbdev", "plotly", "python-dotenv", "statsforecast", "pre-commit"]
distributed = ["dask[dataframe]", "fugue[ray]>=0.8.7", "pyspark", "ray[serve-grpc]"]
plotting = ["utilsforecast[plotting]>=0.0.5"]
date_extras = ["holidays"]
Expand Down

0 comments on commit 16a7651

Please sign in to comment.