Skip to content

Commit

Permalink
Add a Jupyter notebook example
Browse files Browse the repository at this point in the history
  • Loading branch information
manthey committed Aug 30, 2023
1 parent cc39996 commit e8b2daa
Show file tree
Hide file tree
Showing 9 changed files with 896 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ jobs:
executor: toxandnode
steps:
- checkout
- run:
name: Install dependencies
command: apt-get update -yq && apt-get install -yq pandoc && pandoc --version
- tox:
env: docs,lint,lintclient
- store_artifacts:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,5 @@ docs/source/*
.pre-commit-config.yaml

*.ipynb
!docs/*.ipynb
NOTES.md
4 changes: 3 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
'sphinx.ext.todo',
'sphinx.ext.viewcode',
'sphinxcontrib.jquery',
'IPython.sphinxext.ipython_console_highlighting',
'nbsphinx',
]

# Add any paths that contain templates here, relative to this directory.
Expand All @@ -50,7 +52,7 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []
exclude_patterns = ['_build/**.ipynb', '**.ipynb_checkpoints']


# -- Options for HTML output -------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
_build/girder_large_image_annotation/modules
girder_annotation_config_options
annotations
notebooks
development


Expand Down
866 changes: 866 additions & 0 deletions docs/large_image_examples.ipynb

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions docs/notebooks.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
=========================
Jupyter Notebook Examples
=========================

large_image is often used inside Jupyter notebooks.

.. toctree::
:maxdepth: 1

./large_image_examples.ipynb
4 changes: 2 additions & 2 deletions large_image/cache_util/cachefactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def getFirstAvailableCache():
except TileCacheError:
continue
if cache is not None:
config.getConfig('logprint').info(
config.getConfig('logprint').debug(
f'Automatically setting `{cacheBackend}` as cache_backend from availableCaches',
)
config.setConfig('cache_backend', cacheBackend)
Expand Down Expand Up @@ -169,7 +169,7 @@ def getCache(self, numItems=None, cacheName=None, inProcess=False):
cacheLock = threading.Lock()

if not inProcess and not CacheFactory.logged:
config.getConfig('logprint').info(f'Using {cacheBackend} for large_image caching')
config.getConfig('logprint').debug(f'Using {cacheBackend} for large_image caching')
CacheFactory.logged = True

return cache, cacheLock
8 changes: 7 additions & 1 deletion ruff.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include = ["*.py", "*.pyi", "**/pyproject.toml", "*.ipynb"]
exclude = [
"build",
"docs",
"*/web_client/*",
"*/*egg*/*",
]
Expand Down Expand Up @@ -56,6 +56,12 @@ select = [
"RSE",
]

[per-file-ignores]
# allow "useless expressions" as it shows output
# allow non-top level imports
# allow long lines
"docs/large_image_examples.ipynb" = ["B018", "E402", "E501"]

[flake8-quotes]
inline-quotes = "single"

Expand Down
3 changes: 3 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ commands = {[testenv:dev]commands}
description = Build documentation
deps =
-rrequirements-test.txt
jupyter
nbsphinx
pypandoc
sphinx
sphinx-rtd-theme
sphinxcontrib-jquery
Expand Down

0 comments on commit e8b2daa

Please sign in to comment.