obkit 0.0.2__tar.gz → 0.0.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: obkit
3
- Version: 0.0.2
3
+ Version: 0.0.4
4
4
  Summary: Utility toolkit for omnibenchmark modules and Snakemake workflows
5
5
  Author: Omnibenchmark Contributors
6
6
  License: MIT License
@@ -83,7 +83,7 @@ emit("align", "start")
83
83
  emit("align", "end", attrs={"reads": 12345})
84
84
  ```
85
85
 
86
- Events are written to `omnibench-events.jsonl` inside the directory passed to
86
+ Events are written to `obkit-events.jsonl` inside the directory passed to
87
87
  `init_logger`. See the [wire format spec](https://github.com/omnibenchmark/obkit/blob/main/docs/spec-logger.md)
88
88
  for the record schema.
89
89
 
@@ -29,7 +29,7 @@ emit("align", "start")
29
29
  emit("align", "end", attrs={"reads": 12345})
30
30
  ```
31
31
 
32
- Events are written to `omnibench-events.jsonl` inside the directory passed to
32
+ Events are written to `obkit-events.jsonl` inside the directory passed to
33
33
  `init_logger`. See the [wire format spec](https://github.com/omnibenchmark/obkit/blob/main/docs/spec-logger.md)
34
34
  for the record schema.
35
35
 
@@ -3,6 +3,7 @@ import os
3
3
  import socket
4
4
  import sys
5
5
  from datetime import datetime, timezone
6
+ from pathlib import Path
6
7
 
7
8
  _state = {
8
9
  "log_file": None,
@@ -11,10 +12,10 @@ _state = {
11
12
 
12
13
 
13
14
  def init_logger(path):
14
- if not isinstance(path, str) or not path:
15
- raise ValueError("init_logger(): 'path' must be a non-empty string")
15
+ if not isinstance(path, (str, Path)) or not str(path):
16
+ raise ValueError("init_logger(): 'path' must be a non-empty string or Path")
16
17
  os.makedirs(path, exist_ok=True)
17
- log_file = os.path.join(os.path.realpath(path), "omnibench-events.jsonl")
18
+ log_file = os.path.join(os.path.realpath(path), "obkit-events.jsonl")
18
19
  _state["log_file"] = log_file
19
20
  _state["warned_uninit"] = False
20
21
  return log_file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: obkit
3
- Version: 0.0.2
3
+ Version: 0.0.4
4
4
  Summary: Utility toolkit for omnibenchmark modules and Snakemake workflows
5
5
  Author: Omnibenchmark Contributors
6
6
  License: MIT License
@@ -83,7 +83,7 @@ emit("align", "start")
83
83
  emit("align", "end", attrs={"reads": 12345})
84
84
  ```
85
85
 
86
- Events are written to `omnibench-events.jsonl` inside the directory passed to
86
+ Events are written to `obkit-events.jsonl` inside the directory passed to
87
87
  `init_logger`. See the [wire format spec](https://github.com/omnibenchmark/obkit/blob/main/docs/spec-logger.md)
88
88
  for the record schema.
89
89
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "obkit"
7
- version = "0.0.2"
7
+ version = "0.0.4"
8
8
  description = "Utility toolkit for omnibenchmark modules and Snakemake workflows"
9
9
  readme = "README.md"
10
10
  license = { file = "LICENSE" }
@@ -1,5 +1,6 @@
1
1
  import os
2
2
  import tempfile
3
+ from pathlib import Path
3
4
 
4
5
  import pytest
5
6
 
@@ -12,7 +13,16 @@ def test_init_logger_creates_missing_directory_and_returns_log_path():
12
13
  assert not os.path.exists(d)
13
14
  p = init_logger(d)
14
15
  assert os.path.isdir(d)
15
- assert os.path.basename(p) == "omnibench-events.jsonl"
16
+ assert os.path.basename(p) == "obkit-events.jsonl"
17
+
18
+
19
+ def test_init_logger_accepts_path_object():
20
+ with tempfile.TemporaryDirectory() as base:
21
+ d = Path(base) / "path-subdir"
22
+ assert not d.exists()
23
+ p = init_logger(d)
24
+ assert d.is_dir()
25
+ assert os.path.basename(p) == "obkit-events.jsonl"
16
26
 
17
27
 
18
28
  def test_init_logger_rejects_bad_input():
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes