diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 00000000..945a3831 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b711b693..c2235c59 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -59,6 +59,7 @@ Please write to `ops@nixtla.io` 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 diff --git a/nbs/docs/tutorials/5_finetuning.ipynb b/nbs/docs/tutorials/5_finetuning.ipynb index 0ac19fa4..37e35787 100644 --- a/nbs/docs/tutorials/5_finetuning.ipynb +++ b/nbs/docs/tutorials/5_finetuning.ipynb @@ -307,10 +307,6 @@ "display_name": "python3", "language": "python", "name": "python3" - }, - "language_info": { - "name": "python", - "version": "3.10.13" } }, "nbformat": 4, diff --git a/nixtlats/distributed/timegpt.py b/nixtlats/distributed/timegpt.py index 0bb94c63..e629f0a1 100644 --- a/nixtlats/distributed/timegpt.py +++ b/nixtlats/distributed/timegpt.py @@ -47,6 +47,7 @@ def _cotransform( # %% ../../nbs/distributed.timegpt.ipynb 4 class _DistributedTimeGPT: + def __init__( self, token: Optional[str] = None, diff --git a/nixtlats/timegpt.py b/nixtlats/timegpt.py index 13c2903d..71f1dcd6 100644 --- a/nixtlats/timegpt.py +++ b/nixtlats/timegpt.py @@ -90,6 +90,7 @@ # %% ../nbs/timegpt.ipynb 6 class _TimeGPTModel: + def __init__( self, client: Nixtla, @@ -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, ), @@ -1024,6 +1027,7 @@ def plot( # %% ../nbs/timegpt.ipynb 11 class TimeGPT(_TimeGPT): + def _instantiate_distributed_timegpt(self): from nixtlats.distributed.timegpt import _DistributedTimeGPT diff --git a/setup.py b/setup.py index f7e5aab7..83321f42 100644 --- a/setup.py +++ b/setup.py @@ -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"]