Skip to content

Commit b5b42a1

Browse files
authored
Merge branch 'main' into icarosadero-patch-1
2 parents 1af08b9 + 568c5f8 commit b5b42a1

File tree

6 files changed

+73
-5
lines changed

6 files changed

+73
-5
lines changed

.pre-commit-config.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ repos:
2020
- id: isort
2121
additional_dependencies:
2222
- pyproject.toml
23+
- repo: https://github.com/astral-sh/ruff-pre-commit
24+
rev: v0.0.280
25+
hooks:
26+
- id: ruff

cebra/datasets/monkey_reaching.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,12 @@ def _load_data(
7777
"Could not import the nlb_tools package required for data loading "
7878
"the raw reaching datasets in NWB format. "
7979
"If required, you can install the dataset by running "
80-
"pip install nlb_tools or installing cebra with the [datasets] "
81-
"dependencies: pip install 'cebra[datasets]'")
80+
"pip install nlb_tools."
81+
# NOTE(stes): Install nlb_tools manually for now, also see
82+
# note in setup.cfg
83+
# or installing cebra with the [datasets] "
84+
#"dependencies: pip install 'cebra[datasets]'")
85+
)
8286

8387
def _get_info(trial_info, data):
8488
passive = []

cebra/integrations/plotly.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def _convert_cmap2colorscale(cmap: str, pl_entries: int = 11, rdigits: int = 2):
4545
"""
4646
scale = np.linspace(0, 1, pl_entries)
4747
colors = (cmap(scale)[:, :3] * 255).astype(np.uint8)
48-
pl_colorscale = [[round(s, rdigits), f"rgb{tuple(color)}"]
48+
pl_colorscale = [[float(round(s, rdigits)), f"rgb{tuple(color.tolist())}"]
4949
for s, color in zip(scale, colors)]
5050
return pl_colorscale
5151

docs/source/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def get_years(start_year=2021):
104104

105105
intersphinx_mapping = {
106106
"python": ("https://docs.python.org/3", None),
107-
"torch": ("https://pytorch.org/docs/master/", None),
107+
"torch": ("https://pytorch.org/docs/stable/", None),
108108
"sklearn": ("https://scikit-learn.org/stable", None),
109109
"numpy": ("https://numpy.org/doc/stable/", None),
110110
"matplotlib": ("https://matplotlib.org/stable/", None),

pyproject.toml

+53
Original file line numberDiff line numberDiff line change
@@ -527,3 +527,56 @@ overgeneral-exceptions=[
527527
'Exception',
528528
'BaseException',
529529
]
530+
531+
[tool.ruff]
532+
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
533+
select = ["E", "F"]
534+
ignore = []
535+
536+
# Allow autofix for all enabled rules (when `--fix`) is provided.
537+
fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]
538+
unfixable = []
539+
540+
# Exclude a variety of commonly ignored directories.
541+
exclude = [
542+
".bzr",
543+
".direnv",
544+
".eggs",
545+
".git",
546+
".git-rewrite",
547+
".hg",
548+
".mypy_cache",
549+
".nox",
550+
".pants.d",
551+
".pytype",
552+
".ruff_cache",
553+
".svn",
554+
".tox",
555+
".venv",
556+
"__pypackages__",
557+
"_build",
558+
"buck-out",
559+
"build",
560+
"dist",
561+
"node_modules",
562+
"venv",
563+
]
564+
565+
# Same as Black.
566+
line-length = 160
567+
568+
# Allow unused variables when underscore-prefixed.
569+
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
570+
571+
# Assume Python 3.10.
572+
target-version = "py310"
573+
574+
ignore-init-module-imports = true
575+
576+
[tool.ruff.mccabe]
577+
# Unlike Flake8, default to a complexity level of 10.
578+
max-complexity = 10
579+
580+
[tool.ruff.per-file-ignores]
581+
# ignore import issues in __init__ files
582+
"__init__.py" = ["E402", "F403", "F405", "F401"]

setup.cfg

+8-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ where =
3131
python_requires = >=3.9
3232
install_requires =
3333
joblib
34+
numpy<2.0.0
3435
literate-dataclasses
3536
scikit-learn
3637
scipy
@@ -44,7 +45,13 @@ datasets =
4445
# cebra.datasets.allen
4546
h5py
4647
pandas
47-
nlb_tools
48+
# NOTE(stes): nlb_tools currently pins pandas to <1.3.4, see here:
49+
# https://github.com/neurallatents/nlb_tools/blob/1ddc15f45b56388ff093d1396b7b87b36fa32a68/requirements.txt#L1
50+
# Since this is a fairly old pandas version, it causes additional version
51+
# conflicts with other packages. Removing nlb_tools as a required dependency for now.
52+
# The only part this package is needed is in cebra/datasets/monkey_reaching.py, where
53+
# we added a warning message to tell the user how to manually install it.
54+
#nlb_tools
4855
# additional data loading dependencies
4956
hdf5storage # for creating .mat files in new format
5057
openpyxl # for excel file format loading

0 commit comments

Comments
 (0)