sparknh-reader 0.1.0__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 (28) hide show
  1. sparknh_reader-0.1.0/LICENSE +167 -0
  2. sparknh_reader-0.1.0/PKG-INFO +114 -0
  3. sparknh_reader-0.1.0/README.md +99 -0
  4. sparknh_reader-0.1.0/pyproject.toml +54 -0
  5. sparknh_reader-0.1.0/pyproject.toml.orig +47 -0
  6. sparknh_reader-0.1.0/src/sparknh_reader/__init__.py +30 -0
  7. sparknh_reader-0.1.0/src/sparknh_reader/__main__.py +5 -0
  8. sparknh_reader-0.1.0/src/sparknh_reader/cli.py +198 -0
  9. sparknh_reader-0.1.0/src/sparknh_reader/icons/icon.ico +0 -0
  10. sparknh_reader-0.1.0/src/sparknh_reader/icons/icon.svg +5 -0
  11. sparknh_reader-0.1.0/src/sparknh_reader/keys.py +46 -0
  12. sparknh_reader-0.1.0/src/sparknh_reader/mod_packages.toml +326 -0
  13. sparknh_reader-0.1.0/src/sparknh_reader/qt/__init__.py +1 -0
  14. sparknh_reader-0.1.0/src/sparknh_reader/qt/app.py +280 -0
  15. sparknh_reader-0.1.0/src/sparknh_reader/qt/asyncloop.py +49 -0
  16. sparknh_reader-0.1.0/src/sparknh_reader/qt/host.py +31 -0
  17. sparknh_reader-0.1.0/src/sparknh_reader/qt/settings.py +296 -0
  18. sparknh_reader-0.1.0/src/sparknh_reader/qt/theme.py +165 -0
  19. sparknh_reader-0.1.0/src/sparknh_reader/qt/widgets.py +909 -0
  20. sparknh_reader-0.1.0/src/sparknh_reader/qt/window.py +1522 -0
  21. sparknh_reader-0.1.0/src/sparknh_reader/shortcut.py +260 -0
  22. sparknh_reader-0.1.0/src/sparknh_reader/skill/SKILL.md +61 -0
  23. sparknh_reader-0.1.0/src/sparknh_reader/skill/command.md +10 -0
  24. sparknh_reader-0.1.0/src/sparknh_reader/skill/spark.py +76 -0
  25. sparknh_reader-0.1.0/src/sparknh_reader/skill_install.py +159 -0
  26. sparknh_reader-0.1.0/src/sparknh_reader/spark.py +2069 -0
  27. sparknh_reader-0.1.0/src/sparknh_reader/update.py +317 -0
  28. sparknh_reader-0.1.0/src/sparknh_reader/update_helper.py +75 -0
@@ -0,0 +1,167 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
166
+
167
+
@@ -0,0 +1,114 @@
1
+ Metadata-Version: 2.4
2
+ Name: sparknh-reader
3
+ Version: 0.1.0
4
+ Summary: Read spark profiles (spark.lucko.me) of GT New Horizons servers and clients as text reports and in a desktop UI
5
+ License-Expression: LGPL-3.0-only
6
+ License-File: LICENSE
7
+ Requires-Dist: platformdirs>=4.14.5
8
+ Requires-Dist: typer>=0.29.1
9
+ Requires-Dist: pyside6-essentials>=6.12.0 ; extra == 'desktop'
10
+ Requires-Dist: textual>=8.2.8 ; extra == 'desktop'
11
+ Requires-Python: >=3.12
12
+ Project-URL: Repository, https://github.com/GTNewHorizons/SparkNH-Reader
13
+ Provides-Extra: desktop
14
+ Description-Content-Type: text/markdown
15
+
16
+ # SparkNH Reader
17
+
18
+ Reads [spark](https://spark.lucko.me) profiles of GT New Horizons servers and clients, in a desktop app or on the
19
+ command line: a spark link, its code, or a `.sparkprofile`, `.sparkheap` or `.sparkhealth` file. It shows an
20
+ overview with findings, call trees and tables, and writes a short text report that people and LLMs can both read.
21
+ It also reads the extra data [SparkNH](https://github.com/GTNewHorizons/sparkNH) records, which the spark web viewer
22
+ doesn't show.
23
+
24
+ How to read what it shows: [docs/Spark-Profiles.md](docs/Spark-Profiles.md).
25
+
26
+ ## Install
27
+
28
+ It needs [uv](https://docs.astral.sh/uv/) (`winget install astral-sh.uv` on Windows, `brew install uv` on macOS),
29
+ which also fetches Python.
30
+
31
+ The desktop app (downloads Qt, about 150 MB, the first time):
32
+
33
+ ```
34
+ uv tool install "sparknh-reader[desktop]"
35
+ sparknh-reader-desktop
36
+ ```
37
+
38
+ At its first start it offers to add itself to the Start menu (Windows) or the app menu (Linux).
39
+ `sparknh-reader-desktop LINK_OR_FILE` opens that profile straight away. On Linux, Qt needs `libxcb-cursor0`.
40
+
41
+ Without uv, `pipx install "sparknh-reader[desktop]"` works too, with Python 3.12 or newer (the app's updates then
42
+ show the command to run instead of updating themselves).
43
+
44
+ The command line only, nothing to install:
45
+
46
+ ```
47
+ uvx sparknh-reader summary https://spark.lucko.me/XXXXXXXXXX
48
+ ```
49
+
50
+ ## Commands
51
+
52
+ | Command | What it does |
53
+ |---|---|
54
+ | `summary SOURCE` | The report: setup, findings, worst minutes, entities, where the time goes; for a heap summary, what fills memory |
55
+ | `tree SOURCE METHOD` | What a method calls, all its call sites merged |
56
+ | `callers SOURCE METHOD` | Who calls a method |
57
+ | `compare EARLIER LATER` | What grew between two heap summaries |
58
+ | `install-skill` | The `spark-profile` skill for Claude Code, Codex and OpenCode |
59
+ | `install-shortcut [--remove]` | The Start menu or app menu entry |
60
+ | `update [--check]` | Install the newest version, or only say whether there is one |
61
+
62
+ `--help` after any command lists its options.
63
+
64
+ ## Settings and updates
65
+
66
+ The ⚙ button next to Load sets the theme, the text size and the keys, adds or removes the menu entry, and installs
67
+ the skill for coding agents. Changes apply at once and are kept in `config.toml` in the user's config folder (`%LOCALAPPDATA%\sparknh-reader` on
68
+ Windows, `~/.config/sparknh-reader` on Linux, `~/Library/Application Support/sparknh-reader` on macOS):
69
+
70
+ ```toml
71
+ theme = "nord" # a Textual theme name (textual-dark, nord, dracula, gruvbox, ...), or "system"
72
+ font_size = 12 # points
73
+ check_updates = false # don't look for a newer version at start
74
+ [keys]
75
+ spark_callers = "k" # an action id from src/sparknh_reader/keys.py -> its letter
76
+ ```
77
+
78
+ At start, at most once a day, the app looks for a newer version (on PyPI, else in the GitHub releases) and offers it in a bar: What's new, Update, or Skip this version.
79
+
80
+ - **Update** works for a `uv tool install`: the app closes, installs the new version the same way, and starts
81
+ again. If that fails, the next start shows uv's log.
82
+ - **Any other install** (a checkout, pip, uvx) shows the command to run instead.
83
+
84
+ ## Development
85
+
86
+ ```
87
+ uv sync --extra desktop
88
+ uv run pytest
89
+ uv run ruff check . && uv run ruff format --check .
90
+ ```
91
+
92
+ - **PyCharm:** run configurations in `.run/`: Desktop UI, Summary (asks for a link or file) and Tests.
93
+ - **`scripts/gen_mod_packages.py`:** regenerates the package → mod table from a pack's jars.
94
+ - **`scripts/gen_icon.py`:** regenerates `icons/icon.ico`, the Windows shortcut's icon, from `icons/icon.svg`.
95
+
96
+ ## Releasing
97
+
98
+ CI (`.github/workflows/build-and-test.yml`) lints and tests every push and pull request on Windows, Linux and
99
+ macOS.
100
+
101
+ To release, push a tag named as the version, as GTNH mods do: `1.0.0`, or `1.1.0-pre` / `1.1.0rc1` for a
102
+ prerelease. The tag must be a [PEP 440](https://peps.python.org/pep-0440/) version, so `-snapshot` doesn't work.
103
+
104
+ - **What happens:** `release-tags.yml` builds the wheel with that version and attaches it to a GitHub release.
105
+ - **Release notes:** from `.changelogs/<tag>.md` when it exists, else GitHub generates them.
106
+ - **`pyproject.toml`:** its version only matters for builds between releases.
107
+
108
+ Each release is also published to [PyPI](https://pypi.org/project/sparknh-reader/), through trusted publishing (no
109
+ token stored): its `publish-pypi` job waits for a reviewer to approve the `pypi` environment. The repo variable
110
+ `PUBLISH_PYPI` switches that job on.
111
+
112
+ ## License
113
+
114
+ LGPL-3.0-only.
@@ -0,0 +1,99 @@
1
+ # SparkNH Reader
2
+
3
+ Reads [spark](https://spark.lucko.me) profiles of GT New Horizons servers and clients, in a desktop app or on the
4
+ command line: a spark link, its code, or a `.sparkprofile`, `.sparkheap` or `.sparkhealth` file. It shows an
5
+ overview with findings, call trees and tables, and writes a short text report that people and LLMs can both read.
6
+ It also reads the extra data [SparkNH](https://github.com/GTNewHorizons/sparkNH) records, which the spark web viewer
7
+ doesn't show.
8
+
9
+ How to read what it shows: [docs/Spark-Profiles.md](docs/Spark-Profiles.md).
10
+
11
+ ## Install
12
+
13
+ It needs [uv](https://docs.astral.sh/uv/) (`winget install astral-sh.uv` on Windows, `brew install uv` on macOS),
14
+ which also fetches Python.
15
+
16
+ The desktop app (downloads Qt, about 150 MB, the first time):
17
+
18
+ ```
19
+ uv tool install "sparknh-reader[desktop]"
20
+ sparknh-reader-desktop
21
+ ```
22
+
23
+ At its first start it offers to add itself to the Start menu (Windows) or the app menu (Linux).
24
+ `sparknh-reader-desktop LINK_OR_FILE` opens that profile straight away. On Linux, Qt needs `libxcb-cursor0`.
25
+
26
+ Without uv, `pipx install "sparknh-reader[desktop]"` works too, with Python 3.12 or newer (the app's updates then
27
+ show the command to run instead of updating themselves).
28
+
29
+ The command line only, nothing to install:
30
+
31
+ ```
32
+ uvx sparknh-reader summary https://spark.lucko.me/XXXXXXXXXX
33
+ ```
34
+
35
+ ## Commands
36
+
37
+ | Command | What it does |
38
+ |---|---|
39
+ | `summary SOURCE` | The report: setup, findings, worst minutes, entities, where the time goes; for a heap summary, what fills memory |
40
+ | `tree SOURCE METHOD` | What a method calls, all its call sites merged |
41
+ | `callers SOURCE METHOD` | Who calls a method |
42
+ | `compare EARLIER LATER` | What grew between two heap summaries |
43
+ | `install-skill` | The `spark-profile` skill for Claude Code, Codex and OpenCode |
44
+ | `install-shortcut [--remove]` | The Start menu or app menu entry |
45
+ | `update [--check]` | Install the newest version, or only say whether there is one |
46
+
47
+ `--help` after any command lists its options.
48
+
49
+ ## Settings and updates
50
+
51
+ The ⚙ button next to Load sets the theme, the text size and the keys, adds or removes the menu entry, and installs
52
+ the skill for coding agents. Changes apply at once and are kept in `config.toml` in the user's config folder (`%LOCALAPPDATA%\sparknh-reader` on
53
+ Windows, `~/.config/sparknh-reader` on Linux, `~/Library/Application Support/sparknh-reader` on macOS):
54
+
55
+ ```toml
56
+ theme = "nord" # a Textual theme name (textual-dark, nord, dracula, gruvbox, ...), or "system"
57
+ font_size = 12 # points
58
+ check_updates = false # don't look for a newer version at start
59
+ [keys]
60
+ spark_callers = "k" # an action id from src/sparknh_reader/keys.py -> its letter
61
+ ```
62
+
63
+ At start, at most once a day, the app looks for a newer version (on PyPI, else in the GitHub releases) and offers it in a bar: What's new, Update, or Skip this version.
64
+
65
+ - **Update** works for a `uv tool install`: the app closes, installs the new version the same way, and starts
66
+ again. If that fails, the next start shows uv's log.
67
+ - **Any other install** (a checkout, pip, uvx) shows the command to run instead.
68
+
69
+ ## Development
70
+
71
+ ```
72
+ uv sync --extra desktop
73
+ uv run pytest
74
+ uv run ruff check . && uv run ruff format --check .
75
+ ```
76
+
77
+ - **PyCharm:** run configurations in `.run/`: Desktop UI, Summary (asks for a link or file) and Tests.
78
+ - **`scripts/gen_mod_packages.py`:** regenerates the package → mod table from a pack's jars.
79
+ - **`scripts/gen_icon.py`:** regenerates `icons/icon.ico`, the Windows shortcut's icon, from `icons/icon.svg`.
80
+
81
+ ## Releasing
82
+
83
+ CI (`.github/workflows/build-and-test.yml`) lints and tests every push and pull request on Windows, Linux and
84
+ macOS.
85
+
86
+ To release, push a tag named as the version, as GTNH mods do: `1.0.0`, or `1.1.0-pre` / `1.1.0rc1` for a
87
+ prerelease. The tag must be a [PEP 440](https://peps.python.org/pep-0440/) version, so `-snapshot` doesn't work.
88
+
89
+ - **What happens:** `release-tags.yml` builds the wheel with that version and attaches it to a GitHub release.
90
+ - **Release notes:** from `.changelogs/<tag>.md` when it exists, else GitHub generates them.
91
+ - **`pyproject.toml`:** its version only matters for builds between releases.
92
+
93
+ Each release is also published to [PyPI](https://pypi.org/project/sparknh-reader/), through trusted publishing (no
94
+ token stored): its `publish-pypi` job waits for a reviewer to approve the `pypi` environment. The repo variable
95
+ `PUBLISH_PYPI` switches that job on.
96
+
97
+ ## License
98
+
99
+ LGPL-3.0-only.
@@ -0,0 +1,54 @@
1
+ [project]
2
+ name = "sparknh-reader"
3
+ version = "0.1.0"
4
+ description = "Read spark profiles (spark.lucko.me) of GT New Horizons servers and clients as text reports and in a desktop UI"
5
+ readme = "README.md"
6
+ license = "LGPL-3.0-only"
7
+ license-files = ["LICENSE"]
8
+ requires-python = ">=3.12"
9
+ dependencies = [
10
+ "platformdirs>=4.14.5",
11
+ "typer>=0.29.1",
12
+ ]
13
+
14
+ [project.urls]
15
+ Repository = "https://github.com/GTNewHorizons/SparkNH-Reader"
16
+
17
+ [project.scripts]
18
+ sparknh-reader = "sparknh_reader.cli:app"
19
+
20
+ [project.gui-scripts]
21
+ sparknh-reader-desktop = "sparknh_reader.qt.app:main"
22
+
23
+ [project.optional-dependencies]
24
+ desktop = [
25
+ "pyside6-essentials>=6.12.0",
26
+ "textual>=8.2.8",
27
+ ]
28
+
29
+ [build-system]
30
+ requires = ["uv_build>=0.11,<0.12"]
31
+ build-backend = "uv_build"
32
+
33
+ [tool.ruff]
34
+ line-length = 120
35
+ src = ["src"]
36
+
37
+ [tool.ruff.lint]
38
+ select = [
39
+ "E",
40
+ "W",
41
+ "F",
42
+ "I",
43
+ "UP",
44
+ "B",
45
+ ]
46
+
47
+ [tool.pytest.ini_options]
48
+ testpaths = ["tests"]
49
+
50
+ [dependency-groups]
51
+ dev = [
52
+ "pytest>=9.2.0",
53
+ "ruff>=0.17.5",
54
+ ]
@@ -0,0 +1,47 @@
1
+ [project]
2
+ name = "sparknh-reader"
3
+ version = "0.1.0"
4
+ description = "Read spark profiles (spark.lucko.me) of GT New Horizons servers and clients as text reports and in a desktop UI"
5
+ readme = "README.md"
6
+ license = "LGPL-3.0-only"
7
+ license-files = ["LICENSE"]
8
+ requires-python = ">=3.12"
9
+ dependencies = [
10
+ "platformdirs>=4.14.5",
11
+ "typer>=0.29.1",
12
+ ]
13
+
14
+ [project.urls]
15
+ Repository = "https://github.com/GTNewHorizons/SparkNH-Reader"
16
+
17
+ [project.scripts]
18
+ sparknh-reader = "sparknh_reader.cli:app"
19
+
20
+ [project.gui-scripts]
21
+ sparknh-reader-desktop = "sparknh_reader.qt.app:main" # needs the desktop extra
22
+
23
+ [project.optional-dependencies]
24
+ desktop = [
25
+ "pyside6-essentials>=6.12.0",
26
+ "textual>=8.2.8", # the theme colours: Textual's built-in themes
27
+ ]
28
+
29
+ [build-system]
30
+ requires = ["uv_build>=0.11,<0.12"]
31
+ build-backend = "uv_build"
32
+
33
+ [tool.ruff]
34
+ line-length = 120
35
+ src = ["src"]
36
+
37
+ [tool.ruff.lint]
38
+ select = ["E", "W", "F", "I", "UP", "B"]
39
+
40
+ [tool.pytest.ini_options]
41
+ testpaths = ["tests"]
42
+
43
+ [dependency-groups]
44
+ dev = [
45
+ "pytest>=9.2.0",
46
+ "ruff>=0.17.5",
47
+ ]
@@ -0,0 +1,30 @@
1
+ """The spark reader: spark.lucko.me profiles as text reports and a desktop window, GTNH-aware.
2
+
3
+ It imports nothing of the app around it: a host passes its name and cache folder with configure().
4
+ """
5
+
6
+ from collections.abc import Callable
7
+ from pathlib import Path
8
+
9
+ _app_name = "sparknh-reader"
10
+ _cache_dir: Callable[[], Path] | None = None
11
+
12
+
13
+ def configure(app_name: str, cache_dir: Path | Callable[[], Path]) -> None:
14
+ """The name sent as User-Agent, and the folder for downloads and saved profiles (a path, or a function asked
15
+ each time)."""
16
+ global _app_name, _cache_dir
17
+ _app_name = app_name
18
+ _cache_dir = cache_dir if callable(cache_dir) else lambda: cache_dir
19
+
20
+
21
+ def app_name() -> str:
22
+ return _app_name
23
+
24
+
25
+ def cache_dir() -> Path:
26
+ if _cache_dir is not None:
27
+ return _cache_dir()
28
+ from platformdirs import user_cache_dir
29
+
30
+ return Path(user_cache_dir(_app_name, appauthor=False))
@@ -0,0 +1,5 @@
1
+ """python -m sparknh_reader: the same as the sparknh-reader command."""
2
+
3
+ from .cli import app
4
+
5
+ app()