labnotes 0.0.6__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.6 → labnotes-0.0.8}/PKG-INFO +1 -1
  2. labnotes-0.0.8/src/labnotes/asset_url.py +19 -0
  3. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/create_app.py +2 -0
  4. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/static/labnotes.css +1 -2
  5. labnotes-0.0.8/src/labnotes/static/row-link.js +9 -0
  6. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/templates/base.html +1 -1
  7. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/templates/index.html +2 -1
  8. {labnotes-0.0.6 → labnotes-0.0.8}/uv.lock +0 -3
  9. {labnotes-0.0.6 → labnotes-0.0.8}/.gitignore +0 -0
  10. {labnotes-0.0.6 → labnotes-0.0.8}/CHANGELOG.md +0 -0
  11. {labnotes-0.0.6 → labnotes-0.0.8}/MIGRATIONS.md +0 -0
  12. {labnotes-0.0.6 → labnotes-0.0.8}/README.md +0 -0
  13. {labnotes-0.0.6 → labnotes-0.0.8}/pyproject.toml +0 -0
  14. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/__init__.py +0 -0
  15. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/cell_progress.py +0 -0
  16. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/cli.py +0 -0
  17. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/count_runs.py +0 -0
  18. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/drain_watch.py +0 -0
  19. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/dump_experiments.py +0 -0
  20. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/format_value.py +0 -0
  21. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/list_experiments.py +0 -0
  22. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/list_runs.py +0 -0
  23. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/load_experiment.py +0 -0
  24. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/models.py +0 -0
  25. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/open_experiments.py +0 -0
  26. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/open_runs.py +0 -0
  27. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/parse_run_view.py +0 -0
  28. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/pivot_cells.py +0 -0
  29. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/read_design.py +0 -0
  30. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/read_note.py +0 -0
  31. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/render_markdown.py +0 -0
  32. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/run_columns.py +0 -0
  33. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/serve_app.py +0 -0
  34. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/sort_href.py +0 -0
  35. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/sql_quote.py +0 -0
  36. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/static/view-toggle.js +0 -0
  37. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/study_progress.py +0 -0
  38. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/summarize_design.py +0 -0
  39. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/templates/experiment.html +0 -0
  40. {labnotes-0.0.6 → labnotes-0.0.8}/src/labnotes/templates/macros.html +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: labnotes
3
- Version: 0.0.6
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:
@@ -163,9 +163,8 @@ h3 {
163
163
  }
164
164
  .ledger td { padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--rule); vertical-align: middle; }
165
165
  .ledger tbody tr:last-child td { border-bottom: 0; }
166
- .ledger tbody tr { position: relative; cursor: pointer; }
166
+ .ledger tbody tr { cursor: pointer; }
167
167
  .ledger tbody tr:hover { background: color-mix(in srgb, var(--accent) 4%, transparent); }
168
- .ledger .title-link::after { content: ""; position: absolute; inset: 0; }
169
168
  .ledger .num { text-align: right; }
170
169
  .ledger th.num { text-align: right; }
171
170
 
@@ -0,0 +1,9 @@
1
+ // Safari ignores position: relative on <tr>, so a stretched ::after link covers the whole page.
2
+ for (const row of document.querySelectorAll(".ledger tbody tr")) {
3
+ const link = row.querySelector(".title-link");
4
+ row.addEventListener("click", (event) => {
5
+ if (event.target.closest("a") || getSelection().toString()) return;
6
+ if (event.metaKey || event.ctrlKey) window.open(link.href, "_blank");
7
+ else location.href = link.href;
8
+ });
9
+ }
@@ -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,7 +49,8 @@
49
49
  {% endfor %}
50
50
  </tbody>
51
51
  </table>
52
- <script src="{{ url_for('static', path='view-toggle.js') }}" defer></script>
52
+ <script src="{{ asset('view-toggle.js') }}" defer></script>
53
+ <script src="{{ asset('row-link.js') }}" defer></script>
53
54
  {% else %}
54
55
  <p class="empty">No experiments found. Each experiment is a folder holding a <code>design.yaml</code> and its markdown notes.</p>
55
56
  {% endif %}
@@ -10,9 +10,6 @@ resolution-markers = [
10
10
  exclude-newer = "0001-01-01T00:00:00Z" # This has no effect and is included for backwards compatibility when using relative exclude-newer values.
11
11
  exclude-newer-span = "P3D"
12
12
 
13
- [options.exclude-newer-package]
14
- labnotes = { timestamp = "0001-01-01T00:00:00Z", span = "PT0S" }
15
-
16
13
  [[package]]
17
14
  name = "anyio"
18
15
  version = "4.15.1"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes