-
Notifications
You must be signed in to change notification settings - Fork 2k
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
invalid escape sequences in h2o-py docstrings #16466
Labels
Comments
Turns out these are actually a runtime problem. Importing h2o in a conftest.py under pytest and tox crashes with import errors. This happens on python 3.11 - 3.13. tox -e py311
.pkg: _optional_hooks> python C:\Users\\venv\Lib\site-packages\pyproject_api\_backend.py True setuptools.build_meta
.pkg: get_requires_for_build_wheel> python C:\Users\\venv\Lib\site-packages\pyproject_api\_backend.py True setuptools.build_meta
.pkg: build_wheel> python C:\Users\\venv\Lib\site-packages\pyproject_api\_backend.py True setuptools.build_meta
py311: install_package> venv\Scripts\uv.exe pip install --reinstall --no-deps <package-name>@C:\Users\\.tox\.tmp\package\69\<package-name>-1.6.0-py3-none-any.whl
py311: commands[0]> pytest --cov --junitxml=report.py311.xml --basetemp=C:\Users\\.tox\py311\tmp -vv
ImportError while loading conftest 'C:\Users\\tests\conftest.py'.
tests\conftest.py:12: in <module>
import h2o
.tox\py311\Lib\site-packages\h2o\__init__.py:26: in <module>
from h2o.h2o import (connect, init, api, connection, resume,
.tox\py311\Lib\site-packages\h2o\h2o.py:14: in <module>
from .backend import H2OConnection
.tox\py311\Lib\site-packages\h2o\backend\__init__.py:44: in <module>
from .connection import H2OConnection
.tox\py311\Lib\site-packages\h2o\backend\connection.py:34: in <module>
from h2o.model.metrics import make_metrics
.tox\py311\Lib\site-packages\h2o\model\__init__.py:8: in <module>
from .model_base import ModelBase
E File "C:\Users\\.tox\py311\Lib\site-packages\h2o\model\model_base.py", line 913
E """
E ^^^
E SyntaxError: invalid escape sequence '\s'
py311: exit 4 (2.14 seconds) C:\Users\> pytest --cov --junitxml=report.py311.xml --basetemp=C:\Users\\.tox\py311\tmp -vv pid=17720
py311: FAIL code 4 (4.28=setup[2.14]+cmd[2.14] seconds)
evaluation failed :( (4.64 seconds) |
jmahlik
added a commit
to StateFarmIns/h2o-3
that referenced
this issue
Jan 21, 2025
Allow h2o to be imported without triggering syntax errors. Closes h2oai#16466
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
H2O version, Operating System and Environment
main branch, windows, python 3.12+
Actual behavior
There are some invalid escape sequences in the docstrings of h2o-py.
These will eventually raise errors when the package is imported. https://docs.python.org/3/whatsnew/3.12.html#other-language-changes. I ran in to this when generating documentation via sphinx when h2o is installed. It causes sphinx to crash since sphix is using the content of the docstrings.
h2o-3/h2o-py/h2o/model/model_base.py
Line 918 in 8ff06da
h2o-3/h2o-py/h2o/estimators/xgboost.py
Line 2571 in 8ff06da
Expected behavior
Replace the invalid sequences with valid escapes or use raw strings
Steps to reproduce
Steps to reproduce the behavior (with working code on a sample dataset, if possible):
Just running the file is enough to trigger this i.e.
python -Werror ./venv/Lib/site-packages/h2o/estimators/xgboost.py
Upload logs
If you can, please upload the H2O logs. More information on how to do that is available here, or you can use the
h2o.downloadAllLogs()
in R or theh2o.download_all_logs()
function in Python.Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: