Skip to content

Commit

Permalink
Fix tests/doc build (#967)
Browse files Browse the repository at this point in the history
* Fix errored test teardown

* Docs build pin, docstring fixes

* Update overview page

* Update changelog

* Fix 0.X -> 1.X, remove sponsor-only option
  • Loading branch information
CBroz1 authored May 10, 2024
1 parent faf8a80 commit a508b57
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

- Create class `SpyglassGroupPart` to aid delete propagations #899
- Fix bug report template #955
- Pin `mkdocstring-python` to `1.9.0`, fix existing docstrings. #967

## [0.5.2] (April 22, 2024)

Expand Down
2 changes: 1 addition & 1 deletion docs/build-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
cp ./CHANGELOG.md ./docs/src/
cp ./LICENSE ./docs/src/LICENSE.md
mkdir -p ./docs/src/notebooks
rm -r ./docs/src/notebooks/*
rm -fr ./docs/src/notebooks/*
cp ./notebooks/*ipynb ./docs/src/notebooks/
cp ./notebooks/*md ./docs/src/notebooks/
mv ./docs/src/notebooks/README.md ./docs/src/notebooks/index.md
Expand Down
2 changes: 2 additions & 0 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ nav:
- FigURL: misc/figurl_views.md
- Session Groups: misc/session_groups.md
- Insert Data: misc/insert_data.md
- Mixin: misc/mixin.md
- Merge Tables: misc/merge_tables.md
- Database Management: misc/database_management.md
- Export: misc/export.md
Expand All @@ -100,6 +101,7 @@ plugins:
default_handler: python
handlers:
python:
paths: [src]
options:
members_order: source
group_by_category: false
Expand Down
4 changes: 3 additions & 1 deletion docs/src/misc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
This folder contains miscellaneous supporting files documentation.

- [Database Management](./database_management.md)
- [Export](./export.md)
- [figurl Views](./figurl_views.md)
- [insert Data](./insert_data.md)
- [Insert Data](./insert_data.md)
- [Merge Tables](./merge_tables.md)
- [Mixin Class](./mixin.md)
- [Session Groups](./session_groups.md)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ docs = [
"mkdocs-jupyter", # Docs render notebooks
"mkdocs-literate-nav", # Dynamic page list for API docs
"mkdocs-material", # Docs theme
"mkdocstrings[python]", # Docs API docstrings
"mkdocstrings[python]<=1.9.0", # Docs API docstrings
]

[tool.hatch.version]
Expand Down
4 changes: 2 additions & 2 deletions src/spyglass/common/common_interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,15 +256,15 @@ def consolidate_intervals(interval_list):
def interval_list_intersect(interval_list1, interval_list2, min_length=0):
"""Finds the intersections between two interval lists
Each interval is (start time, stop time)
Parameters
----------
interval_list1 : np.array, (N,2) where N = number of intervals
interval_list2 : np.array, (N,2) where N = number of intervals
min_length : float, optional.
Minimum length of intervals to include, default 0
Each interval is (start time, stop time)
Returns
-------
interval_list: np.array, (N,2)
Expand Down
11 changes: 8 additions & 3 deletions src/spyglass/position/v1/dlc_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,15 @@ def read_yaml(fullpath, filename="*"):
Parameters
----------
fullpath: String or pathlib path. Directory with yaml files
filename: String. Filename, no extension. Permits wildcards.
fullpath: Union[str, pathlib.Path]
Directory with yaml files
filename: str
Filename, no extension. Permits wildcards.
Returns filepath and contents as dict
Returns
-------
tuple
filepath and contents as dict
"""
from deeplabcut.utils.auxiliaryfunctions import read_config

Expand Down
18 changes: 9 additions & 9 deletions src/spyglass/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class SpyglassConfig:
facilitate testing.
"""

def __init__(self, base_dir: str = None, **kwargs):
def __init__(self, base_dir: str = None, **kwargs) -> None:
"""
Initializes a new instance of the class.
Expand Down Expand Up @@ -103,7 +103,7 @@ def load_config(
force_reload=False,
on_startup: bool = False,
**kwargs,
):
) -> None:
"""
Loads the configuration settings for the object.
Expand Down Expand Up @@ -223,25 +223,25 @@ def load_config(

return self._config

def _load_env_vars(self):
def _load_env_vars(self) -> dict:
loaded_dict = {}
for var, val in self.env_defaults.items():
loaded_dict[var] = os.getenv(var, val)
return loaded_dict

def _set_env_with_dict(self, env_dict):
def _set_env_with_dict(self, env_dict) -> None:
# NOTE: Kept for backwards compatibility. Should be removed in future
# for custom paths. Keep self.env_defaults.
for var, val in env_dict.items():
os.environ[var] = str(val)

def _mkdirs_from_dict_vals(self, dir_dict):
def _mkdirs_from_dict_vals(self, dir_dict) -> None:
if self._debug_mode:
return
for dir_str in dir_dict.values():
Path(dir_str).mkdir(exist_ok=True)

def _set_dj_config_stores(self, check_match=True, set_stores=True):
def _set_dj_config_stores(self, check_match=True, set_stores=True) -> None:
"""
Checks dj.config['stores'] match resolved dirs. Ensures stores set.
Expand Down Expand Up @@ -287,7 +287,7 @@ def _set_dj_config_stores(self, check_match=True, set_stores=True):

return

def dir_to_var(self, dir: str, dir_type: str = "spyglass"):
def dir_to_var(self, dir: str, dir_type: str = "spyglass") -> str:
"""Converts a dir string to an env variable name."""
return f"{dir_type.upper()}_{dir.upper()}_DIR"

Expand All @@ -300,7 +300,7 @@ def _generate_dj_config(
database_port: int = 3306,
database_use_tls: bool = True,
**kwargs,
):
) -> dict:
"""Generate a datajoint configuration file.
Parameters
Expand Down Expand Up @@ -345,7 +345,7 @@ def save_dj_config(
base_dir=None,
set_password=True,
**kwargs,
):
) -> None:
"""Set the dj.config parameters, set password, and save config to file.
Parameters
Expand Down
2 changes: 0 additions & 2 deletions tests/utils/test_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ class Mixin(SpyglassMixin, dj.Manual):

yield Mixin

Mixin().drop_quick()


@pytest.mark.skipif(not VERBOSE, reason="No logging to test when quiet-spy.")
def test_bad_prefix(caplog, dj_conn, Mixin):
Expand Down

0 comments on commit a508b57

Please sign in to comment.