Skip to content

Commit

Permalink
Update 'latest' in docs deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
CBroz1 committed Feb 12, 2024
1 parent be6e414 commit abefa36
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 17 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ jobs:
contents: write
issues: write
steps:
- name: Get version
uses: actions/checkout@v3
run: |
echo "MAJOR_VERSION=${GITHUB_REF#refs/*/}" | cut -c1-3 >> $GITHUB_ENV
echo ${{ env.MAJOR_VERSION }}
- name: Checkout repository
uses: actions/checkout@v3
with:
Expand Down
26 changes: 14 additions & 12 deletions docs/build-docs.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/bin/bash
# Run this script from repo root to serve site: > bash ./docs/build-docs.sh serve
# Then, navigate to localhost:8000/ to inspect site, then ctrl+c to exit
# For auto-reload during dev, use `mkdocs serve -f ./docs/mkdosc.yaml`

# For auto-reload during dev, use `mkdocs serve -f ./docs/mkdocs.yaml`

# Copy top-level repo files for docs display
cp ./CHANGELOG.md ./docs/src/
Expand All @@ -14,26 +13,29 @@ mv ./docs/src/notebooks/README.md ./docs/src/notebooks/index.md
cp -r ./notebook-images ./docs/src/notebooks/
cp -r ./notebook-images ./docs/src/

# Get major version
version_line=$(grep "__version__ =" ./src/spyglass/_version.py)
version_string=$(echo "$version_line" | awk -F"[\"']" '{print $2}')
export MAJOR_VERSION="${version_string:0:3}"
echo "$MAJOR_VERSION"
if [ -z "$MAJOR_VERSION" ]; then # Get version from file
version_line=$(grep "__version__ =" ./src/spyglass/_version.py)
version_string=$(echo "$version_line" | awk -F"[\"']" '{print $2}')
export MAJOR_VERSION="${version_string:0:3}"
fi
echo "$MAJOR_VERSION" # May be available as env var

# Get ahead of errors
export JUPYTER_PLATFORM_DIRS=1
# jupyter notebook --generate-config
jupyter notebook --generate-config -y &> /dev/null
jupyter trust ./docs/src/notebooks/*.ipynb &> /dev/null

# Generate site docs
mike deploy "$MAJOR_VERSION" --config ./docs/mkdocs.yml -b documentation
mike deploy "$MAJOR_VERSION" --config ./docs/mkdocs.yml -b documentation \
2>&1 | grep -v 'kernel_spec' # Suppress kernel_spec errors

# Label this version as latest, set as default
mike alias "$MAJOR_VERSION" latest --config ./docs/mkdocs.yml -b documentation
mike set-default latest --config ./docs/mkdocs.yml -b documentation
mike alias "$MAJOR_VERSION" latest -u --config ./docs/mkdocs.yml -b documentation
# mike set-default latest --config ./docs/mkdocs.yml -b documentation

# # Serve site to localhost
if [ "$1" == "serve" ]; then # If first arg is serve, serve docs
mike serve --config ./docs/mkdocs.yml -b documentation
mike serve --config ./docs/mkdocs.yml -b documentation | grep -v 'kernel_spec'
elif [ "$1" == "push" ]; then # if first arg is push
if [ -z "$2" ]; then # When no second arg, use local git user
git_user=$(git config user.name)
Expand Down
3 changes: 2 additions & 1 deletion docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ nav:
- Spikes:
- Spike Sorting V0: notebooks/10_Spike_SortingV0.ipynb
- Spike Sorting V1: notebooks/10_Spike_SortingV1.ipynb
- Curation: notebooks/11_Curation.ipynb
- Curation: notebooks/11_CurationV0.ipynb
- Position:
- Position Trodes: notebooks/20_Position_Trodes.ipynb
- DLC Models: notebooks/21_DLC.ipynb
Expand All @@ -75,6 +75,7 @@ nav:
- Extract Clusterless: notebooks/41_Extracting_Clusterless_Waveform_Features.ipynb
- Decoding Clusterless: notebooks/42_Decoding_Clusterless.ipynb
- Decoding Sorted Spikes: notebooks/43_Decoding_SortedSpikes.ipynb
- MUA Detection: notebooks/51_MUA_Detection.ipynb
- API Reference: api/ # defer to gen-files + literate-nav
- How to Contribute: contribute.md
- Change Log: CHANGELOG.md
Expand Down
11 changes: 11 additions & 0 deletions notebooks/04_PopulateConfigFile.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "68303e8a",
"metadata": {},
"source": [
"# Customizing Data Insertion into Spyglass\n",
Expand Down Expand Up @@ -44,6 +45,7 @@
},
{
"cell_type": "markdown",
"id": "bcc87f67",
"metadata": {},
"source": [
"## Define a Configuration YAML File\n",
Expand Down Expand Up @@ -85,6 +87,7 @@
},
{
"cell_type": "markdown",
"id": "fc6d0986",
"metadata": {},
"source": [
"## Create Entries to Reference in the Configuration YAML\n",
Expand Down Expand Up @@ -145,6 +148,7 @@
},
{
"cell_type": "markdown",
"id": "9d641e00",
"metadata": {},
"source": [
"## Example Ingestion with Real Data\n",
Expand All @@ -171,6 +175,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "37aa5182",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -180,6 +185,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "aab5b47a",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -195,6 +201,7 @@
},
{
"cell_type": "markdown",
"id": "d132e797",
"metadata": {},
"source": [
"Then call `insert_sessions` as usual."
Expand All @@ -203,6 +210,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "bed5c6e1",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -213,6 +221,7 @@
},
{
"cell_type": "markdown",
"id": "d875b158",
"metadata": {},
"source": [
"Confirm the session was inserted with the correct `DataAcquisitionDevice`"
Expand All @@ -221,6 +230,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "8411cb43",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -234,6 +244,7 @@
},
{
"cell_type": "markdown",
"id": "d85b1416",
"metadata": {},
"source": []
}
Expand Down
4 changes: 2 additions & 2 deletions src/spyglass/utils/dj_chains.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def objects(self) -> List[dj.FreeTable]:
)

def join(
self, restricton: str = None, reverse_order: bool = False
self, restriction: str = None, reverse_order: bool = False
) -> dj.expression.QueryExpression:
"""Return join of tables in chain with restriction applied to parent.
Expand All @@ -237,7 +237,7 @@ def join(
return None

objects = self.objects[::-1] if reverse_order else self.objects
restriction = restricton or self.parent.restriction or True
restriction = restriction or self.parent.restriction or True
join = objects[0] & restriction
for table in objects[1:]:
try:
Expand Down
4 changes: 2 additions & 2 deletions src/spyglass/utils/dj_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class SpyglassMixin:
a NWBFile table (including AnalysisNwbfile) or a _nwb_table attribute to
determine which table to use.
delte_downstream_merge(restriction=None, dry_run=True, reload_cache=False)
Delete downstream merge table entries associated with restricton.
Delete downstream merge table entries associated with restriction.
Requires caching of merge tables and links, which is slow on first call.
`restriction` can be set to a string to restrict the delete. `dry_run`
can be set to False to commit the delete. `reload_cache` can be set to
Expand Down Expand Up @@ -178,7 +178,7 @@ def delete_downstream_merge(
return_parts: bool = True,
**kwargs,
) -> Union[List[QueryExpression], Dict[str, List[QueryExpression]]]:
"""Delete downstream merge table entries associated with restricton.
"""Delete downstream merge table entries associated with restriction.
Requires caching of merge tables and links, which is slow on first call.
Expand Down

0 comments on commit abefa36

Please sign in to comment.