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

[pre-commit.ci] pre-commit suggestions #787

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
Expand All @@ -25,28 +25,28 @@ repos:
# args: [--in-place, --wrap-summaries=120, --wrap-descriptions=120]

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
additional_dependencies: [tomli]
#args: ["--write-changes"] # uncomment if you want to get automatic fixing

- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.10.0
hooks:
- id: black
name: Black code

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
rev: 0.7.21
hooks:
- id: mdformat
additional_dependencies:
- mdformat-gfm
- mdformat_frontmatter

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
rev: v0.8.6
hooks:
- id: ruff
args: ["--fix"]
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,6 @@ _Note: You might want to set a reference to the main repository to fetch/merge f
git remote add upstream https://github.com/nteract/papermill
```

It's possible you will have conflicts between your repository and main. Here, `main` is meant to be synchronized with the `upstream` repository. GitHub has some good [documentation](https://help.github.com/articles/resolving-a-merge-conflict-using-the-command-line/) on merging pull requests from the command line.
It's possible you will have conflicts between your repository and main. Here, `main` is meant to be synchronized with the `upstream` repository. GitHub has some good [documentation](https://help.github.com/articles/resolving-a-merge-conflict-using-the-command-line/) on merging pull requests from the command line.

Happy hacking on Papermill!
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pip install papermill
```

For all optional io dependencies, you can specify individual bundles
like `s3`, or `azure` -- or use `all`. To use Black to format parameters you can add as an extra requires \['black'\].
like `s3`, or `azure` -- or use `all`. To use Black to format parameters you can add as an extra requires ['black'].

```{.sourceCode .bash}
pip install papermill[all]
Expand Down Expand Up @@ -100,7 +100,7 @@ $ papermill local/input.ipynb s3://bkt/output.ipynb -p alpha 0.6 -p l1_ratio 0.1
```

**NOTE:**
If you use multiple AWS accounts, and you have [properly configured your AWS credentials](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html), then you can specify which account to use by setting the `AWS_PROFILE` environment variable at the command-line. For example:
If you use multiple AWS accounts, and you have [properly configured your AWS credentials](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html), then you can specify which account to use by setting the `AWS_PROFILE` environment variable at the command-line. For example:

```{.sourceCode .bash}
$ AWS_PROFILE=dev_account papermill local/input.ipynb s3://bkt/output.ipynb -p alpha 0.6 -p l1_ratio 0.1
Expand Down Expand Up @@ -154,7 +154,7 @@ Papermill supports the following name handlers for input and output paths during

- Local file system: `local`

- HTTP, HTTPS protocol: `http://, https://`
- HTTP, HTTPS protocol: `http://, https://`

