labnotes 0.0.7__tar.gz → 0.0.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. {labnotes-0.0.7 → labnotes-0.0.8}/PKG-INFO +1 -1
  2. labnotes-0.0.8/src/labnotes/asset_url.py +19 -0
  3. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/create_app.py +2 -0
  4. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/templates/base.html +1 -1
  5. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/templates/index.html +2 -2
  6. {labnotes-0.0.7 → labnotes-0.0.8}/.gitignore +0 -0
  7. {labnotes-0.0.7 → labnotes-0.0.8}/CHANGELOG.md +0 -0
  8. {labnotes-0.0.7 → labnotes-0.0.8}/MIGRATIONS.md +0 -0
  9. {labnotes-0.0.7 → labnotes-0.0.8}/README.md +0 -0
  10. {labnotes-0.0.7 → labnotes-0.0.8}/pyproject.toml +0 -0
  11. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/__init__.py +0 -0
  12. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/cell_progress.py +0 -0
  13. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/cli.py +0 -0
  14. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/count_runs.py +0 -0
  15. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/drain_watch.py +0 -0
  16. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/dump_experiments.py +0 -0
  17. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/format_value.py +0 -0
  18. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/list_experiments.py +0 -0
  19. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/list_runs.py +0 -0
  20. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/load_experiment.py +0 -0
  21. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/models.py +0 -0
  22. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/open_experiments.py +0 -0
  23. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/open_runs.py +0 -0
  24. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/parse_run_view.py +0 -0
  25. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/pivot_cells.py +0 -0
  26. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/read_design.py +0 -0
  27. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/read_note.py +0 -0
  28. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/render_markdown.py +0 -0
  29. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/run_columns.py +0 -0
  30. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/serve_app.py +0 -0
  31. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/sort_href.py +0 -0
  32. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/sql_quote.py +0 -0
  33. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/static/labnotes.css +0 -0
  34. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/static/row-link.js +0 -0
  35. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/static/view-toggle.js +0 -0
  36. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/study_progress.py +0 -0
  37. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/summarize_design.py +0 -0
  38. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/templates/experiment.html +0 -0
  39. {labnotes-0.0.7 → labnotes-0.0.8}/src/labnotes/templates/macros.html +0 -0
  40. {labnotes-0.0.7 → labnotes-0.0.8}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: labnotes
3
- Version: 0.0.7
3
+ Version: 0.0.8
4
4
  Summary: Browse experiment designs, notes, and run data from a folder.
5
5
  Project-URL: Repository, https://github.com/thekevinscott/labnotes
6
6
  Author-email: Kevin Scott <me@thekevinscott.com>
@@ -0,0 +1,19 @@
1
+ import hashlib
2
+ from functools import cache
3
+ from pathlib import Path
4
+ from typing import Any
5
+
6
+ from jinja2 import pass_context
7
+
8
+ STATIC = Path(__file__).parent / "static"
9
+
10
+
11
+ @cache
12
+ def _digest(path: str) -> str:
13
+ return hashlib.sha256((STATIC / path).read_bytes()).hexdigest()[:12]
14
+
15
+
16
+ @pass_context
17
+ def asset_url(context: Any, path: str) -> str:
18
+ # Browsers (Safari especially) hold onto static files across releases.
19
+ return f"{context['request'].url_for('static', path=path)}?v={_digest(path)}"
@@ -12,6 +12,7 @@ from starlette.routing import Mount, Route
12
12
  from starlette.staticfiles import StaticFiles
13
13
  from starlette.templating import Jinja2Templates
14
14
 
15
+ from labnotes.asset_url import asset_url
15
16
  from labnotes.drain_watch import drain_watch
16
17
  from labnotes.format_value import format_value
17
18
  from labnotes.list_experiments import list_experiments
@@ -23,6 +24,7 @@ from labnotes.pivot_cells import pivot_cells
23
24
  HERE = Path(__file__).parent
24
25
  templates = Jinja2Templates(directory=HERE / "templates")
25
26
  templates.env.filters["value"] = format_value
27
+ templates.env.globals["asset"] = asset_url
26
28
 
27
29
 
28
30
  def create_app(experiments_folder: Path, data_folder: Path) -> Starlette:
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1">
6
6
  <meta name="color-scheme" content="light dark">
7
7
  <title>{% block title %}labnotes{% endblock %}</title>
8
- <link rel="stylesheet" href="{{ url_for('static', path='labnotes.css') }}">
8
+ <link rel="stylesheet" href="{{ asset('labnotes.css') }}">
9
9
  </head>
10
10
  <body>
11
11
  <header class="masthead">
@@ -49,8 +49,8 @@
49
49
  {% endfor %}
50
50
  </tbody>
51
51
  </table>
52
- <script src="{{ url_for('static', path='view-toggle.js') }}" defer></script>
53
- <script src="{{ url_for('static', path='row-link.js') }}" defer></script>
52
+ <script src="{{ asset('view-toggle.js') }}" defer></script>
53
+ <script src="{{ asset('row-link.js') }}" defer></script>
54
54
  {% else %}
55
55
  <p class="empty">No experiments found. Each experiment is a folder holding a <code>design.yaml</code> and its markdown notes.</p>
56
56
  {% endif %}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes