-
Notifications
You must be signed in to change notification settings - Fork 84
Open
Labels
Description
Bug description
automatic commits may fail if pre-commit hooks are installed.
I have a repo with output-stripping pre-commit hooks, and it means that if I ever visit an nbgitpuller link with an unclean state, pull fails.
In typical pre-commit fashion, often running the commit a second time succeeds, but may not always.
Options:
- try commit twice (allows pre-commit to run, still requires it to pass)
- commit with --no-verify (allows commit to always succeed, but violates pre-commit enforcement, which may be important)
- if commit fails, stash so files are not lost, but also not in history
How to reproduce
- create or clone a repo with a pre-commit hook
- edit a file so that committing it would not pass pre-commit (e.g. mess with formatting if black/ruff is enabled
- visit nbgitpuller link for that repo
Expected behaviour
Pull succeeds
Actual behaviour
Pull fails with an error:
$ git -c [email protected] -c user.name=nbgitpuller commit -am Automatic commit by nbgitpuller --allow-empty
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check json...............................................................Passed
check yaml...........................................(no files to check)Skipped
mdformat.............................................(no files to check)Skipped
nbqa-ruff................................................................Passed
nbstripout...............................................................Failed
- hook id: nbstripout
- files were modified by this hook
Traceback (most recent call last):
File "/opt/conda/lib/python3.12/threading.py", line 1075, in _bootstrap_inner
self.run()
File "/opt/conda/lib/python3.12/threading.py", line 1012, in run
self._target(*self._args, **self._kwargs)
File "/opt/conda/lib/python3.12/site-packages/nbgitpuller/handlers.py", line 99, in pull
raise e
File "/opt/conda/lib/python3.12/site-packages/nbgitpuller/handlers.py", line 93, in pull
for line in gp.pull():
^^^^^^^^^
File "/opt/conda/lib/python3.12/site-packages/nbgitpuller/pull.py", line 144, in pull
yield from self.update()
File "/opt/conda/lib/python3.12/site-packages/nbgitpuller/pull.py", line 340, in update
yield from self.commit_all()
File "/opt/conda/lib/python3.12/site-packages/nbgitpuller/pull.py", line 299, in commit_all
yield from execute_cmd([
File "/opt/conda/lib/python3.12/site-packages/nbgitpuller/pull.py", line 48, in execute_cmd
raise subprocess.CalledProcessError(ret, cmd)
subprocess.CalledProcessError: Command '['git', '-c', '[email protected]', '-c', 'user.name=nbgitpuller', 'commit', '-am', 'Automatic commit by nbgitpuller', '--allow-empty']' returned non-zero exit status 1.
Your personal set up
- OS: ubuntu 24.04 (docker, z2jh)
Full environment
alembic==1.15.2
altair==5.5.0
annotated-types==0.7.0
anyio==4.9.0
archspec==0.2.5
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async_generator==1.10
async-lru==2.0.5
attrs==25.3.0
babel==2.17.0
beautifulsoup4==4.13.3
black==25.1.0
bleach==6.2.0
blinker==1.9.0
bokeh==3.7.2
boltons==24.0.0
Bottleneck==1.4.2
Brotli==1.1.0
cached-property==1.5.2
certifi==2025.1.31
certipy==0.2.2
cffi==1.17.1
cfgv==3.4.0
cgmquantify_updated==0.5.3
charset-normalizer==3.4.1
click==8.1.8
cloudpickle==3.1.1
colorama==0.4.6
comm==0.2.2
conda==25.3.1
conda-libmamba-solver==25.3.0
conda-package-handling==2.4.0
conda_package_streaming==0.11.0
contourpy==1.3.1
cryptography==44.0.2
cycler==0.12.1
Cython==3.0.12
cytoolz==1.0.1
dask==2025.3.0
DateTime==5.5
debugpy==1.8.13
decorator==5.2.1
defusedxml==0.7.1
dill==0.3.9
distlib==0.3.9
distributed==2025.3.0
distro==1.9.0
et_xmlfile==2.0.0
exceptiongroup==1.2.2
executing==2.1.0
fastjsonschema==2.21.1
filelock==3.18.0
fonttools==4.57.0
fqdn==1.5.1
frozendict==2.4.6
fsspec==2025.3.2
gh-scoped-creds==4.1
gitdb==4.0.12
GitPython==3.1.44
gmpy2==2.1.5
greenlet==3.1.1
h11==0.14.0
h2==4.2.0
h5py==3.13.0
hpack==4.1.0
httpcore==1.0.7
httpx==0.28.1
hyperframe==6.1.0
identify==2.6.9
idna==3.10
imagecodecs==2024.12.30
imageio==2.37.0
importlib_metadata==8.6.1
importlib_resources==6.5.2
ipykernel==6.29.5
ipympl==0.9.7
ipython==9.1.0
ipython_genutils==0.2.0
ipython_pygments_lexers==1.1.1
ipywidgets==8.1.5
isoduration==20.11.0
jedi==0.19.2
Jinja2==3.1.6
joblib==1.4.2
json5==0.12.0
jsonpatch==1.33
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter-events==0.12.0
jupyter-lsp==2.2.5
jupyter_server==2.15.0
jupyter_server_mathjax==0.2.6
jupyter_server_terminals==0.5.3
jupyter-smart-on-fhir==0.1.0a3
jupyterhealth-client==0.0.1a4
jupyterhub==5.2.1
jupyterlab==4.4.0
jupyterlab_code_formatter==3.0.2
jupyterlab_git==0.51.1
jupyterlab_pygments==0.3.0
jupyterlab_server==2.27.3
jupyterlab_widgets==3.0.13
kiwisolver==1.4.8
lazy_loader==0.4
libmambapy==2.1.0
llvmlite==0.44.0
locket==1.0.0
lz4==4.3.3
Mako==1.3.9
MarkupSafe==3.0.2
matplotlib==3.10.1
matplotlib-inline==0.1.7
menuinst==2.2.0
mistune==3.1.3
mpmath==1.3.0
msgpack==1.1.0
multidict==6.4.2
munkres==1.1.4
mypy-extensions==1.0.0
narwhals==1.34.1
nbclassic==1.2.0
nbclient==0.10.2
nbconvert==7.16.6
nbdime==4.0.2
nbformat==5.10.4
nbgitpuller==1.2.2
nest_asyncio==1.6.0
networkx==3.4.2
nodeenv==1.9.1
notebook==7.4.0
notebook_shim==0.2.4
numba==0.61.2
numexpr==2.10.2
numpy==2.2.4
oauthlib==3.2.2
openpyxl==3.1.5
overrides==7.7.0
packaging==24.2
pamela==1.2.0
pandas==2.2.3
pandocfilters==1.5.0
parso==0.8.4
partd==1.4.2
pathspec==0.12.1
patsy==1.0.1
pexpect==4.9.0
pickleshare==0.7.5
pillow==11.1.0
pip==25.0.1
pkgutil_resolve_name==1.3.10
platformdirs==4.3.7
pluggy==1.5.0
pre_commit==4.2.0
prometheus_client==0.21.1
prompt_toolkit==3.0.50
propcache==0.3.1
protobuf==5.29.3
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
py-cpuinfo==9.0.0
pyarrow==19.0.1
pycosat==0.6.6
pycparser==2.22
pydantic==2.11.3
pydantic_core==2.33.1
Pygments==2.19.1
PyJWT==2.10.1
pyparsing==3.2.3
PySocks==1.7.1
python-dateutil==2.9.0.post0
python-json-logger==2.0.7
pytz==2024.1
PyWavelets==1.8.0
PyYAML==6.0.2
pyzmq==26.4.0
referencing==0.36.2
requests==2.32.3
rfc3339_validator==0.1.4
rfc3986-validator==0.1.1
rpds-py==0.24.0
ruamel.yaml==0.18.10
ruamel.yaml.clib==0.2.8
ruff==0.11.4
scikit-image==0.25.2
scikit-learn==1.6.1
scipy==1.15.2
seaborn==0.13.2
Send2Trash==1.8.3
setuptools==78.1.0
six==1.17.0
smmap==5.0.2
sniffio==1.3.1
sortedcontainers==2.4.0
soupsieve==2.5
SQLAlchemy==2.0.40
stack_data==0.6.3
statsmodels==0.14.4
sympy==1.13.3
tables==3.10.2
tblib==3.1.0
terminado==0.18.1
threadpoolctl==3.6.0
tifffile==2025.3.30
tinycss2==1.4.0
tomli==2.2.1
toolz==1.0.0
tornado==6.4.2
tqdm==4.67.1
traitlets==5.14.3
truststore==0.10.1
types-python-dateutil==2.9.0.20241206
typing_extensions==4.13.1
typing-inspection==0.4.0
typing_utils==0.1.0
tzdata==2025.2
unicodedata2==16.0.0
uri-template==1.3.0
urllib3==2.3.0
virtualenv==20.30.0
voila==0.5.8
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
websockets==15.0.1
wheel==0.45.1
widgetsnbextension==4.0.13
xlrd==2.0.1
xyzservices==2025.1.0
yarl==1.19.0
zict==3.0.0
zipp==3.21.0
zope.interface==7.2
zstandard==0.23.0