- Amazon Web Services: [AWS S3](https://aws.amazon.com/s3/) `s3://`

Expand Down
1 change: 1 addition & 0 deletions binder/cli-simple/pm_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
],
"source": [
"import os\n",
"\n",
"import papermill as pm\n",
"\n",
"binder_dir = '..'"
Expand Down
4 changes: 2 additions & 2 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ We made it to our [1.0 milestone goals](https://github.com/nteract/papermill/mil

- Input and output paths can now reference input parameters. `my_nb_{nb_type}.ipynb out_{nb_type}.ipynb -p nb_type test` will substitute values into the paths passed in with python format application patterns.
- `read_notebook`, `read_notebooks`, `record`, and `display` api functions are now removed.
- \[upstream\] ipywidgets are now supported. See [nbconvert docs](https://nbconvert.readthedocs.io/en/latest/execute_api.html#widget-state) for details.
- \[upstream\] notebook executions which run out of memory no longer hang indefinitely when the kernel dies.
- [upstream] ipywidgets are now supported. See [nbconvert docs](https://nbconvert.readthedocs.io/en/latest/execute_api.html#widget-state) for details.
- [upstream] notebook executions which run out of memory no longer hang indefinitely when the kernel dies.

## 0.19.1

Expand Down
1 change: 1 addition & 0 deletions papermill/abs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities for working with Azure blob storage"""

import io
import re

Expand Down
1 change: 1 addition & 0 deletions papermill/adl.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities for working with Azure data lake storage"""

import re

from azure.datalake.store import core, lib
Expand Down
5 changes: 2 additions & 3 deletions papermill/engines.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Engines to perform different roles"""

import datetime
import sys
from functools import wraps
Expand Down Expand Up @@ -169,9 +170,7 @@ def autosave_cell(self):
# Autosave is taking too long, so exponentially back off.
self.autosave_cell_every *= 2
logger.warning(
"Autosave too slow: {:.2f} sec, over {}% limit. Backing off to {} sec".format(
save_elapsed, self.max_autosave_pct, self.autosave_cell_every
)
f"Autosave too slow: {save_elapsed:.2f} sec, over {self.max_autosave_pct}% limit. Backing off to {self.autosave_cell_every} sec"
)

@catch_nb_assignment
Expand Down
1 change: 1 addition & 0 deletions papermill/inspection.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Deduce parameters of a notebook from the parameters cell."""

from pathlib import Path

import click
Expand Down
1 change: 1 addition & 0 deletions papermill/log.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Sets up a logger"""

import logging

logger = logging.getLogger('papermill')
1 change: 1 addition & 0 deletions papermill/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Models used by papermill."""

from collections import namedtuple

Parameter = namedtuple(
Expand Down
12 changes: 7 additions & 5 deletions papermill/tests/notebooks/gcs/gcs_in/gcs-simple_notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
"outputs": [],
"source": [
"import time\n",
"\n",
"time.sleep(10)"
]
},
Expand All @@ -147,14 +148,13 @@
"outputs": [],
"source": [
"import sys\n",
"from ctypes import CDLL\n",
"# This will crash a Linux or Mac system\n",
"# equivalent calls can be made on Windows\n",
"\n",
"# Uncomment these lines if you would like to see the segfault\n",
"\n",
"# dll = 'dylib' if sys.platform == 'darwin' else 'so.6'\n",
"# libc = CDLL(\"libc.%s\" % dll) \n",
"# libc = CDLL(\"libc.%s\" % dll)\n",
"# libc.time(-1) # BOOM!!"
]
},
Expand Down Expand Up @@ -323,7 +323,9 @@
}
],
"source": [
"import time, sys\n",
"import sys\n",
"import time\n",
"\n",
"for i in range(8):\n",
" print(i)\n",
" time.sleep(0.5)"
Expand All @@ -333,8 +335,8 @@
"metadata": {
"colab": {
"name": "test.ipynb",
"version": "0.3.2",
"provenance": []
"provenance": [],
"version": "0.3.2"
},
"kernelspec": {
"display_name": "Python 3",
Expand Down
1 change: 1 addition & 0 deletions papermill/tests/notebooks/keyboard_interrupt.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
],
"source": [
"from time import sleep\n",
"\n",
"sleep(60)"
]
}
Expand Down
4 changes: 1 addition & 3 deletions papermill/tests/notebooks/systemexit.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import sys"
]
"source": []
},
{
"cell_type": "code",
Expand Down
1 change: 1 addition & 0 deletions papermill/tests/notebooks/test_autosave.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
],
"source": [
"import time\n",
"\n",
"for i in range(25): # This will take 2.5 seconds\n",
" time.sleep(0.1)\n",
" print(i)"
Expand Down
3 changes: 3 additions & 0 deletions papermill/tests/notebooks/test_logging.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
],
"source": [
"import logging\n",
"\n",
"logger = logging.getLogger(\"test\")\n",
"logger.setLevel(logging.INFO)\n",
"logging.basicConfig(level=logging.INFO)\n",
Expand Down Expand Up @@ -66,8 +67,10 @@
],
"source": [
"import warnings\n",
"\n",
"warnings.simplefilter(action='ignore', category=FutureWarning)\n",
"from ggplot import mpg\n",
"\n",
"mpg['cty'].plot.hist(bins=12)"
]
},
Expand Down
Loading