From f29e8e9f20c9b129f2fb64a5078cd0fa4e42480d Mon Sep 17 00:00:00 2001
From: paul019 <39464035+paul019@users.noreply.github.com>
Date: Thu, 11 Apr 2024 22:42:01 +0200
Subject: [PATCH 01/10] In `results.tex`, change `withoutError` to
`withoutUncert` to be consistent
---
src/application/latex_commandifier.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/application/latex_commandifier.py b/src/application/latex_commandifier.py
index 0b06f193..e43d2be3 100644
--- a/src/application/latex_commandifier.py
+++ b/src/application/latex_commandifier.py
@@ -28,7 +28,7 @@ def result_to_latex_cmd(self, result: Result) -> str:
# Without error
if len(result.uncertainties) > 0:
- builder.add_branch("withoutError", self.result_to_latex_str_without_error(result))
+ builder.add_branch("withoutUncert", self.result_to_latex_str_without_uncert(result))
# Single uncertainties
for i, u in enumerate(result.uncertainties):
@@ -82,7 +82,7 @@ def result_to_latex_str_value(self, result: Result) -> str:
"""
return self.s.create_str(result.value, [], "")
- def result_to_latex_str_without_error(self, result: Result) -> str:
+ def result_to_latex_str_without_uncert(self, result: Result) -> str:
"""
Returns the result without error as LaTeX string making use of the siunitx package.
"""
From 51fa40cf98281250f7abfb020884af849120c441 Mon Sep 17 00:00:00 2001
From: paul019 <39464035+paul019@users.noreply.github.com>
Date: Fri, 12 Apr 2024 11:53:52 +0200
Subject: [PATCH 02/10] Prevent multiple prints of one result
---
src/api/printable_result.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/api/printable_result.py b/src/api/printable_result.py
index 87189598..6da702c2 100644
--- a/src/api/printable_result.py
+++ b/src/api/printable_result.py
@@ -7,11 +7,14 @@
class PrintableResult:
def __init__(self, result: Result):
self._result = result
+ self.has_printed = False
def print(self):
"""Prints the result to the console."""
- stringifier = ConsoleStringifier(c.configuration.to_stringifier_config())
- print(stringifier.result_to_str(self._result))
+ if not self.has_printed:
+ stringifier = ConsoleStringifier(c.configuration.to_stringifier_config())
+ print(stringifier.result_to_str(self._result))
+ self.has_printed = True
def to_latex_str(self) -> str:
"""Converts the result to a string that can be used in LaTeX documents.
From 569f13b601bcd06535ae5884dfea0f2ca25366e8 Mon Sep 17 00:00:00 2001
From: paul019 <39464035+paul019@users.noreply.github.com>
Date: Fri, 12 Apr 2024 11:56:23 +0200
Subject: [PATCH 03/10] Undo unwanted changes
---
src/application/latex_commandifier.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/application/latex_commandifier.py b/src/application/latex_commandifier.py
index e43d2be3..0b06f193 100644
--- a/src/application/latex_commandifier.py
+++ b/src/application/latex_commandifier.py
@@ -28,7 +28,7 @@ def result_to_latex_cmd(self, result: Result) -> str:
# Without error
if len(result.uncertainties) > 0:
- builder.add_branch("withoutUncert", self.result_to_latex_str_without_uncert(result))
+ builder.add_branch("withoutError", self.result_to_latex_str_without_error(result))
# Single uncertainties
for i, u in enumerate(result.uncertainties):
@@ -82,7 +82,7 @@ def result_to_latex_str_value(self, result: Result) -> str:
"""
return self.s.create_str(result.value, [], "")
- def result_to_latex_str_without_uncert(self, result: Result) -> str:
+ def result_to_latex_str_without_error(self, result: Result) -> str:
"""
Returns the result without error as LaTeX string making use of the siunitx package.
"""
From 841efab0bdb86a2f4f67c970185f541fed3eda1e Mon Sep 17 00:00:00 2001
From: paul019 <39464035+paul019@users.noreply.github.com>
Date: Fri, 12 Apr 2024 12:09:45 +0200
Subject: [PATCH 04/10] Add option print to res()
---
src/api/res.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/api/res.py b/src/api/res.py
index 76642471..319dcf7c 100644
--- a/src/api/res.py
+++ b/src/api/res.py
@@ -71,6 +71,7 @@ def res(
@overload
# pylint: disable=too-many-arguments
+# pylint: disable=redefined-builtin
def res(
name: str,
value: Union[float, int, str, Decimal],
@@ -85,6 +86,7 @@ def res(
unit: str = "",
sigfigs: Union[int, None] = None,
decimal_places: Union[int, None] = None,
+ print: Union[bool, None] = None,
) -> PrintableResult:
if uncert is None:
uncert = []
@@ -115,7 +117,7 @@ def res(
# Print automatically
printable_result = PrintableResult(result)
- if c.configuration.print_auto:
+ if (c.configuration.print_auto and print is not False) or print is True:
printable_result.print()
# Export automatically
From edb119927b4c7a40b1f5d3b6bb7275936aa199e2 Mon Sep 17 00:00:00 2001
From: paul019 <39464035+paul019@users.noreply.github.com>
Date: Fri, 12 Apr 2024 12:19:06 +0200
Subject: [PATCH 05/10] Fix too-many-locals
---
src/api/res.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/api/res.py b/src/api/res.py
index 319dcf7c..a9e5621d 100644
--- a/src/api/res.py
+++ b/src/api/res.py
@@ -72,6 +72,7 @@ def res(
@overload
# pylint: disable=too-many-arguments
# pylint: disable=redefined-builtin
+# pylint: disable=too-many-locals
def res(
name: str,
value: Union[float, int, str, Decimal],
From 00a96cd44dd705876d6e0d8889998f2d512b70c9 Mon Sep 17 00:00:00 2001
From: paul019 <39464035+paul019@users.noreply.github.com>
Date: Sun, 21 Apr 2024 23:18:14 +0200
Subject: [PATCH 06/10] Use early return instead of big if statement
---
src/api/printable_result.py | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/api/printable_result.py b/src/api/printable_result.py
index 6da702c2..2fcb13b3 100644
--- a/src/api/printable_result.py
+++ b/src/api/printable_result.py
@@ -11,10 +11,12 @@ def __init__(self, result: Result):
def print(self):
"""Prints the result to the console."""
- if not self.has_printed:
- stringifier = ConsoleStringifier(c.configuration.to_stringifier_config())
- print(stringifier.result_to_str(self._result))
- self.has_printed = True
+ if self.has_printed:
+ return
+
+ stringifier = ConsoleStringifier(c.configuration.to_stringifier_config())
+ print(stringifier.result_to_str(self._result))
+ self.has_printed = True
def to_latex_str(self) -> str:
"""Converts the result to a string that can be used in LaTeX documents.
From efa0329a1f6cf46c2afe3b9654062252716832d8 Mon Sep 17 00:00:00 2001
From: paul019 <39464035+paul019@users.noreply.github.com>
Date: Sun, 21 Apr 2024 23:20:02 +0200
Subject: [PATCH 07/10] Put pylint disable into one line
---
src/api/res.py | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/api/res.py b/src/api/res.py
index a9e5621d..dffd89f9 100644
--- a/src/api/res.py
+++ b/src/api/res.py
@@ -70,9 +70,7 @@ def res(
@overload
-# pylint: disable=too-many-arguments
-# pylint: disable=redefined-builtin
-# pylint: disable=too-many-locals
+# pylint: disable=too-many-arguments,redefined-builtin,too-many-locals
def res(
name: str,
value: Union[float, int, str, Decimal],
From 1f775ff634e2622c9f98f2e66ad73011195aec5c Mon Sep 17 00:00:00 2001
From: paul019 <39464035+paul019@users.noreply.github.com>
Date: Mon, 9 Sep 2024 11:18:33 +0200
Subject: [PATCH 08/10] Squashed commit of the following:
commit e8d3467f984b4fc8454618a2072a7003a03a6b56
Author: Splines <37160523+Splines@users.noreply.github.com>
Date: Fri Sep 6 19:02:36 2024 +0200
Implement new `wiz.res()` API (#41)
* Remove plum as dependency
* Implement new `wiz.res()` API (see #33)
* Fix errors in error messages
* Use consistent comment format in error messages
* Add docstrings to `wiz.res()`
* Add missing `int` type for uncertainties
* Add PrintableResult to res() method signature
* Rename `uncert` to `uncerts` (plural)
commit cc6bf5b20b239ac662c42acdb262f686f142c161
Author: paul019 <39464035+paul019@users.noreply.github.com>
Date: Sat Apr 27 20:25:54 2024 +0200
Improve wording: use `uncertainty` instead of `error` (#43)
* Remove spaces in units
* Detect percent as unit in console stringifier
* Replace error by uncert
* Undo unwanted changes
* Replace error by uncertainty in various places
commit 62c34a571fa8250e0a09027c9f548be19a3a7186
Author: Splines <37160523+Splines@users.noreply.github.com>
Date: Sat Apr 27 19:45:34 2024 +0200
Add missing `site.baseurl` to relative links (#52)
commit f5e0007ef39d3b1e0ea185a17cda60f5cef96de5
Author: Splines <37160523+Splines@users.noreply.github.com>
Date: Sat Apr 27 19:45:19 2024 +0200
Truncate Readme & refer to documentation (#51)
* Truncate Readme & refer to documentation
* Remove GitHub-flavored markdown
Otherwise, it won't be rendered correctly on PyPI.
* Make Readme image clickable (points to docs)
commit 7af242c4f74feafc99e83d220bb88df5e2e04dc9
Author: Splines <37160523+Splines@users.noreply.github.com>
Date: Wed Apr 24 17:56:11 2024 +0200
Add first version of docs (#37)
* Init _Just the docs_ basic structure
* Add Jupyter-related items to TODO
* Add GitHub pages docs workflow
* Add 404 page
* Add landing page of documentation
* Add LaTeX rendered output
* Add quickstart & backbone for other pages
* Add `export()` & siunitx troubleshooting
* Add docs for `wiz.res()`
* Add `wiz.res()` tip for multiple occurrences
* Add config options & siunitx tips
* Improve Jupyter section & add "Is this really for me?"
* Add about page
* Add table of contents (TOC) back to about page
* Add docs build workflow for PRs
* Specify correct cwd for docs workflow
* Fix remaining docs workflow errors
* Add tip for how to suppress output in JupyterNotebook.
This fixes #44.
commit 63f2a6b617eb6b787bb9a2b67dd61986e47c90f4
Author: Splines <37160523+Splines@users.noreply.github.com>
Date: Mon Apr 22 23:31:50 2024 +0200
Update GitHub URLs to point to new repo location (#47)
---
.github/workflows/docs-verify.yml | 32 +++
.github/workflows/docs.yml | 69 +++++++
.vscode/settings.json | 4 +-
DEVELOPMENT.md | 2 +-
Pipfile | 1 -
Pipfile.lock | 54 +----
README.md | 155 +-------------
TODO.md | 14 +-
docs/.gitignore | 12 ++
docs/404.html | 26 +++
docs/Gemfile | 4 +
docs/Gemfile.lock | 82 ++++++++
docs/README.md | 13 ++
docs/_api/config.md | 54 +++++
docs/_api/export.md | 39 ++++
docs/_api/res.md | 123 +++++++++++
docs/_config.yml | 41 ++++
docs/_includes/nav_footer_custom.html | 4 +
docs/_includes/title.html | 4 +
.../color_schemes/resultwizard-colors.scss | 6 +
docs/_sass/custom/setup.scss | 4 +
docs/_tips/jupyter.md | 54 +++++
docs/_tips/siunitx.md | 58 ++++++
docs/favicon.ico | Bin 0 -> 9584 bytes
docs/index.md | 86 ++++++++
docs/pages/about.md | 38 ++++
docs/pages/quickstart.md | 192 ++++++++++++++++++
docs/pages/trouble.md | 94 +++++++++
pyproject.toml | 11 +-
src/api/console_stringifier.py | 4 +-
src/api/parsers.py | 9 +-
src/api/res.py | 99 +++------
src/application/error_messages.py | 17 +-
.../latex_better_siunitx_stringifier.py | 4 +-
src/application/latex_commandifier.py | 20 +-
src/application/latex_stringifier.py | 4 +-
src/application/stringifier.py | 8 +-
tests/playground.py | 46 ++---
38 files changed, 1156 insertions(+), 331 deletions(-)
create mode 100644 .github/workflows/docs-verify.yml
create mode 100644 .github/workflows/docs.yml
create mode 100644 docs/.gitignore
create mode 100644 docs/404.html
create mode 100644 docs/Gemfile
create mode 100644 docs/Gemfile.lock
create mode 100644 docs/README.md
create mode 100644 docs/_api/config.md
create mode 100644 docs/_api/export.md
create mode 100644 docs/_api/res.md
create mode 100644 docs/_config.yml
create mode 100644 docs/_includes/nav_footer_custom.html
create mode 100644 docs/_includes/title.html
create mode 100644 docs/_sass/color_schemes/resultwizard-colors.scss
create mode 100644 docs/_sass/custom/setup.scss
create mode 100644 docs/_tips/jupyter.md
create mode 100644 docs/_tips/siunitx.md
create mode 100644 docs/favicon.ico
create mode 100644 docs/index.md
create mode 100644 docs/pages/about.md
create mode 100644 docs/pages/quickstart.md
create mode 100644 docs/pages/trouble.md
diff --git a/.github/workflows/docs-verify.yml b/.github/workflows/docs-verify.yml
new file mode 100644
index 00000000..18c603e2
--- /dev/null
+++ b/.github/workflows/docs-verify.yml
@@ -0,0 +1,32 @@
+name: Documentation
+
+on:
+ pull_request:
+ types: [opened, reopened, synchronize, ready_for_review]
+ paths:
+ - "docs/**"
+
+jobs:
+ # Just check that the build works and doesn't throw any errors
+ # The actual build and deployment is done on the main branch
+ # with another GitHub Actions workflow.
+ build:
+ name: Build
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ working-directory: docs
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Setup Ruby
+ uses: ruby/setup-ruby@v1
+ with:
+ ruby-version: '3.1'
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
+ cache-version: 0 # Increment this number if you need to re-download cached gems
+ working-directory: '${{ github.workspace }}/docs'
+
+ - name: Build with Jekyll
+ run: bundle exec jekyll build
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
new file mode 100644
index 00000000..ee97c592
--- /dev/null
+++ b/.github/workflows/docs.yml
@@ -0,0 +1,69 @@
+# See the template here: https://github.com/just-the-docs/just-the-docs-template
+
+name: Documentation
+
+on:
+ push:
+ branches:
+ - "main"
+ paths:
+ - "docs/**"
+
+ # Allows you to run this workflow manually from the Actions tab
+ workflow_dispatch:
+
+# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
+permissions:
+ contents: read
+ pages: write # to deploy to Pages
+ id-token: write # to verify the deployment originates from an appropriate source
+
+# Allow one concurrent deployment
+concurrency:
+ group: "pages"
+ cancel-in-progress: true
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ working-directory: docs
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Setup Ruby
+ uses: ruby/setup-ruby@v1
+ with:
+ ruby-version: '3.1'
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
+ cache-version: 0 # Increment this number if you need to re-download cached gems
+ working-directory: '${{ github.workspace }}/docs'
+
+ - name: Setup Pages
+ id: pages
+ uses: actions/configure-pages@v5
+
+ - name: Build with Jekyll
+ # Outputs to the './_site' directory by default
+ run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
+ env:
+ JEKYLL_ENV: production
+
+ # Automatically creates an github-pages artifact used by the deployment job
+ - name: Upload artifact
+ uses: actions/upload-pages-artifact@v3
+ with:
+ path: "docs/_site/"
+
+ deploy:
+ environment:
+ name: github-pages
+ url: ${{ steps.deployment.outputs.page_url }}
+ runs-on: ubuntu-latest
+ needs: build
+ steps:
+ - name: Deploy to GitHub Pages
+ id: deployment
+ uses: actions/deploy-pages@v4
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 97e171c4..bd636e55 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -30,7 +30,8 @@
"files.exclude": {
"**/__pycache__/": true,
"**/*.egg-info/": true,
- ".pytest_cache/": true
+ "**/.pytest_cache/": true,
+ "**/.jekyll-cache/": true
},
//////////////////////////////////////
// Editor
@@ -86,6 +87,7 @@
"texttt",
"TLDR",
"uncert",
+ "uncerts",
"usepackage"
]
}
\ No newline at end of file
diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md
index e83c4639..01e04685 100644
--- a/DEVELOPMENT.md
+++ b/DEVELOPMENT.md
@@ -9,7 +9,7 @@ Getting ready:
- [ ] Recommended VSCode extensions installed (especially the formatter. It should automatically format on every save!)
- [ ] on branch `value-wizard` with latest commit pulled
- [ ] Work through the `Setup` section below (especially to install the necessary dependencies)
-- [ ] Read the [`README.md`](https://github.com/paul019/ResultWizard/tree/value-wizard/src#code-structure) in the `src` folder (to get to know the code structure) & see our [feature list](https://github.com/paul019/ResultWizard/issues/16)
+- [ ] Read the [`README.md`](https://github.com/resultwizard/ResultWizard/tree/main/src#code-structure) in the `src` folder (to get to know the code structure) & see our [feature list](https://github.com/resultwizard/ResultWizard/issues/16)
Verify that everything worked:
- [ ] try to run the tests, see the instructions in [`tests/playground.py`](./tests/playground.py)
diff --git a/Pipfile b/Pipfile
index cc9fe33d..70624017 100644
--- a/Pipfile
+++ b/Pipfile
@@ -4,7 +4,6 @@ verify_ssl = true
name = "pypi"
[packages]
-plum-dispatch = "~=2.3"
[dev-packages]
pylint = "~=3.0"
diff --git a/Pipfile.lock b/Pipfile.lock
index 37d8af23..94768b86 100644
--- a/Pipfile.lock
+++ b/Pipfile.lock
@@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
- "sha256": "cbec9547e5137a6a3a0f7ba14ff98a24a53adb966549045956b3e506835e0bdf"
+ "sha256": "a5f83ecca60c4365a35a8eb10b1051286f4099f88ff14dab578be8367888ba0e"
},
"pipfile-spec": 6,
"requires": {
@@ -15,57 +15,7 @@
}
]
},
- "default": {
- "beartype": {
- "hashes": [
- "sha256:c22b21e1f785cfcf5c4d3d13070f532b6243a3ad67e68d2298ff08d539847dce",
- "sha256:e911e1ae7de4bccd15745f7643609d8732f64de5c2fb844e89cbbed1c5a8d495"
- ],
- "markers": "python_full_version >= '3.8.0'",
- "version": "==0.17.2"
- },
- "markdown-it-py": {
- "hashes": [
- "sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1",
- "sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb"
- ],
- "markers": "python_version >= '3.8'",
- "version": "==3.0.0"
- },
- "mdurl": {
- "hashes": [
- "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8",
- "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"
- ],
- "markers": "python_version >= '3.7'",
- "version": "==0.1.2"
- },
- "plum-dispatch": {
- "hashes": [
- "sha256:96f519d416accf9a009117682f689114eb23e867bb6f977eed74ef85ef7fef9d",
- "sha256:f49f00dfdf7ab0f16c9b85cc27cc5241ffb59aee02218bac671ec7c1ac65e139"
- ],
- "index": "pypi",
- "markers": "python_version >= '3.8'",
- "version": "==2.3.2"
- },
- "pygments": {
- "hashes": [
- "sha256:b27c2826c47d0f3219f29554824c30c5e8945175d888647acd804ddd04af846c",
- "sha256:da46cec9fd2de5be3a8a784f434e4c4ab670b4ff54d605c4c2717e9d49c4c367"
- ],
- "markers": "python_version >= '3.7'",
- "version": "==2.17.2"
- },
- "rich": {
- "hashes": [
- "sha256:4edbae314f59eb482f54e9e30bf00d33350aaa94f4bfcd4e9e3110e64d0d7222",
- "sha256:9be308cb1fe2f1f57d67ce99e95af38a1e2bc71ad9813b0e247cf7ffbcc3a432"
- ],
- "markers": "python_full_version >= '3.7.0'",
- "version": "==13.7.1"
- }
- },
+ "default": {},
"develop": {
"astroid": {
"hashes": [
diff --git a/README.md b/README.md
index cec3a7a9..a594386d 100644
--- a/README.md
+++ b/README.md
@@ -1,156 +1,17 @@
-

+
+
+
ResultWizard
Intelligent interface between Python-computed values and your LaTeX work
-> **Warning โ **
-> ResultWizard is currently fully functional but still in its *alpha* stage. We're happy to receive your feedback. Basic usage is as follows. A more comprehensive documentation will be available as soon as the package is stable.
-
-
-## Installation & basic usage
-Install the package via pip.
-
-```sh
-pip install resultwizard
-```
-
-Then you can use `ResultWizard` in your Python code:
-
-```python
-import resultwizard as wiz
-wiz.config_init(print_auto=True)
-
-# your complex calculations
-# ...
-value = 42.0
-uncertainty = 3.14
-wiz.res("length atom", value, uncertainty, r"\per\mm\cubed")
-# There are many more ways to call wiz.res(...), try to use
-# IntelliSense in your IDE to see all possibilities.
-# A more in-depth documentation will follow in next releases.
-
-# Export the result to a LaTeX file. Provide a path as string
-# where the file should be saved.
-wiz.export("./results.tex")
-```
-
-Now add the following line to your LaTeX document right before `\begin{document}`:
-
-```latex
-% assuming that `results.tex` is located in the same directory
-% as your LaTeX document
-\input{./results.tex}
-
-\begin{document}
-...
-```
-
-Note that `ResultWizard` requires the following LaTeX packages: [`siunitx`](https://ctan.org/pkg/siunitx) and [`ifthen`](https://ctan.org/pkg/ifthen). They are imported in the `results.tex` file via `\usepackage{...}` statements. The package `ifthen` is always present in a LaTeX distribution. You may have to install the `siunitx` package, which is a widely used package in the scientific community to typeset units, e.g. you can use strings like `\kg\per\cm`.
-
-You can now go ahead and **use the variable in your LaTeX document** in any math environment, e.g.:
-
-```latex
-\begin{align}
- \resLengthAtom
-\end{align}
-```
-
-You can also only use a specific part of the result, e.g. the unit, the value itself etc. (try to use a random key like `\resLengthAtom[x]` and compile your LaTeX document to see more options).
-
-```latex
-\begin{align}
- \resLengthAtom[unit]
-\end{align}
-```
-
----
-
-If your LaTeX document does not compile, try to set
-
-```python
-wiz.config_init(siunitx_fallback=True)
-```
-
-in your `ResultWizard` configuration. If the LaTeX document compiles after this, you have an older version of `siunitx` installed. We recommend to upgrade the package to at least version `v3.1.0` to be able to fully customize the output of the result in your LaTeX document via `\sisetup{...}`. See the troubleshooting section down below for more information.
-
-
-## Troubleshooting: LaTeX doesn't build
-
-If your LaTeX document doesn't build, there might be several reasons. Try to find out what's wrong by looking at the log file of your LaTeX compiler (sometimes you have to scroll way up to find the error responsible for the failing build). Also open the `results.tex` file to see if your editor/IDE shows any errors there. You might encounter one of the following errors:
-
-
+Annoyed of having to copy around values from Python code to your LaTeX work? Think of `ResultWizard` as an interface between the two. Export any variables from Python including possible uncertainties and their units and directly reference them in your LaTeX document.
-Package siunitx: Invalid number.
-
-TL;DR: You have an **old version of `siunitx`**. Please update it or use the `siunitx_fallback` option in the `config_init` method.
-
-In version [`v3.1.0 (2022-04-25)`](https://github.com/josephwright/siunitx/blob/main/CHANGELOG.md#v310---2022-04-25), `siunitx` introduced "support for multiple uncertainty values in both short and long form in input". We make use of this feature in `ResultWizard`.
-
-Unfortunately, it may be the case that you're using an older version of `siunitx`. Especially if you've installed LaTeX via a package manager (e.g. you installed `siunitx` via `sudo apt install texlive-science`). To determine your version, include the following line in your LaTeX document:
-
-```latex
-\listfiles % add this before \begin{document}
-```
-
-Then, compile your document and check the log for the version of `siunitx`. If it's older than `v3.1.0 (2022-04-25)`, don't despair. We have two solutions for you:
-
-**Solution 1: Don't update `siunitx` and stick with your old version**
-
-Sure, fine, we won't force you to update `siunitx` (although we'd recommend it). To keep using your old version, specify the following key in the `config_init` method:
-
-```python
-wiz.config_init(siunitx_fallback=True)
-```
-
-Note that with this "solution", you won't be able to fully customize the output of the result in your LaTeX document. For example, we will use a `ยฑ` between the value and the uncertainty, e.g. `3.14 ยฑ 0.02`. You won't be able to change this in your `sisetup` by doing:
-
-```latex
-\sisetup{separate-uncertainty=false}
-```
-
-to get another format like `3.14(2)`. There are also some [other `siunitx` options](https://texdoc.org/serve/siunitx/0) that won't work with `ResultWizard`, e.g. `exponent-product`. If you're fine with this, go ahead and use the `siunitx_fallback` option. If not, consider updating `siunitx` to at least version `v3.1.0`.
-
-**Solution 2: Update `siunitx` (recommended)**
-
-How the update process works depends on your LaTeX distribution and how you installed it. E.g. you might be using `TeX Live` on `Ubuntu` and installed packages via `apt`, e.g. `sudo apt install texlive-science` (which includes the LaTeX `siunitx`). These pre-built packages are often outdated, e.g. for Ubuntu 22.04 LTS (jammy), the `siunitx` package that comes with the `texlive-science` package is `3.0.4`. Therefore, you might have to update `siunitx` manually. See an overview on how to install individual LaTeX packages on Linux [here](https://tex.stackexchange.com/a/73017/).
-
-A quick solution might be to simply install a new version of `siunitx` manually to your system. There's a great and short Ubuntu guide on how to install LaTeX packages manually [here](https://help.ubuntu.com/community/LaTeX#Installing_packages_manually). The following commands are based on this guide. We will download the version `3.1.11 (2022-12-05)` from GitHub (this is the last version before `3.2` where things might get more complicated to install) and install it locally. Nothing too fancy. Execute the following commands in your terminal:
-
-```sh
-# Install "unzip", a tool to extract zip files
-sudo apt install unzip
-
-# Download v3.1.11 of siunitx from GitHub
-curl -L https://github.com/josephwright/siunitx/releases/download/v3.1.11/siunitx-ctan.zip > siunitx-ctan-3.1.11.zip
-
-# Unzip the file
-unzip ./siunitx-ctan-3.1.11.zip
-cd siunitx/
-
-# Run LaTeX on the .ins file to produce a usable .sty file
-# (The .sty file is needed when you use \usepackage{siunitx}
-# in your LaTeX document)
-latex siunitx.ins
-
-# Create a new directory in your home directory
-# to store the new package .sty file
-mkdir -p ~/texmf/tex/latex/siunitx
-cp siunitx.sty ~/texmf/tex/latex/siunitx/
-
-# Make LaTeX recognize the new package by pointing it to the new directory
-texhash ~/texmf/
-
-# ๐ Done. Try to rebuild your LaTeX document again.
-
-# If you don't wan't the new siunitx version anymore, just run the following
-# command to remove the .sty file. LaTeX will then use the version of siunitx
-# it finds somewhere else in your system.
-rm ~/texmf/tex/latex/siunitx/siunitx.sty
-```
-
-Compiling your latex document again, you should see version `v3.1.11` of `siunitx` in the log file. And it should build, yeah ๐. Don't forget to remove the `\listfiles` from your LaTeX document to avoid cluttering your log file (which is ironic for LaTeX, we know).
+> **Warning โ **
+> ResultWizard is still in its *alpha* stage. We're happy to receive your feedback, e.g. report any bugs. But note that the API might still change before we hit the first stable release 1.0.0.
-
+> **๐**
+> **For installation/usage/API, refer to our [documentation](https://resultwizard.github.io/ResultWizard/).**
diff --git a/TODO.md b/TODO.md
index 5abb47c7..15c58d03 100644
--- a/TODO.md
+++ b/TODO.md
@@ -10,14 +10,24 @@
-> Explain that this has the great potential for loops: users can specify variables in a loop and use format strings, e.g. `wiz.res(f"my_variable_{i}", ...)`
- how to pass in uncertainties. How to pass in one? What about systematic and statistical ones. What if I want to add my own name for the uncertainty? How can I control that output.
- a list of all possible keys for `config_init` including their default values, e.g. `identifier`. In-depth explanation especially for sigfigs and decimal places and how they differ from respective fallback options
-- a hint that the output is completely customizable and that the user can change it with the `\sisetup{...}`, e.g. `\cdot` vs. `\times` for exponent, etc.
+- a hint that the output is completely customizable and that the user can change it with the `\sisetup{...}`, e.g. `\cdot` vs. `\times` for exponent, `separate-uncertainty=true` (!)
- how to use the unit string. explain that strings from `siunitx` can be passed in, e.g. `\cm \per \N` etc. Explain how python raw strings can help, e.g. `r"\cm \per \N"` instead of having to do `\\cm` etc. all the time. However, `r'\\tesla'` will fail as the double backslash is treated a raw string and not as an escape character. Use `r'\tesla'` instead.
- possible ways to print a result. Recommended: activate `print_auto`. Other way: call `print()` on result object. Users can also call `resVariable.to_latex_str()` to retrieve the LaTeX representation. This can be useful to plot the result in a matplotlib figure, e.g. the fit parameter of a curve fit.
- Suggest some good initial configuration for Jupyter notebook, e.g. `print_auto=True` and `ignore_result_overwrite=True`.
- Naming: we call it "uncertainty". Give a hint that others might also call it "error" interchangeably.
+- Jupyter Notebook tip to avoid
+
+```
+
+```
+as output. Instead append a `;` to the `wiz.res(...)` call and the output will be suppressed.
+
+- Use fuzzy search in IntelliSense to search for result names.
+
+
## Other
- Setup issue template and contribution guide. Clean up `DEVELOPMENT.md`.
-- Long-term: Ask real users what they really need in the scientific day-to-day life, see [here](https://github.com/paul019/ResultWizard/issues/9).
+- Long-term: Ask real users what they really need in the scientific day-to-day life, see [here](https://github.com/resultwizard/ResultWizard/issues/9).
- If user enters an uncertainty of `0.0`, don't just issue warning "Uncertainty must be positive", but also give a hint that the user might want to use a different caller syntax for `res` which does not even have the uncertainty as argument.
diff --git a/docs/.gitignore b/docs/.gitignore
new file mode 100644
index 00000000..93b45e81
--- /dev/null
+++ b/docs/.gitignore
@@ -0,0 +1,12 @@
+# These are directly copied from Jekyll's first-party docs on `.gitignore` files:
+# https://jekyllrb.com/tutorials/using-jekyll-with-bundler/#commit-to-source-control
+
+# Ignore the default location of the built site, and caches and metadata generated by Jekyll
+_site/
+.sass-cache/
+.jekyll-cache/
+.jekyll-metadata
+
+# Ignore folders generated by Bundler
+.bundle/
+vendor/
diff --git a/docs/404.html b/docs/404.html
new file mode 100644
index 00000000..f75bc878
--- /dev/null
+++ b/docs/404.html
@@ -0,0 +1,26 @@
+---
+permalink: /404.html
+layout: default
+---
+
+
+
+
+
404
+
+
Page not found ๐ฅ
+
The requested page could not be found.
+
diff --git a/docs/Gemfile b/docs/Gemfile
new file mode 100644
index 00000000..25440b6f
--- /dev/null
+++ b/docs/Gemfile
@@ -0,0 +1,4 @@
+source 'https://rubygems.org'
+
+gem "jekyll", "~> 4.3.3" # installed by `gem jekyll`
+gem "just-the-docs", "0.8.1" # pinned to the current release
diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock
new file mode 100644
index 00000000..017aea1b
--- /dev/null
+++ b/docs/Gemfile.lock
@@ -0,0 +1,82 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ addressable (2.8.6)
+ public_suffix (>= 2.0.2, < 6.0)
+ colorator (1.1.0)
+ concurrent-ruby (1.2.3)
+ em-websocket (0.5.3)
+ eventmachine (>= 0.12.9)
+ http_parser.rb (~> 0)
+ eventmachine (1.2.7)
+ ffi (1.16.3)
+ forwardable-extended (2.6.0)
+ google-protobuf (4.26.1-x86_64-linux)
+ rake (>= 13)
+ http_parser.rb (0.8.0)
+ i18n (1.14.4)
+ concurrent-ruby (~> 1.0)
+ jekyll (4.3.3)
+ addressable (~> 2.4)
+ colorator (~> 1.0)
+ em-websocket (~> 0.5)
+ i18n (~> 1.0)
+ jekyll-sass-converter (>= 2.0, < 4.0)
+ jekyll-watch (~> 2.0)
+ kramdown (~> 2.3, >= 2.3.1)
+ kramdown-parser-gfm (~> 1.0)
+ liquid (~> 4.0)
+ mercenary (>= 0.3.6, < 0.5)
+ pathutil (~> 0.9)
+ rouge (>= 3.0, < 5.0)
+ safe_yaml (~> 1.0)
+ terminal-table (>= 1.8, < 4.0)
+ webrick (~> 1.7)
+ jekyll-include-cache (0.2.1)
+ jekyll (>= 3.7, < 5.0)
+ jekyll-sass-converter (3.0.0)
+ sass-embedded (~> 1.54)
+ jekyll-seo-tag (2.8.0)
+ jekyll (>= 3.8, < 5.0)
+ jekyll-watch (2.2.1)
+ listen (~> 3.0)
+ just-the-docs (0.8.1)
+ jekyll (>= 3.8.5)
+ jekyll-include-cache
+ jekyll-seo-tag (>= 2.0)
+ rake (>= 12.3.1)
+ kramdown (2.4.0)
+ rexml
+ kramdown-parser-gfm (1.1.0)
+ kramdown (~> 2.0)
+ liquid (4.0.4)
+ listen (3.9.0)
+ rb-fsevent (~> 0.10, >= 0.10.3)
+ rb-inotify (~> 0.9, >= 0.9.10)
+ mercenary (0.4.0)
+ pathutil (0.16.2)
+ forwardable-extended (~> 2.6)
+ public_suffix (5.0.5)
+ rake (13.2.1)
+ rb-fsevent (0.11.2)
+ rb-inotify (0.10.1)
+ ffi (~> 1.0)
+ rexml (3.2.6)
+ rouge (4.2.1)
+ safe_yaml (1.0.5)
+ sass-embedded (1.74.1-x86_64-linux-gnu)
+ google-protobuf (>= 3.25, < 5.0)
+ terminal-table (3.0.2)
+ unicode-display_width (>= 1.1.1, < 3)
+ unicode-display_width (2.5.0)
+ webrick (1.8.1)
+
+PLATFORMS
+ x86_64-linux
+
+DEPENDENCIES
+ jekyll (~> 4.3.3)
+ just-the-docs (= 0.8.1)
+
+BUNDLED WITH
+ 2.4.22
diff --git a/docs/README.md b/docs/README.md
new file mode 100644
index 00000000..eccaa7d3
--- /dev/null
+++ b/docs/README.md
@@ -0,0 +1,13 @@
+# ResultWizard documentation
+
+๐งพ Find the documentation [here](https://resultwizard.github.io/ResultWizard/).
+
+To build and preview the docs locally, see [this](https://github.com/just-the-docs/just-the-docs-template?tab=readme-ov-file#building-and-previewing-your-site-locally). In summary, have [Bundler](https://bundler.io/) installed, then run:
+
+```bash
+cd docs/
+bundle install
+bundle exec jekyll serve
+```
+
+Preview the docs at [localhost:4000](http://localhost:4000). Files are stored in the `_site` directory locally.
diff --git a/docs/_api/config.md b/docs/_api/config.md
new file mode 100644
index 00000000..cdadfbb8
--- /dev/null
+++ b/docs/_api/config.md
@@ -0,0 +1,54 @@
+---
+layout: default
+title: wiz.config_init() & wiz.config()
+nav_order: 1
+---
+
+# `wiz.config_init` & `wiz.config()`
+{: .no_toc }
+
+
+
+ Content
+
+ {: .text-delta }
+
+- TOC
+{:toc}
+
+
+
+
+## Purpose
+
+The methods `wiz.config_init()` and `wiz.config()` allow you to configure `ResultWizard` to your needs. Note that this mainly affects the rounding mechanism as well as convenience features. How the results are formatted in the LaTeX document is mainly controlled by the `siunitx` package and how you set it up in your LaTeX preamble. If this is what you want to configure, then you should take a look [here]({{site.baseurl}}/tips/siunitx).
+
+## Usage
+
+With `config_init()` you set the initial configuration for `ResultWizard`. With later calls to `config()`, you can update individual settings without having to reconfigure every parameter.
+
+{: .warning }
+Some options are only available in `config_init()` and cannot be changed later with `config()`.
+
TODO: Do we really want that?
+
+Here is the list of available options:
+
+{: .warning }
+TODO: sort options alphabetically? Make clearer what the difference between `sigfigs` and `sigfigs_fallback` is. Maybe even rename/unify these options? Same for `decimal_places` and `decimal_places_fallback`. We also need better explanations for `min_exponent_...` and `max_exponent_...`.
+
+| Option | Default | Available in
`config_init()` | Available in
`config()` | Description |
+|:---|:---:|:---:|:---:|:---|
+| `sigfigs` (int) | `-1` | โ | โ | The number of significant figures to round to.
TODO: explain what a sigfig is. |
+| `decimal_places` (int) | `-1` | โ | โ | The number of decimal places to round to. |
+| `sigfigs_fallback` (int) | `2` | โ | โ | The number of significant figures to use as a fallback if other rounding rules don't apply. |
+| `decimal_places_fallback` (int) | `-1` | โ | โ | The number of decimal places to use as a fallback if other rounding rules don't apply. |
+| `identifier` (str) | `"result"` | โ | | The identifier that will be used in the LaTeX document to reference the result. |
+| `print_auto` (bool) | `False` | โ | โ | If `True`, every call to `wiz.res()` will automatically print the result to the console, such that you don't have to use `.print()` on every single result. |
+| `export_auto_to` (str) | `""` | โ | | If set to a path, every call to `wiz.res()` will automatically export the result to the specified file. This is especially useful for Jupyter notebooks where every execution of a cell that contains a call to `wiz.res()` will automatically export to the file. |
+| `siunitx_fallback` (bool) | `False` | โ | | If `True`, `ResultWizard` will use a fallback for the `siunitx` package if you have an old version installed. See [here]({{site.baseurl}}/trouble#package-siunitx-invalid-number) for more information. We don't recommend to use this option and instead upgrade your `siunitx` version to exploit the full power of `ResultWizard`. |
+`precision` (int) | `100` | โ | | The precision `ResultWizard` uses internally to handle the floating point numbers. You may have to increase this number if you encounter the error "Your precision is set too low". |
+| `ignore_result_overwrite` (bool) | `False` | โ | | If `True`, `ResultWizard` will not raise a warning if you overwrite a result with the same identifier. This is especially useful for Jupyter notebooks where cells are oftentimes run multiple times. |
+| `min_exponent_for_`
`non_scientific_notation` (int) | `-2` | โ | | The minimum exponent for which `ResultWizard` will use non-scientific notation. If the exponent is smaller than this value, scientific notation will be used. TODO: explain better. |
+| `max_exponent_for_`
`non_scientific_notation` (int) | `3` | โ | | The maximum exponent for which `ResultWizard` will use non-scientific notation. If the exponent is larger than this value, scientific notation will be used. TODO: explain better. |
+
+If you're using a Jupyter Notebook, you might find [this configuration]({{site.baseurl}}/tips/jupyter) useful.
diff --git a/docs/_api/export.md b/docs/_api/export.md
new file mode 100644
index 00000000..a476f087
--- /dev/null
+++ b/docs/_api/export.md
@@ -0,0 +1,39 @@
+---
+layout: default
+title: wiz.export()
+nav_order: 3
+---
+
+# `wiz.export()`
+{: .no_toc }
+
+
+
+ Content
+
+ {: .text-delta }
+
+- TOC
+{:toc}
+
+
+
+
+## Purpose
+
+Call `wiz.export()` after you have defined your results with `wiz.res()`. `wiz.export()` will generate a LaTeX file containing all your results. This file can be included in your LaTeX document with `\input{./path/to/results.tex}` in the LaTeX preamble (see [here]({{site.baseurl}}/quickstart#2-include-results-in-latex)).
+
+## Usage
+
+```py
+wiz.export(filepath: str)
+```
+
+- `filepath` (str): The (relative or absolute) path to the LaTeX file to be generated, e.g. `./results.tex`.
+
+
+## Tips
+
+- The `filepath` should end with `.tex` to be recognized as a LaTeX file by your IDE / LaTeX editor.
+- For a convenient setup, have Python code reside next to your LaTeX document. This way, you can easily reference the generated LaTeX file. For example, you could have two folders `latex/` & `code/` in your project. Then export the results to `../latex/results.tex` from your python code residing in the `code` folder. In LaTeX, you can then include the file with `\input{./results.tex}`.
+- Especially for Jupyter Notebooks, we recommend to use the [`export_auto_to` config option]({{site.baseurl}}/api/config#export_auto_to). This way, you can automatically export the results to a file after each call to `wiz.res()`. See [this page]({{site.baseurl}}/tips/jupyter) for a suitable configuration of `ResultWizard` in Jupyter Notebooks.
diff --git a/docs/_api/res.md b/docs/_api/res.md
new file mode 100644
index 00000000..0f689375
--- /dev/null
+++ b/docs/_api/res.md
@@ -0,0 +1,123 @@
+---
+layout: default
+title: wiz.res()
+nav_order: 2
+---
+
+# `wiz.res()`
+{: .no_toc }
+
+
+
+ Content
+
+ {: .text-delta }
+
+- TOC
+{:toc}
+
+
+
+{: .warning}
+The API for `wiz.res()` is not yet finalized as of `v1.0.0a2` and might change before the stable release `1.0.0`. This is due to some issues we are currently experiencing with the multiple dispatch mechanism in [`plum`].
+
+
+## Purpose
+
+`wiz.res()` is at the heart of `ResultWizard`. With this method, you define your results, i.e. numerical values with uncertaintie(s) (optional) and a unit (optional). See the [basic usage]({{site.baseurl}}/quickstart#-basic-usage) for a first example.
+
+
+When we talk about a **"measurement result"**, we usually refer to these components:
+
+- _Value_: The numerical value of your measurement, i.e. the value you have measured and that you are interested in.
+- _Uncertainties_: They denote the precision of your measurement since you can never measure a value exactly in the real world. Another term commonly used for this is "error", but we will use "uncertainty" throughout.
+- _Unit_: The SI unit of your measurement, e.g. meters, seconds, kilograms etc.
+
+
+## Usage
+
+
+### Define a result
+
+`wiz.res()` is overloaded[^1], i.e. you can call it with different argument types and even different number of arguments. This allows you to define your results in a way that suits you best, e.g. sometimes you might only have the value without any uncertainties, or you don't need a unit etc.
+
+In the following, we use these abbreviations. Refer to the [python docs](https://docs.python.org/3/library/decimal.html) if you're unsure about how `Decimal` works. We recommend using `Decimal` for all numerical values to avoid floating point errors. Also see the [precision page](TODO).
+```py
+numlike := float | int | str | Decimal
+numlike_without_int := float | str | Decimal
+uncertainties := Tuple[numlike, str] | List[numlike | Tuple[numlike, str]]
+```
+
+These are the possible ways to call `wiz.res()`. Note you can use IntelliSense (`Ctrl + Space`) in your IDE to see all possible signatures and get error messages if you use the arguments incorrectly.
+```py
+wiz.res(name: str, value: numlike)
+wiz.res(name: str, value: numlike, unit: str = "")
+wiz.res(name: str, value: numlike, uncert: numlike | uncertainties)
+wiz.res(name: str, value: numlike, sys: float | Decimal, stat: float | Decimal, unit: str = "")
+wiz.res(name: str, value: numlike, uncert: numlike_without_int | uncertainties | None, unit: str = "")
+```
+
+{: .warning }
+Some signatures of `wiz.res()` don't allow for an `int` to be passed in. This is currently due to a technical limitation that we are trying to work around before the stable release.
+
+Note that `uncert` stands for "uncertainties" and can be a single value (for symmetric uncertainties) or a list (for asymmetric uncertainties). When you specify a tuple, the first element is the numerical value of the uncertainty, the second element is a string that describes the type of uncertainty, e.g. "systematic", "statistical" etc.
+```py
+wiz.res("i did it my way", 42.0, [0.22, (0.25, "systematic"), (0.314, "yet another one")])
+
+# These two lines are equivalent (the last line is just a convenient shorthand)
+# Note however with the last line, you cannot pass in "0.1" or "0.2" as strings.
+wiz.res("atom diameter", 42.0, [(0.1, "sys"), (0.2, "stat")])
+wiz.res("atom diameter", 42.0, 0.1, 0.2)
+```
+
+
+### Override the rounding mechanism
+
+Sometimes, you don't want a result to be rounded at all. You can tell `ResultWizard` to not round a numerical value by passing this value as string instead:
+```py
+calculated_uncert = 0.063
+wiz.res("abc", "1.2345", str(calculated_uncert)).print()
+# will print: abc = 1.2345 ยฑ 0.063
+```
+
+You might also use the following keyword arguments with any signature of `wiz.res()`. They will override whatever you have configured via [`config_init()` or `config()`]({{site.baseurl}}/api/config), but just for the specific result.
+```py
+wiz.res(name, ..., sigfigs: int = None, decimal_places: int = None)
+```
+
+
+### Return type
+
+`wiz.res()` returns a `PrintableResult`. On this object, you can call:
+
+```py
+my_res = wiz.res("abc", 1.2345, 0.063)
+my_res.print() # will print: abc = 1.23 ยฑ 0.06
+my_latex_str = my_res.to_latex_str()
+print(my_latex_str) # will print: \num{1.23 \pm 0.06}
+```
+
+- `print()` will print the result to the console. If you find yourself using this a lot, consider setting the [`print_auto` config option]({{site.baseurl}}/api/config#print_auto) to `True`, which will automatically print the result after each call to `wiz.res()`.
+- `to_latex_str()` converts the result to a LaTeX string. This might be useful if you want to show the result as label in a `matplotlib` plot. For this to work, you have to tell `matplotlib` that you're using `siunitx` by defining the preamble in your Python script:
+```py
+import matplotlib.pyplot as plt
+plt.rc('text.latex', preamble=r"""
+ \usepackage{siunitx}
+ \sisetup{locale=US, group-separator={,}, group-digits=integer,
+ per-mode=symbol, separate-uncertainty=true}""")
+```
+
+
+
+## Tips
+
+You might need a variable in your LaTeX document multiple times: in one place _with_ a unit and in another one _without_ a unit (or uncertainty etc.). Don't define the result twice in this case.
+Instead, call `wiz.res()` once and pass in everything you know about your result, e.g. value, unit, uncertainties. Then use `$$\resultMyVariableName[withoutUnit]$$` or `$$\resultMyVariableName[unit]$$` etc. in the LaTeX document to only use a specific part of the result. See the [quickstart]({{site.baseurl}}/quickstart#latex-subset-syntax) for more information.
+
+
+---
+
+[^1]: For the technically interested: we use [`plum`] to achieve this "multiple dispatch" in Python. Natively, Python does not allow for method overloading, a concept you might know from other programming languages like Java.
+
+
+[`plum`]: https://github.com/beartype/plum
\ No newline at end of file
diff --git a/docs/_config.yml b/docs/_config.yml
new file mode 100644
index 00000000..c1be61f1
--- /dev/null
+++ b/docs/_config.yml
@@ -0,0 +1,41 @@
+title: ResultWizard
+description: Documentation for the ResultWizard Python library.
+theme: just-the-docs
+include: ["pages"]
+logo: "https://github.com/resultwizard/ResultWizard/assets/37160523/e3ce32b9-2e41-4ddc-88e3-c1adadd305e9"
+
+url: https://resultwizard.github.io/ResultWizard/
+
+aux_links:
+ GitHub: https://github.com/resultwizard/ResultWizard
+ Report a bug: https://github.com/resultwizard/ResultWizard/issues
+ PyPI: https://pypi.org/project/resultwizard/
+
+collections:
+ api:
+ permalink: "/:collection/:path/"
+ output: true
+ tips:
+ permalink: "/:collection/:path/"
+ output: true
+just_the_docs:
+ collections:
+ api:
+ name: API Reference
+ nav_fold: false
+ tips:
+ name: Tips/Guides
+ nav_fold: false
+
+enable_copy_code_button: true
+
+color_scheme: resultwizard-colors
+callouts:
+ warning:
+ title: Warning
+ color: resultwizard-warning-purple
+ opacity: 0.1
+ tldr:
+ title: TL;DR
+ color: resultwizard-tldr
+ opacity: 0.15
diff --git a/docs/_includes/nav_footer_custom.html b/docs/_includes/nav_footer_custom.html
new file mode 100644
index 00000000..3f94c423
--- /dev/null
+++ b/docs/_includes/nav_footer_custom.html
@@ -0,0 +1,4 @@
+
diff --git a/docs/_includes/title.html b/docs/_includes/title.html
new file mode 100644
index 00000000..6b6eb0a9
--- /dev/null
+++ b/docs/_includes/title.html
@@ -0,0 +1,4 @@
+{% if site.logo %}
+
+{% endif %}
+{{ site.title }}
\ No newline at end of file
diff --git a/docs/_sass/color_schemes/resultwizard-colors.scss b/docs/_sass/color_schemes/resultwizard-colors.scss
new file mode 100644
index 00000000..783d1c34
--- /dev/null
+++ b/docs/_sass/color_schemes/resultwizard-colors.scss
@@ -0,0 +1,6 @@
+$resultwizard-blue: #1C6CB3;
+$resultwizard-purple-light: #A03F70;
+$resultwizard-purple-dark: #773377;
+
+$link-color: $resultwizard-purple-dark;
+$btn-primary-color: $resultwizard-purple-dark;
diff --git a/docs/_sass/custom/setup.scss b/docs/_sass/custom/setup.scss
new file mode 100644
index 00000000..a1fbd3bd
--- /dev/null
+++ b/docs/_sass/custom/setup.scss
@@ -0,0 +1,4 @@
+$resultwizard-warning-purple-000: #A03F70;
+$resultwizard-warning-purple-300: #773377;
+$resultwizard-tldr-000: #4699CD;
+$resultwizard-tldr-300: #1C6CB3;
diff --git a/docs/_tips/jupyter.md b/docs/_tips/jupyter.md
new file mode 100644
index 00000000..110d8f18
--- /dev/null
+++ b/docs/_tips/jupyter.md
@@ -0,0 +1,54 @@
+---
+layout: default
+title: Jupyter Notebook
+nav_order: 1
+---
+
+# Jupyter Notebook
+{: .no_toc }
+
+
+
+ Content
+
+ {: .text-delta }
+
+- TOC
+{:toc}
+
+
+
+{: .warning }
+Note that using a Jupyter Notebook **in a browser** won't make much sense in conjunction with `ResultWizard` as you won't be able to directly include the results in your LaTeX document. However, you can still use `ResultWizard` to export the `results.tex` file and copy the contents manually into your LaTeX document. But this is not the originally intended workflow and might be tedious
+
Note that VSCode offers great support for Jupyter Notebook natively, see [this guide](https://code.visualstudio.com/docs/datascience/jupyter-notebooks).
+
+## Useful configuration
+
+In the context of a [*Python Jupyter Notebook*](https://jupyter.org/), you might find this `ResultWizard` configuration useful:
+```py
+wiz.config_init(print_auto=True, export_auto_to="./results.tex", ignore_result_overwrite=True)
+```
+- With the `print_auto` option set to `True`, you will see the results printed to the console automatically without having to call `.print()` on them.
+- The `export_auto_to` option will automatically export the results to a file each time you call `.res()`. That is, you don't have to scroll down to the end of your notebook to call `wiz.export()`. Instead, just execute the cell where you call `.res()` and the results will be exported to the file you specified automatically.
+- With the `ignore_result_overwrite` option you won't see a warning if you overwrite a result with the same name. This is useful in Jupyter notebooks since cells are often executed multiple times.
+
+
+## Cell execution order & cache
+
+Watch out if you use [`wiz.config()`]({{site.baseurl}}/api/config) in a Jupyter Notebook. The order of the cell execution is what matters, not where they appear in the document. E.g. you might call `wiz.config()` somewhere at the end of your notebook. Then go back to the top and execute a cell with `wiz.res()`. The configuration will be applied to this cell as well. This is an inherent limitation/feature of Jupyter Notebooks, just be aware of it.
+
+It might be useful to reset the kernel and clear all outputs from time to time. This way, you can also check if your notebook still runs as expected from top to bottom and exports the results correctly. It can also help get rid of any clutter in `results.tex`, e.g. if you have exported a variable that you deleted later on in the code. This variable will still be in `results.tex` as deleting the `wiz.res()` line in the code doesn't remove the variable from the cache.
+
+
+## Omit output from last line
+
+In interactive python environments like Jupyter Notebooks, the last line of a cell is automatically printed to the console, so you might see something like the following under a cell:
+
+```
+
+```
+
+If you don't want this, you can add a semicolon `;` at the end of the last line in the cell (also see [this StackOverflow answer](https://stackoverflow.com/a/45519070/)). This will suppress the output. For example, write this:
+```py
+wiz.res("jupyter notebook output", 5.0, 0.1, unit="\m\per\s^2"); # <-- note the semicolon here
+```
\ No newline at end of file
diff --git a/docs/_tips/siunitx.md b/docs/_tips/siunitx.md
new file mode 100644
index 00000000..7f25663c
--- /dev/null
+++ b/docs/_tips/siunitx.md
@@ -0,0 +1,58 @@
+---
+layout: default
+title: Siunitx Configuration
+nav_order: 2
+---
+
+# `siunitx` Configuration
+{: .no_toc }
+
+
+
+ Content
+
+ {: .text-delta }
+
+- TOC
+{:toc}
+
+
+
+
+## Purpose
+
+The [`siunitx`] package offers a wide range of options to configure the formatting of numbers and units in LaTeX. In the exported `results.tex` file, we make use of `siunitx` syntax, e.g. we might transform a `wiz.res()` call into something like `\qty{1.23 \pm 0.05}{\m\per\s^2}` that you also could have written manually. This means, you have full control over how the numbers and units are displayed in your LaTeX document by configuring `siunitx` itself.
+
+If you want to configure `ResultWizard` itself instead, see the [`config_init()` & `config()`]({{site.baseurl}}/api/config) methods.
+
+
+## Important configuration options
+
+All options are specified as `key=value` pairs in `\sisetup{}` inside your LaTeX preamble (before `\begin{document}`), e.g.:
+```latex
+\usepackage{siunitx}
+\sisetup{
+ locale=US,
+ group-separator={,},
+ group-digits=integer,
+ per-mode=symbol,
+ uncertainty-mode=separate,
+}
+```
+
+Here, we present just a small (admittedly random) subset of the options of [`siunitx`]. See the **[`siunitx` documentation](https://texdoc.org/serve/siunitx/0).** for more details and all available options.
+
+[Siunitx Documentation](https://texdoc.org/serve/siunitx/0){: .btn .btn-primary .fs-5 .mb-4 .mb-md-0 .mr-2 }
+
+- `locale=UK|US|DE|PL|FR|SI|ZA`. This option sets the locale for the output of numbers and units, e.g. in English speaking countries, the decimal separator is a dot `1.234`, while in Germany it's a comma `1,234`.
+- `group-separator={,}`. This option sets the group separator, e.g. `1,234,567`.
+- `group-digits=integer=none|decimal|integer`. This option affects how the grouping into blocks of three is taking blace.
+- `per-mode=power|fraction|symbol`. This option allows to specify how `\per` is handled (e.g. in the case of this unit: `\joule\per\mole\per\kelvin`). `fraction` uses the `\frac{}` command, while `symbol` uses a `/` symbol per default (can be changed with `per-symbol`).
+- `uncertainty-mode=full|compact|compact-marker|separate`. When a single uncertainty is given, it can be printed in parentheses, e.g. `1.234(5)`, or with a `ยฑ` sign, e.g. `1.234 ยฑ 0.005` (use `separate` as option to achieve this). In older versions of `siunitx`, there existed the following flag instead: `separate-uncertainty=true|false` (it might still work in newer versions).
+- `exponent-product=\times`. This option allows to specify the product symbol between mantissa and exponent, e.g. `1.23 \times 10^3` or `1.23 \cdot 10^3`. The latter is more common in European countries. This is also affected by the `locale` option.
+
+
+
+
+
+[`siunitx`]: https://ctan.org/pkg/siunitx
diff --git a/docs/favicon.ico b/docs/favicon.ico
new file mode 100644
index 0000000000000000000000000000000000000000..65a75d9462c96b617c968d58ecbb827297812b3e
GIT binary patch
literal 9584
zcmcI~by$=^wD(K6w4`*2G*VL1As~$cBCvFafRr@5fG8az4K7GacP%B|-2&2xz|y%a
zcfH>~_xt|)o_p`S&v|C%dCxoZ&Y78We&@^p00#Q`mo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V@TP(kM|I(Jz1jM4n0DVAz187`dbk&Mn`l_{4QmG-iutTl2KN;e`JVD
zw+x2_kX=s-VEz6KK9l{c^nK}~%2xw?8IK7qKG2R{?8Y@ed~<~ZnA-xVBJ!L|=C`CH
z+RmDm&)Jlr-#RBAiMkehPB?ZnaD%7Qu=<0pMd-ZV?taT*EDD)=f~d8{2j?r0
z4leZ`AgNuMumD?Z;QV1P<9v`J|1d_L4+Xc=J0>~T>lD&YF{CIym5>>o2S0D!!K>@C
z^aS_g!nAcVb=fqn&$vl)QVK*i?{cjaJV)z(>j1wW0NK6bceT_`!-9_;Ytt6V`HNMj
z1{)!>F>(z+>(Jv;jaVWen-Y*Bb9~hTvHnztGK7GR*Ikp#?_(d%
z2QSgwKUWP}#r+jX`(otel6Ic)c=!!AFi?-*(lOPt9_*Sym
z!>F}sSt{iU`UGNlJz!7vpC^eJ3f>TatriUeIbUW
zVWM0sT2qBnQ8w}%eMbTQ0TeDC>^7d!LQH#bw?W&+)2*oR^sxqJfoX=rAp_u}i-n0R
zif#1$|52m=w^IGDH2}(vHhs)!V~4&K^FN!7)6L#vctEv?&lMiBqb&}gs-&e@u3#SW
EAMGcZHUIzs
literal 0
HcmV?d00001
diff --git a/docs/index.md b/docs/index.md
new file mode 100644
index 00000000..da53d172
--- /dev/null
+++ b/docs/index.md
@@ -0,0 +1,86 @@
+---
+layout: home
+title: Home
+nav_order: 1
+---
+
+

+
+
+# ResultWizard
+{: .fs-9 }
+
+Think of ResultWizard as the glue
+between Python code & your LaTeX work.
+
+{: .fs-6 .fw-300 }
+
+{% capture intro_link %}{% link pages/quickstart.md %}{% endcapture %}
+[Quickstart]({{intro_link}}){: .btn .btn-primary .fs-5 .mb-4 .mb-md-0 .mr-2 }
+[Source Code (GitHub)](https://github.com/resultwizard/ResultWizard){: .btn .fs-5 .mb-4 .mb-md-0 }
+[PyPI](https://pypi.org/project/resultwizard/){: .btn .fs-5 .mb-4 .mb-md-0 }
+
+
+{: .warning }
+ResultWizard is currently fully functional but still in its **alpha stage**, i.e. the API might change. We're happy to receive your feedback until the first stable release.
+
Please report any issues on [GitHub](https://github.com/resultwizard/ResultWizard/issues). To get the latest alpha version, you have to install it via
+
`pip install resultwizard==1.0.0a2` (otherwise you end up using the older version `0.1`).
+
+---
+
+
+## ๐ฅ The problem ResultWizard tries to solve
+
+Various scientific disciplines deal with huge amounts of experimental data on a daily basis. Oftentimes, this data is processed in Python to calculate important quantities. In the end, these quantities will get published in scientific papers written in LaTeX. You may have manually copied values from the Python console or a Jupyter notebook to a LaTeX document. This **lack of a programmatic interface between Python code & LaTeX** is what `ResultWizard` is addressing.
+
+## ๐ก How does ResultWizard help?
+
+In a nutshell, export any variables from Python including possible uncertainties and their units.
+
+```py
+# Your Python code
+import resultwizard as wiz
+wiz.res("Tour Eiffel Height", 330.362019, 0.5, "\m")
+wiz.res("g", 9.81, 0.78, "\m/\s^2")
+wiz.export("./results.tex")
+```
+
+This will generate a LaTeX file `results.tex`. Add this file to your LaTeX preamble:
+
+```latex
+% Your LaTeX preamble
+\input{./results.tex}
+\begin{document}
+...
+```
+
+Then, you can reference the variables in your LaTeX document:
+
+```latex
+% Your LaTeX document
+This allowed us to calculate the acceleration due to gravity $g$ as
+\begin{align}
+ g &= \resultG
+\end{align}
+Therefore, the height of the Eiffel Tower is given by $h = \resultTourEiffelHeight$.
+```
+
+It will render as follows:
+
+
+
+
+That's the gist of `ResultWizard`. Of course, there are many more features and customizations available.
+
+
+## Why shouldn't I continue to manually copy-paste values?
+
+Here's a few reasons why you should consider using `ResultWizard` as programmatic interface instead:
+
+- _Sync_: By manually copying values, you risk getting your LaTeX document out of sync with your Python code. The latter might have to be adjusted even during the writing process of your paper. And one line of code might change multiple variables that you have to update in your LaTeX document. With `ResultWizard`, you can simply re-export the variables and you're good to go:
+- _Significant figures_: `ResultWizard` takes care of significant figures rounding for you, e.g. a result `9.81 ยฑ 0.78` will be rendered as `9.8 ยฑ 0.8` in LaTeX (customizable).
+
+`ResultWizard` allows you to have your variables in one place: your Python code where you calculated them anyways. **Focus on your research, not on copying values around**.
+
+[Get started now]({{intro_link}}){: .btn .btn-primary .fs-5 .mb-4 .mb-md-0 .mr-2 }
diff --git a/docs/pages/about.md b/docs/pages/about.md
new file mode 100644
index 00000000..dcc3db18
--- /dev/null
+++ b/docs/pages/about.md
@@ -0,0 +1,38 @@
+---
+layout: default
+title: About
+permalink: about
+nav_order: 4
+---
+
+# About
+{: .no_toc }
+
+
+
+ Content
+
+ {: .text-delta }
+
+- TOC
+{:toc}
+
+
+
+
+## Little bit of history
+This project started out at the end of 2023 under the name `python2latex` when [*Paul Obernolte*](https://github.com/paul019) was working on reports for the practical parts of the physics curriculum at the University of Heidelberg. In these reports, experimental data was processed in Python and many results had to be included in LaTeX. The manual copy-paste process was error-prone and took too much time, so he started this project. Originally, it just consisted of one single file, that got the job done.
+
+In 2024, the project was renamed to `ResultWizard` as [*Dominic Plein*](https://github.com/splines) joined the team. Together, we completely redesigned the project, added new features and improved the code quality with linting, tests, CI/CD and a modular clean architecture approach. We set up a branding, published first alpha releases to PyPI and started this documentation. We learned many things along the way and are proud to have published our first Python package.
+
+We hope that `ResultWizard` will help you save time and make dealing with data in Python and LaTeX more enjoyable. If you have any feedback, please let us know on [GitHub](https://github.com/resultwizard/ResultWizard/issues). If you like the project, consider starring it on GitHub as we're always happy to see that people find our work (we're doing in our free-time) useful.
+
+
+## The future (plans for 2024)
+
+As of mid-April 2024, we're still in the alpha stage. But the first stable release is not that far away. We want to make sure we ship a solid product you can rely on, so expect a few more months of alpha testing. We're happy to receive your feedback until the first stable release. After this release, we plan to maintain the project (especially with regards to security fixes). But we will probably add new features only sparingly (in an effort to keep the API stable and in the light of our limited free-time resources).
+
+
+## Acknowledgements
+
+We like to thank the many great people in our surroundings who have helped make this project see the light of the day. We're grateful for the support of our friends, family and colleagues, both mentally and in the form of very concrete feedback as alpha testers. We also want to thank the open-source community for providing us with so many great tools and libraries, among others: [`siunitx`](https://github.com/josephwright/siunitx) by Joseph Wright, [`plum`](https://github.com/beartype/plum) by Wessel Bruinsma and other contributors as well as [`pylint`](https://github.com/pylint-dev/pylint/) by Pierre Sassoulas and others. We also want to thank the whole `Python` and `LaTeX` communities for providing us with such powerful tools to work with in the first place. And the [`just-the-docs`](https://github.com/just-the-docs/just-the-docs) contributors for such an amazing Docs theme. Thank you all! ๐
diff --git a/docs/pages/quickstart.md b/docs/pages/quickstart.md
new file mode 100644
index 00000000..3dde4770
--- /dev/null
+++ b/docs/pages/quickstart.md
@@ -0,0 +1,192 @@
+---
+layout: default
+title: Quickstart
+permalink: quickstart
+nav_order: 2
+---
+
+# Quickstart
+{: .no_toc }
+
+
+
+ Content
+
+ {: .text-delta }
+
+- TOC
+{:toc}
+
+
+
+
+
+## โ Is this for me?
+
+**Before you start and to avoid frustration**, let's make sure that `ResultWizard` is the right tool for you:
+
+- It's not primarily for you, if you're writing your LaTeX code in a web-based editor like Overleaf. `ResultWizard` is a Python package that will export a `.tex` file in the end. You have to include this file in your LaTeX project and the closer your Python code is to your LaTeX document, the easier it is to reference it without having to do anything manually in-between. You could still use `ResultWizard` in your Python code and manually copy the contents of the generated `results.tex` file into Overleaf, but this is not the originally intended workflow.
+- The same philosophy applies to Jupyter Notebooks that run in a browser. Instead, you should use a local Jupyter Notebook setup and have your LaTeX project reside next to your Python code. Using VSCode as editor is one way to do this. It has built-in support [for Jupyter Notebooks](https://code.visualstudio.com/docs/datascience/jupyter-notebooks) and with the [LaTeX Workshop extension](https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop) you can easily compile your LaTeX document and see the changes immediately. For a possible setup within WSL, see [this guide](https://github.com/Splines/vscode-latex-wsl-setup).
+
+Ideally, you'd have a folder structure where `code` (or `python` or `src` or whatever) and `thesis` (or `latex` or `document` or whatever) are folders on the same level. See also the [wiz.export() API]({{site.baseurl}}/api/export).
+
+Ideally, you also have used the [`siunitx`] LaTeX package beforehand to know how to format units, e.g. `\m\per\s^2`. But don't worry if you haven't, you can still use `ResultWizard` and learn about `siunitx` along the way. You might also want to check out the [siunitx configuration]({{site.baseurl}}/tips/siunitx) page.
+
+
+
+## ๐ป Installation & prerequisites
+
+{: .tldr }
+> Have a LaTeX toolchain including [`siunitx`] set up and Python `>=3.8` installed.
Then install the `ResultWizard` package via [`pip`]:
+> ```
+pip install resultwizard # use `pip install resultwizard==1.0.0a2` in the current alpha stage
+```
+> Move on to [Basic usage](#-basic-usage).
+
+
+
+### Python package
+
+You can install `ResultWizard` via [`pip`]:
+
+```
+pip install resultwizard
+```
+
+{: .warning }
+ResultWizard is currently fully functional but still in its **alpha stage**, i.e. the API might change. We're happy to receive your feedback until the first stable release.
+
Please report any issues on [GitHub](https://github.com/resultwizard/ResultWizard/issues). To get the latest alpha version, you have to install it via
+
`pip install resultwizard==1.0.0a2` (otherwise you end up using the older version `0.1`).
+
+Verify you're using the version you intended to install:
+
+```
+pip show resultwizard | grep Version
+```
+
+### LaTeX toolchain
+
+To compile the LaTeX document, you need a working LaTeX toolchain. If you don't have one yet, there are many guides available online for different OS, e.g. on the [LaTeX project website](https://www.latex-project.org/get/).
+- For MacOS, you might want to use [MacTex](https://www.tug.org/mactex/).
+- For Windows, we recommend [MikTex](https://miktex.org/).
+- For Linux (Ubuntu, e.g. also in WSL), we recommend [Tex Live](https://www.tug.org/texlive/)[^1]:
+```
+sudo apt install texlive texlive-latex-extra texlive-science
+```
+
+
+No matter what LaTeX distribution you're using, you will have to install the [`siunitx`] LaTeX package. This package is used to format numbers and units in LaTeX, e.g. for units you can use strings like `\kg\per\cm`. In the Tex Live distribution, this package is already included if you have installed `sudo apt texlive-science`.
+
+
+### Checklist
+
+- [x] Python `>=3.8` installed & `ResultWizard` installed via [`pip`]
+- [x] LaTeX toolchain set up, e.g. TeX Live
+- [x] [`siunitx`] LaTeX package installed
+
+
+
+
+
+
+
+
+## ๐ Basic usage
+
+{: .tldr }
+> 1. Import the library in your Python code, declare your results and export them:
+>```py
+# In your Python code
+import resultwizard as wiz
+wiz.res("Tour Eiffel Height", 330.362019, 0.5, "\m") # units must be `siunitx` compatible
+wiz.export("./results.tex")
+```
+> 2. Include the results in your LaTeX document:
+>```latex
+% In your LaTeX document
+\input{./results.tex}
+\begin{document}
+ The height of the Eiffel Tower is given by $h = \resultTourEiffelHeight$.
+ % also try out: $h = \resultTourEiffelHeight[value]$
+\end{document}
+```
+
+
+### 1. Declare & export variables in Python
+
+In your Python code, import `ResultWizard` and use the `wiz.res` function to declare your results. Then, export them to a LaTeX file by calling `wiz.export`. For the unit, you must use a [`siunitx`] compatible string, e.g. `\m` for meters or `\kg\per\s^2`. See the [siunitx docs](https://texdoc.org/serve/siunitx/0#page=42) for more information.
+
+```py
+import resultwizard as wiz
+
+# your complex calculations
+# ...
+value = 330.362019 # decimal places are made up
+uncertainty = 0.5
+wiz.res("Tour Eiffel Height", value, uncertainty, "\m").print()
+# will print: TourEiffelHeight = (330.4 ยฑ 0.5) m
+
+wiz.export("./results.tex")
+```
+There are many [more ways to call `wiz.res()`](TODO), try to use IntelliSense (`Ctrl + Space`) in your IDE to see all possibilities. If you want to omit any rounding, pass in values as string, e.g.:
+```py
+wiz.res("pi", "3.1415").print() # congrats, you found an exact value for pi!
+# will print: pi = 3.1415
+wiz.res("Tour Eiffel Height", str(value), str(uncertainty), "\m").print()
+# will print: TourEiffelHeight = (330.362019 ยฑ 0.5) m
+```
+
+You can also use the `wiz.config_init` function to set some defaults for the whole program. See many more [configuration options here](config).
+```py
+wiz.config_init(sigfigs_fallback=3, identifier="customResult")
+# default to 2 and "result" respectively
+```
+
+If you're working in a *Jupyter Notebook*, please see [this page]({{site.baseurl}}/tips/jupyter) for a suitable configuration of `ResultWizard` that doesn't annoy you with warnings and prints/exports the results automatically.
+
+
+### 2. Include results in LaTeX
+
+You have either called `wiz.export(.results.tex)` or set up automatic exporting with `wiz.config_init(export_auto_to="./results.tex")`. In any case, you end up with a LaTeX file `./results.tex`. Import it in your LaTeX preamble (you only have to do this once for every new document you create):
+
+```latex
+% Your LaTeX preamble
+\input{./results.tex}
+\begin{document}
+...
+```
+
+Then, you can reference the variables in your LaTeX document:
+
+```latex
+% Your LaTeX document
+This allowed us to calculate the acceleration due to gravity $g$ as
+\begin{align}
+ g &= \resultG
+\end{align}
+Therefore, the height of the Eiffel Tower is given by $h = \resultTourEiffelHeight$.
+```
+
+It will render as follows (given respective values for `g` and `Tour Eiffel Height` are exported):
+
+
+
+If you set up your IDE or your LaTeX editor properly, you can use IntelliSense (`Ctrl + Space`) here as well to see all available results, e.g. type `\resultTo`. Changing the value in Python and re-exporting will automatically update the value in your LaTeX document[^2].
+
+
+Also try out the following syntax:
+
+```latex
+% Your LaTeX document
+The unit of $h$ is $\resultTourEiffelHeight[unit]$ and its value is $\resultTourEiffelHeight[value]$.
+```
+
+Use `\resultTourEiffelHeight[x]` to get a message printed in your LaTeX document informing you about the possible strings you can use instead of `x` (e.g. `withoutUnit`, `value` etc.).
+
+---
+
+[^1]: For differences between texlive packages, see [this post](https://tex.stackexchange.com/a/504566/). For Ubuntu users, there's also an installation guide available [here](https://wiki.ubuntuusers.de/TeX_Live/#Installation). If you're interested to see how Tex Live can be configured in VSCode inside WSL, see [this post](https://github.com/Splines/vscode-latex-wsl-setup).
+[^2]: You have to recompile your LaTeX document, of course. But note that you can set up your LaTeX editor / IDE to recompile the PDF automatically for you as soon as any files, like `results.tex` change. For VSCode, you can use the [LaTeX Workshop extension](https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop) for this purpose, see a guide [here](https://github.com/Splines/vscode-latex-wsl-setup). In the best case, you only have to update a variable in your Python code (and run that code) and see the change in your PDF document immediately.
+
+[`siunitx`]: https://ctan.org/pkg/siunitx
+[`pip`]: https://pypi.org/project/resultwizard
diff --git a/docs/pages/trouble.md b/docs/pages/trouble.md
new file mode 100644
index 00000000..ff1951dc
--- /dev/null
+++ b/docs/pages/trouble.md
@@ -0,0 +1,94 @@
+---
+layout: default
+title: Troubleshooting
+permalink: trouble
+nav_order: 3
+---
+
+# Troubleshooting
+{: .no_toc }
+
+
+
+ Content
+
+ {: .text-delta }
+
+- TOC
+{:toc}
+
+
+
+There might be several reasons for your LaTeX document not building. **Try to find the root cause** by looking at the **log file** of your LaTeX compiler (sometimes you have to scroll way up to find the error responsible for the failing build). Also open the [exported]({{site.baseurl}}/api/export) `results.tex` file to see if your editor/IDE shows any errors there. You might encounter one of the following problems. Please make sure to try the solutions provided here before opening an [issue on GitHub](https://github.com/resultwizard/ResultWizard/issues).
+
+
+
+## Package siunitx: Invalid number
+
+{: .tldr}
+You have probably specified **multiple uncertainties** in `wiz.res()`, right? If this is the case and you get this error, you have an **old version of `siunitx`** installed. Please update it (recommended) or use the `siunitx_fallback` option in the [`config_init`]({{site.baseurl}}/api/config) method.
+
+In version [`v3.1.0 (2022-04-25)`](https://github.com/josephwright/siunitx/blob/main/CHANGELOG.md#v310---2022-04-25), `siunitx` introduced "support for multiple uncertainty values in both short and long form input". We make use of this feature in `ResultWizard` when you specify multiple uncertainties for a result.
+
+Unfortunately, it may be the case that you're using an older version of `siunitx` that doesn't ship with this feature yet. Especially if you've installed LaTeX via a package manager (e.g. you installed `siunitx` via `sudo apt install texlive-science`). To determine your `siunitx` version, include the following line in your LaTeX document:
+
+```latex
+\listfiles % add this before \begin{document}, i.e. in your LaTeX preamble
+```
+
+Then, compile your document and check the log for the version of `siunitx`.
+
If it's **older than `v3.1.0 (2022-04-25)`**, don't despair. We have two solutions for you:
+
+### Solution 1: Don't update `siunitx` and stick with your old version
+
+Sure, fine, we won't force you to update `siunitx` (although we'd recommend it). To keep using your old version, specify the following key in the `config_init` method:
+
+```python
+wiz.config_init(siunitx_fallback=True)
+```
+
+Note that with this "solution", you won't be able to fully customize the output of the result in your LaTeX document. For example, we will use a `ยฑ` between the value and the uncertainty, e.g. `3.14 ยฑ 0.02`. You won't be able to change this in your `sisetup` by specifying
+
+```latex
+\sisetup{separate-uncertainty=false}
+```
+
+to get another format like `3.14(2)`. There are also some other `siunitx` options that won't probably work with `ResultWizard`, e.g. [`exponent-product`](https://texdoc.org/serve/siunitx/0#page=29). If you're fine with this, go ahead and use the `siunitx_fallback` option. If not, consider updating `siunitx` to at least version `v3.1.0`.
+
+### Solution 2: Update `siunitx` (recommended, but more effort)
+
+How the update process works depends on your LaTeX distribution and how you installed it. E.g. you might be using `TeX Live` on `Ubuntu` and installed packages via `apt`, e.g. `sudo apt install texlive-science` (which includes the LaTeX `siunitx`). These pre-built packages are often outdated, e.g. for Ubuntu 22.04 LTS (jammy), the `siunitx` version that comes with the `texlive-science` package is `3.0.4`. Therefore, you might have to update `siunitx` manually. See an overview on how to install individual LaTeX packages on Linux [here](https://tex.stackexchange.com/a/73017/).
+
+A quick solution might be to simply install a new version of `siunitx` manually to your system. There's a great and short Ubuntu guide on how to install LaTeX packages manually [here](https://help.ubuntu.com/community/LaTeX#Installing_packages_manually). The following commands are based on this guide. We will download the version `3.1.11 (2022-12-05)` from GitHub (this is the last version before `3.2` where things might get more complicated to install) and install it locally. Don't be scared, do it one step at a time and use the power of GPTs and search engines in case you're stuck. Execute the following commands in your terminal:
+
+```sh
+# Install "unzip", a tool to extract zip files
+sudo apt install unzip
+
+# Download v3.1.11 of siunitx from GitHub
+curl -L https://github.com/josephwright/siunitx/releases/download/v3.1.11/siunitx-ctan.zip > siunitx-ctan-3.1.11.zip
+
+# Unzip the file
+unzip ./siunitx-ctan-3.1.11.zip
+cd siunitx/
+
+# Run LaTeX on the .ins file to generate a usable .sty file
+# (LaTeX needs the .sty file to know what to do with the \usepackage{siunitx}
+# command in your LaTeX preamble.)
+latex siunitx.ins
+
+# Create a new directory in your home directory
+# to store the new package .sty file
+mkdir -p ~/texmf/tex/latex/siunitx # use any location you want, but this one is common
+cp siunitx.sty ~/texmf/tex/latex/siunitx/
+
+# Make LaTeX recognize the new package by pointing it to the new directory
+texhash ~/texmf/
+```
+
+๐ Done. Try to recompile your LaTeX document again. You should see version `v3.1.11` of `siunitx` in the log file. And it should build. Don't forget to remove the `\listfiles` from your LaTeX document to avoid cluttering your log file (which is ironic for LaTeX, we know).
+
+In case you don't wan't the new siunitx version anymore, just run the following command to remove the `.sty` file. LaTeX will then use the version of siunitx it finds somewhere else in your system (which is probably the outdated one you had before).
+```sh
+rm ~/texmf/tex/latex/siunitx/siunitx.sty
+```
diff --git a/pyproject.toml b/pyproject.toml
index 2d95a481..7113c443 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -45,15 +45,12 @@ classifiers = [
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
-dependencies = [
- "plum-dispatch ~= 2.3"
-]
[project.urls]
-Homepage = "https://github.com/paul019/ResultWizard"
-Repository = "https://github.com/paul019/ResultWizard"
-Issues = "https://github.com/paul019/ResultWizard/issues"
-Changelog = "https://github.com/paul019/ResultWizard/blob/main/CHANGELOG.md"
+Homepage = "https://resultwizard.github.io/ResultWizard/"
+Repository = "https://github.com/resultwizard/ResultWizard"
+Issues = "https://github.com/resultwizard/ResultWizard/issues"
+Changelog = "https://github.com/resultwizard/ResultWizard/blob/main/CHANGELOG.md"
# TODO: Add these checks back
[tool.pylint."messages control"]
diff --git a/src/api/console_stringifier.py b/src/api/console_stringifier.py
index a1b9a980..e3a77dbc 100644
--- a/src/api/console_stringifier.py
+++ b/src/api/console_stringifier.py
@@ -13,8 +13,8 @@ class ConsoleStringifier(Stringifier):
value_prefix = ""
value_suffix = ""
- error_name_prefix = " ("
- error_name_suffix = ")"
+ uncertainty_name_prefix = " ("
+ uncertainty_name_suffix = ")"
scientific_notation_prefix = "e"
scientific_notation_suffix = ""
diff --git a/src/api/parsers.py b/src/api/parsers.py
index 87bbd921..c54f6511 100644
--- a/src/api/parsers.py
+++ b/src/api/parsers.py
@@ -12,7 +12,7 @@ def check_if_number_string(value: str) -> None:
try:
float(value)
except ValueError as exc:
- raise ValueError(error_messages.STRING_MUST_BE_NUMBER.format(value)) from exc
+ raise ValueError(error_messages.STRING_MUST_BE_NUMBER.format(value=value)) from exc
def parse_name(name: str) -> str:
@@ -204,7 +204,12 @@ def _parse_uncertainty_value(value: Union[float, int, str, Decimal]) -> Value:
"""Parses the value of an uncertainty."""
if isinstance(value, str):
- check_if_number_string(value)
+ try:
+ check_if_number_string(value)
+ except Exception as exc:
+ msg = error_messages.STRING_MUST_BE_NUMBER.format(value=value)
+ msg += ". " + error_messages.UNIT_NOT_PASSED_AS_KEYWORD_ARGUMENT
+ raise ValueError(msg) from exc
return_value = parse_exact_value(value)
else:
return_value = Value(Decimal(value))
diff --git a/src/api/res.py b/src/api/res.py
index dffd89f9..9f5220ce 100644
--- a/src/api/res.py
+++ b/src/api/res.py
@@ -1,6 +1,5 @@
from decimal import Decimal
from typing import Union, List, Tuple
-from plum import dispatch, overload
from api.printable_result import PrintableResult
from api import parsers
@@ -16,66 +15,13 @@
import api.config as c # pylint: disable=wrong-import-position,ungrouped-imports
-@overload
+# pylint: disable-next=too-many-arguments,redefined-builtin,too-many-locals
def res(
name: str,
value: Union[float, int, str, Decimal],
- unit: str = "",
- sigfigs: Union[int, None] = None,
- decimal_places: Union[int, None] = None,
-) -> PrintableResult:
- return res(name, value, [], unit, sigfigs, decimal_places)
-
-
-@overload
-def res(
- name: str,
- value: Union[float, int, str, Decimal],
- uncert: Union[
- float,
- str,
- Decimal,
- Tuple[Union[float, int, str, Decimal], str],
- List[Union[float, int, str, Decimal, Tuple[Union[float, int, str, Decimal], str]]],
- None,
- ] = None,
- sigfigs: Union[int, None] = None,
- decimal_places: Union[int, None] = None,
-) -> PrintableResult:
- return res(name, value, uncert, "", sigfigs, decimal_places)
-
-
-@overload
-def res(
- name: str,
- value: Union[float, int, str, Decimal],
- sigfigs: Union[int, None] = None,
- decimal_places: Union[int, None] = None,
-) -> PrintableResult:
- return res(name, value, [], "", sigfigs, decimal_places)
-
-
-@overload
-# pylint: disable=too-many-arguments
-def res(
- name: str,
- value: Union[float, int, str, Decimal],
- sys: Union[float, Decimal],
- stat: Union[float, Decimal],
- unit: str = "",
- sigfigs: Union[int, None] = None,
- decimal_places: Union[int, None] = None,
-) -> PrintableResult:
- return res(name, value, [(sys, "sys"), (stat, "stat")], unit, sigfigs, decimal_places)
-
-
-@overload
-# pylint: disable=too-many-arguments,redefined-builtin,too-many-locals
-def res(
- name: str,
- value: Union[float, int, str, Decimal],
- uncert: Union[
+ uncerts: Union[
float,
+ int,
str,
Decimal,
Tuple[Union[float, int, str, Decimal], str],
@@ -83,13 +29,22 @@ def res(
None,
] = None,
unit: str = "",
+ sys: Union[float, int, str, Decimal, None] = None,
+ stat: Union[float, int, str, Decimal, None] = None,
sigfigs: Union[int, None] = None,
decimal_places: Union[int, None] = None,
print: Union[bool, None] = None,
) -> PrintableResult:
- if uncert is None:
- uncert = []
+ """
+ Declares your result. Give it a name and a value. You may also optionally provide
+ uncertainties (via `uncert` or `sys`/`stat`) and a unit in `siunitx` format.
+
+ You may additionally specify the number of significant figures or decimal places
+ to round this specific result to, irrespective of your global configuration.
+ TODO: provide a link to the docs for more information and examples.
+ """
+ # Verify user input
if sigfigs is not None and decimal_places is not None:
raise ValueError(error_messages.SIGFIGS_AND_DECIMAL_PLACES_AT_SAME_TIME)
@@ -99,10 +54,24 @@ def res(
if decimal_places is not None and isinstance(value, str):
raise ValueError(error_messages.DECIMAL_PLACES_AND_EXACT_VALUE_AT_SAME_TIME)
+ sys_or_stat_specified = sys is not None or stat is not None
+ if uncerts is not None and sys_or_stat_specified:
+ raise ValueError(error_messages.UNCERT_AND_SYS_STAT_AT_SAME_TIME)
+
+ if sys_or_stat_specified:
+ uncerts = []
+ if sys is not None:
+ uncerts.append((sys, "sys"))
+ if stat is not None:
+ uncerts.append((stat, "stat"))
+
+ if uncerts is None:
+ uncerts = []
+
# Parse user input
name_res = parsers.parse_name(name)
value_res = parsers.parse_value(value)
- uncertainties_res = parsers.parse_uncertainties(uncert)
+ uncertainties_res = parsers.parse_uncertainties(uncerts)
unit_res = parsers.parse_unit(unit)
sigfigs_res = parsers.parse_sigfigs(sigfigs)
decimal_places_res = parsers.parse_decimal_places(decimal_places)
@@ -125,13 +94,3 @@ def res(
_export(immediate_export_path, print_completed=False)
return printable_result
-
-
-# Hack for method "overloading" in Python
-# see https://beartype.github.io/plum/integration.html
-# This is a good writeup: https://stackoverflow.com/a/29091980/
-@dispatch
-def res(*args, **kwargs) -> object: # pylint: disable=unused-argument
- # This method only scans for all `overload`-decorated methods
- # and properly adds them as Plum methods.
- pass
diff --git a/src/application/error_messages.py b/src/application/error_messages.py
index 94f05490..d4c019f4 100644
--- a/src/application/error_messages.py
+++ b/src/application/error_messages.py
@@ -18,11 +18,15 @@
DECIMAL_PLACES_AND_EXACT_VALUE_AT_SAME_TIME = (
"You can't set decimal places and supply an exact value. Please do one or the other."
)
+UNCERT_AND_SYS_STAT_AT_SAME_TIME = (
+ "You can't set uncertainties and systematic/statistical uncertainties at the same time. "
+ "Please provide either the `uncert` param or the `sys`/`stat` params."
+)
# Parser error messages (generic)
STRING_MUST_BE_NUMBER = "String value must be a valid number, not {value}"
-FIELD_MUST_BE_STRING = "{field} must be a string, not {type}}"
-FIELD_MUST_BE_INT = "{field} must be an int, not {type}}"
+FIELD_MUST_BE_STRING = "{field} must be a string, not {type}"
+FIELD_MUST_BE_INT = "{field} must be an int, not {type}"
FIELD_MUST_NOT_BE_EMPTY = "{field} must not be empty"
FIELD_MUST_BE_POSITIVE = "{field} must be positive"
FIELD_MUST_BE_NON_NEGATIVE = "{field} must be non-negative"
@@ -35,15 +39,18 @@
UNCERTAINTIES_MUST_BE_TUPLES_OR = (
"Each uncertainty must be a tuple or a float/int/Decimal/str, not {type}"
)
+UNIT_NOT_PASSED_AS_KEYWORD_ARGUMENT = (
+ "Could it be the case you provided a unit but forgot `unit=` in front of it?"
+)
-# Helpers:
+# Helpers
PRECISION_TOO_LOW = (
"Your precision is set too low to be able to process the given value without any loss of "
"precision. Set a higher precision via: `wiz.config_init (precision=)`."
)
NUMBER_TO_WORD_TOO_HIGH = "For variable names, only use numbers between 0 and 999. Got {number}."
-# Runtime errors:
+# Runtime errors
SHORT_RESULT_IS_NONE = "Short result is None, but there should be at least two uncertainties."
INTERNAL_ROUNDER_HIERARCHY_ERROR = "Internal rounder hierarchy error. Please report this bug."
INTERNAL_MIN_EXPONENT_ERROR = "Internal min_exponent not set error. Please report this bug."
@@ -51,7 +58,7 @@
"Internal rounding to negative decimal places. Please report this bug."
)
-# Warnings:
+# Warnings
INVALID_CHARS_IGNORED = "Invalid characters in name were ignored: {chars}"
NUM_OF_DECIMAL_PLACES_TOO_LOW = (
"Warning: At least one of the specified values is out of range of the specified "
diff --git a/src/application/latex_better_siunitx_stringifier.py b/src/application/latex_better_siunitx_stringifier.py
index 4911c33c..46ee91b9 100644
--- a/src/application/latex_better_siunitx_stringifier.py
+++ b/src/application/latex_better_siunitx_stringifier.py
@@ -22,8 +22,8 @@ class LatexBetterSiunitxStringifier(Stringifier):
value_prefix = ""
value_suffix = ""
- error_name_prefix = r"\Uncert"
- error_name_suffix = ""
+ uncertainty_name_prefix = r"\Uncert"
+ uncertainty_name_suffix = ""
scientific_notation_prefix = "e"
scientific_notation_suffix = ""
diff --git a/src/application/latex_commandifier.py b/src/application/latex_commandifier.py
index 0b06f193..8012f41a 100644
--- a/src/application/latex_commandifier.py
+++ b/src/application/latex_commandifier.py
@@ -26,29 +26,29 @@ def result_to_latex_cmd(self, result: Result) -> str:
builder.add_branch("", self.result_to_latex_str(result))
builder.add_branch("value", self.result_to_latex_str_value(result))
- # Without error
+ # Without uncertainty
if len(result.uncertainties) > 0:
- builder.add_branch("withoutError", self.result_to_latex_str_without_error(result))
+ builder.add_branch("withoutUncert", self.result_to_latex_str_without_uncert(result))
# Single uncertainties
for i, u in enumerate(result.uncertainties):
if len(result.uncertainties) == 1:
- uncertainty_name = "error"
+ uncertainty_name = "uncert"
else:
uncertainty_name = u.name if u.name != "" else Helpers.number_to_word(i + 1)
- uncertainty_name = f"error{Helpers.capitalize(uncertainty_name)}"
- error_latex_str = self.s.create_str(u.uncertainty, [], result.unit)
- builder.add_branch(uncertainty_name, error_latex_str)
+ uncertainty_name = f"uncert{Helpers.capitalize(uncertainty_name)}"
+ uncertainty_latex_str = self.s.create_str(u.uncertainty, [], result.unit)
+ builder.add_branch(uncertainty_name, uncertainty_latex_str)
# Total uncertainty and short result
if len(result.uncertainties) >= 2:
short_result = result.get_short_result()
if short_result is None:
raise RuntimeError(error_messages.SHORT_RESULT_IS_NONE)
- error_latex_str = self.s.create_str(
+ uncertainty_latex_str = self.s.create_str(
short_result.uncertainties[0].uncertainty, [], result.unit
)
- builder.add_branch("errorTotal", error_latex_str)
+ builder.add_branch("uncertTotal", uncertainty_latex_str)
builder.add_branch("short", self.result_to_latex_str(short_result))
# Unit
@@ -82,9 +82,9 @@ def result_to_latex_str_value(self, result: Result) -> str:
"""
return self.s.create_str(result.value, [], "")
- def result_to_latex_str_without_error(self, result: Result) -> str:
+ def result_to_latex_str_without_uncert(self, result: Result) -> str:
"""
- Returns the result without error as LaTeX string making use of the siunitx package.
+ Returns the result without uncertainty as LaTeX string making use of the siunitx package.
"""
return self.s.create_str(result.value, [], result.unit)
diff --git a/src/application/latex_stringifier.py b/src/application/latex_stringifier.py
index 4380b385..08ae6f1b 100644
--- a/src/application/latex_stringifier.py
+++ b/src/application/latex_stringifier.py
@@ -19,8 +19,8 @@ class LatexStringifier(Stringifier):
value_prefix = r"\num{"
value_suffix = r"}"
- error_name_prefix = r"_{\text{"
- error_name_suffix = r"}}"
+ uncertainty_name_prefix = r"_{\text{"
+ uncertainty_name_suffix = r"}}"
scientific_notation_prefix = r" \cdot 10^{"
scientific_notation_suffix = "}"
diff --git a/src/application/stringifier.py b/src/application/stringifier.py
index ce78fdcd..35d70406 100644
--- a/src/application/stringifier.py
+++ b/src/application/stringifier.py
@@ -38,8 +38,8 @@ class Stringifier(Protocol):
value_prefix: ClassVar[str]
value_suffix: ClassVar[str]
- error_name_prefix: ClassVar[str]
- error_name_suffix: ClassVar[str]
+ uncertainty_name_prefix: ClassVar[str]
+ uncertainty_name_suffix: ClassVar[str]
scientific_notation_prefix: ClassVar[str]
scientific_notation_suffix: ClassVar[str]
@@ -68,9 +68,9 @@ def create_str(self, value: Value, uncertainties: List[Uncertainty], unit: str)
u_rounded = self._uncertainty_to_str(u, use_scientific_notation, exponent, factor)
u_rounded = f" {self.plus_minus} {self.value_prefix}{u_rounded}{self.value_suffix}"
if u.name != "":
- u_rounded += self.error_name_prefix
+ u_rounded += self.uncertainty_name_prefix
u_rounded += self._modify_uncertainty_name(u.name)
- u_rounded += self.error_name_suffix
+ u_rounded += self.uncertainty_name_suffix
uncertainties_rounded.append(u_rounded)
# Assemble everything together
diff --git a/tests/playground.py b/tests/playground.py
index 2f28ad52..6d7f52a7 100644
--- a/tests/playground.py
+++ b/tests/playground.py
@@ -32,37 +32,35 @@
# wiz.res("", 42.0).print()
# -> Error: "name must not be empty"
-wiz.res("a911", 1.05, r"\mm\s\per\N\kg")
+wiz.res("a911", 1.05, unit=r"\mm\s\per\N\kg")
# wiz.res("a911", "1.052", 0.25, r"\mm\s\per\N\kg")
-wiz.res("1 b", 1.0, 0.01, r"\per\mm\cubed")
+wiz.res("1 b", 1.0, 0.01, unit=r"\per\mm\cubed")
# wiz.config(decimal_places=-1, sigfigs_fallback=3)
wiz.res("c big", 1.0, (0.01, "systematic"), r"\mm")
-wiz.res("d", 1.0e10, [(0.01e10, "systematic"), (0.0294999e10, "stat")], r"\mm\per\second\squared")
-wiz.res("e", "1.0", r"\mm")
+wiz.res("d", 1.0e10, [(0.01e10, "sysyeah"), (0.0294999e10, "statyeah")], r"\mm\per\second^2")
+# wiz.res("e", "1.0", r"\mm") # -> except error message that maybe we have forgotten to put `unit=`
+
wiz.res("f", "1.0e1", 25e-1)
wiz.res("g", 42)
-wiz.res("h", 42, 13.0, 24.0)
-wiz.res("h&", 42, 13.0, 24.0)
-wiz.res("i", Decimal("42.0e-30"), Decimal("0.1e-31"), r"\m")
-wiz.res("i", Decimal("42.0e-30"), Decimal("0.1e-31"), Decimal("0.05e-31"), r"\m\per\s\squared")
-wiz.res("j", 0.009, None, None, 2)
-# wiz.res("k", 1.55, 0.0, r"\tesla") # -> uncertainty must be positive
-
-# wiz.res("k", 3, 1, r"\tesla") # -> plum: Could not be resolved
-# TODO: Find out if one can adjust the plum.resolver.NotFoundLookupError such that
-# we can give better hints, e.g. "you cannot pass in value and uncertainty as integers"
-
-# wiz.res("g", 1.0, sys=0.01, stat=0.02, unit=r"\mm").print()
-# g: (1.0 ยฑ 0.01 sys ยฑ 0.02 stat) \mm
-# TODO: Why does this not work?
-# -> This fix might help: https://github.com/beartype/plum/issues/40#issuecomment-1836613508
-
-# The following wont' work as we can't have positional arguments (here: unit)
-# after keyword arguments (here: uncert)
-# wiz.res("d", 1.0, uncert=[(0.01, "systematic"), (0.02, "stat")], r"\mm").print()
+wiz.res("h", 42, sys=13.0, stat=24.0)
+wiz.res("h&", 42, sys=13.0, stat=24.0)
+
+wiz.res("i", Decimal("42.0e-30"), Decimal("0.1e-31"), unit=r"\m")
+wiz.res(
+ "i",
+ Decimal("42.0e-30"),
+ sys=Decimal("0.1e-31"),
+ stat=Decimal("0.05e-31"),
+ unit=r"\m\per\s\squared",
+)
+wiz.res("j", 0.009, None, "", 2) # really bad, but this is valid
+# wiz.res("k", 1.55, 0.0, unit=r"\tesla") # -> uncertainty must be positive
+wiz.res("k", 3, 1, r"\tesla") # integers work as well, yeah
+wiz.res("l", 1.0, sys=0.01, stat=0.02, unit=r"\mm").print()
+wiz.res("m", 1.0, uncerts=[(0.01, "systematic"), (0.02, "stat")], unit=r"\mm").print()
# wiz.table(
# "name",
@@ -75,6 +73,8 @@
# horizontal = True,
# )
+wiz.res("Tour Eiffel Height", "330.3141516", "0.5", r"\m")
+wiz.res("g Another Test", 9.81, 0.78, unit=r"\m/\s^2")
#############################
# Export
From 2ef0ce140a0c2ef399f652b04b08e1b49ee60125 Mon Sep 17 00:00:00 2001
From: paul019 <39464035+paul019@users.noreply.github.com>
Date: Mon, 9 Sep 2024 11:22:13 +0200
Subject: [PATCH 09/10] Disable pylint warning
---
src/api/res.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/api/res.py b/src/api/res.py
index 9f5220ce..101a3fcd 100644
--- a/src/api/res.py
+++ b/src/api/res.py
@@ -15,7 +15,7 @@
import api.config as c # pylint: disable=wrong-import-position,ungrouped-imports
-# pylint: disable-next=too-many-arguments,redefined-builtin,too-many-locals
+# pylint: disable-next=too-many-arguments,too-many-locals
def res(
name: str,
value: Union[float, int, str, Decimal],
@@ -33,7 +33,7 @@ def res(
stat: Union[float, int, str, Decimal, None] = None,
sigfigs: Union[int, None] = None,
decimal_places: Union[int, None] = None,
- print: Union[bool, None] = None,
+ print: Union[bool, None] = None, # pylint: disable=redefined-builtin
) -> PrintableResult:
"""
Declares your result. Give it a name and a value. You may also optionally provide
From 336a71dfeabd9bcac62385855d205e9ad0eb7379 Mon Sep 17 00:00:00 2001
From: Splines
Date: Wed, 11 Sep 2024 14:59:02 +0200
Subject: [PATCH 10/10] Revert "Squashed commit of the following:"
This reverts commit 1f775ff634e2622c9f98f2e66ad73011195aec5c.
---
.github/workflows/docs-verify.yml | 32 ---
.github/workflows/docs.yml | 69 -------
.vscode/settings.json | 4 +-
DEVELOPMENT.md | 2 +-
Pipfile | 1 +
Pipfile.lock | 54 ++++-
README.md | 155 +++++++++++++-
TODO.md | 14 +-
docs/.gitignore | 12 --
docs/404.html | 26 ---
docs/Gemfile | 4 -
docs/Gemfile.lock | 82 --------
docs/README.md | 13 --
docs/_api/config.md | 54 -----
docs/_api/export.md | 39 ----
docs/_api/res.md | 123 -----------
docs/_config.yml | 41 ----
docs/_includes/nav_footer_custom.html | 4 -
docs/_includes/title.html | 4 -
.../color_schemes/resultwizard-colors.scss | 6 -
docs/_sass/custom/setup.scss | 4 -
docs/_tips/jupyter.md | 54 -----
docs/_tips/siunitx.md | 58 ------
docs/favicon.ico | Bin 9584 -> 0 bytes
docs/index.md | 86 --------
docs/pages/about.md | 38 ----
docs/pages/quickstart.md | 192 ------------------
docs/pages/trouble.md | 94 ---------
pyproject.toml | 11 +-
src/api/console_stringifier.py | 4 +-
src/api/parsers.py | 9 +-
src/api/res.py | 99 ++++++---
src/application/error_messages.py | 17 +-
.../latex_better_siunitx_stringifier.py | 4 +-
src/application/latex_commandifier.py | 20 +-
src/application/latex_stringifier.py | 4 +-
src/application/stringifier.py | 8 +-
tests/playground.py | 46 ++---
38 files changed, 331 insertions(+), 1156 deletions(-)
delete mode 100644 .github/workflows/docs-verify.yml
delete mode 100644 .github/workflows/docs.yml
delete mode 100644 docs/.gitignore
delete mode 100644 docs/404.html
delete mode 100644 docs/Gemfile
delete mode 100644 docs/Gemfile.lock
delete mode 100644 docs/README.md
delete mode 100644 docs/_api/config.md
delete mode 100644 docs/_api/export.md
delete mode 100644 docs/_api/res.md
delete mode 100644 docs/_config.yml
delete mode 100644 docs/_includes/nav_footer_custom.html
delete mode 100644 docs/_includes/title.html
delete mode 100644 docs/_sass/color_schemes/resultwizard-colors.scss
delete mode 100644 docs/_sass/custom/setup.scss
delete mode 100644 docs/_tips/jupyter.md
delete mode 100644 docs/_tips/siunitx.md
delete mode 100644 docs/favicon.ico
delete mode 100644 docs/index.md
delete mode 100644 docs/pages/about.md
delete mode 100644 docs/pages/quickstart.md
delete mode 100644 docs/pages/trouble.md
diff --git a/.github/workflows/docs-verify.yml b/.github/workflows/docs-verify.yml
deleted file mode 100644
index 18c603e2..00000000
--- a/.github/workflows/docs-verify.yml
+++ /dev/null
@@ -1,32 +0,0 @@
-name: Documentation
-
-on:
- pull_request:
- types: [opened, reopened, synchronize, ready_for_review]
- paths:
- - "docs/**"
-
-jobs:
- # Just check that the build works and doesn't throw any errors
- # The actual build and deployment is done on the main branch
- # with another GitHub Actions workflow.
- build:
- name: Build
- runs-on: ubuntu-latest
- defaults:
- run:
- working-directory: docs
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
-
- - name: Setup Ruby
- uses: ruby/setup-ruby@v1
- with:
- ruby-version: '3.1'
- bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- cache-version: 0 # Increment this number if you need to re-download cached gems
- working-directory: '${{ github.workspace }}/docs'
-
- - name: Build with Jekyll
- run: bundle exec jekyll build
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
deleted file mode 100644
index ee97c592..00000000
--- a/.github/workflows/docs.yml
+++ /dev/null
@@ -1,69 +0,0 @@
-# See the template here: https://github.com/just-the-docs/just-the-docs-template
-
-name: Documentation
-
-on:
- push:
- branches:
- - "main"
- paths:
- - "docs/**"
-
- # Allows you to run this workflow manually from the Actions tab
- workflow_dispatch:
-
-# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
-permissions:
- contents: read
- pages: write # to deploy to Pages
- id-token: write # to verify the deployment originates from an appropriate source
-
-# Allow one concurrent deployment
-concurrency:
- group: "pages"
- cancel-in-progress: true
-
-jobs:
- build:
- runs-on: ubuntu-latest
- defaults:
- run:
- working-directory: docs
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
-
- - name: Setup Ruby
- uses: ruby/setup-ruby@v1
- with:
- ruby-version: '3.1'
- bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- cache-version: 0 # Increment this number if you need to re-download cached gems
- working-directory: '${{ github.workspace }}/docs'
-
- - name: Setup Pages
- id: pages
- uses: actions/configure-pages@v5
-
- - name: Build with Jekyll
- # Outputs to the './_site' directory by default
- run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
- env:
- JEKYLL_ENV: production
-
- # Automatically creates an github-pages artifact used by the deployment job
- - name: Upload artifact
- uses: actions/upload-pages-artifact@v3
- with:
- path: "docs/_site/"
-
- deploy:
- environment:
- name: github-pages
- url: ${{ steps.deployment.outputs.page_url }}
- runs-on: ubuntu-latest
- needs: build
- steps:
- - name: Deploy to GitHub Pages
- id: deployment
- uses: actions/deploy-pages@v4
diff --git a/.vscode/settings.json b/.vscode/settings.json
index bd636e55..97e171c4 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -30,8 +30,7 @@
"files.exclude": {
"**/__pycache__/": true,
"**/*.egg-info/": true,
- "**/.pytest_cache/": true,
- "**/.jekyll-cache/": true
+ ".pytest_cache/": true
},
//////////////////////////////////////
// Editor
@@ -87,7 +86,6 @@
"texttt",
"TLDR",
"uncert",
- "uncerts",
"usepackage"
]
}
\ No newline at end of file
diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md
index 01e04685..e83c4639 100644
--- a/DEVELOPMENT.md
+++ b/DEVELOPMENT.md
@@ -9,7 +9,7 @@ Getting ready:
- [ ] Recommended VSCode extensions installed (especially the formatter. It should automatically format on every save!)
- [ ] on branch `value-wizard` with latest commit pulled
- [ ] Work through the `Setup` section below (especially to install the necessary dependencies)
-- [ ] Read the [`README.md`](https://github.com/resultwizard/ResultWizard/tree/main/src#code-structure) in the `src` folder (to get to know the code structure) & see our [feature list](https://github.com/resultwizard/ResultWizard/issues/16)
+- [ ] Read the [`README.md`](https://github.com/paul019/ResultWizard/tree/value-wizard/src#code-structure) in the `src` folder (to get to know the code structure) & see our [feature list](https://github.com/paul019/ResultWizard/issues/16)
Verify that everything worked:
- [ ] try to run the tests, see the instructions in [`tests/playground.py`](./tests/playground.py)
diff --git a/Pipfile b/Pipfile
index 70624017..cc9fe33d 100644
--- a/Pipfile
+++ b/Pipfile
@@ -4,6 +4,7 @@ verify_ssl = true
name = "pypi"
[packages]
+plum-dispatch = "~=2.3"
[dev-packages]
pylint = "~=3.0"
diff --git a/Pipfile.lock b/Pipfile.lock
index 94768b86..37d8af23 100644
--- a/Pipfile.lock
+++ b/Pipfile.lock
@@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
- "sha256": "a5f83ecca60c4365a35a8eb10b1051286f4099f88ff14dab578be8367888ba0e"
+ "sha256": "cbec9547e5137a6a3a0f7ba14ff98a24a53adb966549045956b3e506835e0bdf"
},
"pipfile-spec": 6,
"requires": {
@@ -15,7 +15,57 @@
}
]
},
- "default": {},
+ "default": {
+ "beartype": {
+ "hashes": [
+ "sha256:c22b21e1f785cfcf5c4d3d13070f532b6243a3ad67e68d2298ff08d539847dce",
+ "sha256:e911e1ae7de4bccd15745f7643609d8732f64de5c2fb844e89cbbed1c5a8d495"
+ ],
+ "markers": "python_full_version >= '3.8.0'",
+ "version": "==0.17.2"
+ },
+ "markdown-it-py": {
+ "hashes": [
+ "sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1",
+ "sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb"
+ ],
+ "markers": "python_version >= '3.8'",
+ "version": "==3.0.0"
+ },
+ "mdurl": {
+ "hashes": [
+ "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8",
+ "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"
+ ],
+ "markers": "python_version >= '3.7'",
+ "version": "==0.1.2"
+ },
+ "plum-dispatch": {
+ "hashes": [
+ "sha256:96f519d416accf9a009117682f689114eb23e867bb6f977eed74ef85ef7fef9d",
+ "sha256:f49f00dfdf7ab0f16c9b85cc27cc5241ffb59aee02218bac671ec7c1ac65e139"
+ ],
+ "index": "pypi",
+ "markers": "python_version >= '3.8'",
+ "version": "==2.3.2"
+ },
+ "pygments": {
+ "hashes": [
+ "sha256:b27c2826c47d0f3219f29554824c30c5e8945175d888647acd804ddd04af846c",
+ "sha256:da46cec9fd2de5be3a8a784f434e4c4ab670b4ff54d605c4c2717e9d49c4c367"
+ ],
+ "markers": "python_version >= '3.7'",
+ "version": "==2.17.2"
+ },
+ "rich": {
+ "hashes": [
+ "sha256:4edbae314f59eb482f54e9e30bf00d33350aaa94f4bfcd4e9e3110e64d0d7222",
+ "sha256:9be308cb1fe2f1f57d67ce99e95af38a1e2bc71ad9813b0e247cf7ffbcc3a432"
+ ],
+ "markers": "python_full_version >= '3.7.0'",
+ "version": "==13.7.1"
+ }
+ },
"develop": {
"astroid": {
"hashes": [
diff --git a/README.md b/README.md
index a594386d..cec3a7a9 100644
--- a/README.md
+++ b/README.md
@@ -1,17 +1,156 @@
-
-
-
+
ResultWizard
Intelligent interface between Python-computed values and your LaTeX work
-Annoyed of having to copy around values from Python code to your LaTeX work? Think of `ResultWizard` as an interface between the two. Export any variables from Python including possible uncertainties and their units and directly reference them in your LaTeX document.
-
> **Warning โ **
-> ResultWizard is still in its *alpha* stage. We're happy to receive your feedback, e.g. report any bugs. But note that the API might still change before we hit the first stable release 1.0.0.
+> ResultWizard is currently fully functional but still in its *alpha* stage. We're happy to receive your feedback. Basic usage is as follows. A more comprehensive documentation will be available as soon as the package is stable.
+
+
+## Installation & basic usage
+Install the package via pip.
+
+```sh
+pip install resultwizard
+```
+
+Then you can use `ResultWizard` in your Python code:
+
+```python
+import resultwizard as wiz
+wiz.config_init(print_auto=True)
+
+# your complex calculations
+# ...
+value = 42.0
+uncertainty = 3.14
+wiz.res("length atom", value, uncertainty, r"\per\mm\cubed")
+# There are many more ways to call wiz.res(...), try to use
+# IntelliSense in your IDE to see all possibilities.
+# A more in-depth documentation will follow in next releases.
+
+# Export the result to a LaTeX file. Provide a path as string
+# where the file should be saved.
+wiz.export("./results.tex")
+```
+
+Now add the following line to your LaTeX document right before `\begin{document}`:
+
+```latex
+% assuming that `results.tex` is located in the same directory
+% as your LaTeX document
+\input{./results.tex}
+
+\begin{document}
+...
+```
+
+Note that `ResultWizard` requires the following LaTeX packages: [`siunitx`](https://ctan.org/pkg/siunitx) and [`ifthen`](https://ctan.org/pkg/ifthen). They are imported in the `results.tex` file via `\usepackage{...}` statements. The package `ifthen` is always present in a LaTeX distribution. You may have to install the `siunitx` package, which is a widely used package in the scientific community to typeset units, e.g. you can use strings like `\kg\per\cm`.
+
+You can now go ahead and **use the variable in your LaTeX document** in any math environment, e.g.:
+
+```latex
+\begin{align}
+ \resLengthAtom
+\end{align}
+```
+
+You can also only use a specific part of the result, e.g. the unit, the value itself etc. (try to use a random key like `\resLengthAtom[x]` and compile your LaTeX document to see more options).
+
+```latex
+\begin{align}
+ \resLengthAtom[unit]
+\end{align}
+```
+
+---
+
+If your LaTeX document does not compile, try to set
+
+```python
+wiz.config_init(siunitx_fallback=True)
+```
+
+in your `ResultWizard` configuration. If the LaTeX document compiles after this, you have an older version of `siunitx` installed. We recommend to upgrade the package to at least version `v3.1.0` to be able to fully customize the output of the result in your LaTeX document via `\sisetup{...}`. See the troubleshooting section down below for more information.
+
+
+## Troubleshooting: LaTeX doesn't build
+
+If your LaTeX document doesn't build, there might be several reasons. Try to find out what's wrong by looking at the log file of your LaTeX compiler (sometimes you have to scroll way up to find the error responsible for the failing build). Also open the `results.tex` file to see if your editor/IDE shows any errors there. You might encounter one of the following errors:
+
+
+
+Package siunitx: Invalid number.
+
+TL;DR: You have an **old version of `siunitx`**. Please update it or use the `siunitx_fallback` option in the `config_init` method.
+
+In version [`v3.1.0 (2022-04-25)`](https://github.com/josephwright/siunitx/blob/main/CHANGELOG.md#v310---2022-04-25), `siunitx` introduced "support for multiple uncertainty values in both short and long form in input". We make use of this feature in `ResultWizard`.
+
+Unfortunately, it may be the case that you're using an older version of `siunitx`. Especially if you've installed LaTeX via a package manager (e.g. you installed `siunitx` via `sudo apt install texlive-science`). To determine your version, include the following line in your LaTeX document:
+
+```latex
+\listfiles % add this before \begin{document}
+```
+
+Then, compile your document and check the log for the version of `siunitx`. If it's older than `v3.1.0 (2022-04-25)`, don't despair. We have two solutions for you:
+
+**Solution 1: Don't update `siunitx` and stick with your old version**
+
+Sure, fine, we won't force you to update `siunitx` (although we'd recommend it). To keep using your old version, specify the following key in the `config_init` method:
+
+```python
+wiz.config_init(siunitx_fallback=True)
+```
+
+Note that with this "solution", you won't be able to fully customize the output of the result in your LaTeX document. For example, we will use a `ยฑ` between the value and the uncertainty, e.g. `3.14 ยฑ 0.02`. You won't be able to change this in your `sisetup` by doing:
+
+```latex
+\sisetup{separate-uncertainty=false}
+```
+
+to get another format like `3.14(2)`. There are also some [other `siunitx` options](https://texdoc.org/serve/siunitx/0) that won't work with `ResultWizard`, e.g. `exponent-product`. If you're fine with this, go ahead and use the `siunitx_fallback` option. If not, consider updating `siunitx` to at least version `v3.1.0`.
+
+**Solution 2: Update `siunitx` (recommended)**
+
+How the update process works depends on your LaTeX distribution and how you installed it. E.g. you might be using `TeX Live` on `Ubuntu` and installed packages via `apt`, e.g. `sudo apt install texlive-science` (which includes the LaTeX `siunitx`). These pre-built packages are often outdated, e.g. for Ubuntu 22.04 LTS (jammy), the `siunitx` package that comes with the `texlive-science` package is `3.0.4`. Therefore, you might have to update `siunitx` manually. See an overview on how to install individual LaTeX packages on Linux [here](https://tex.stackexchange.com/a/73017/).
+
+A quick solution might be to simply install a new version of `siunitx` manually to your system. There's a great and short Ubuntu guide on how to install LaTeX packages manually [here](https://help.ubuntu.com/community/LaTeX#Installing_packages_manually). The following commands are based on this guide. We will download the version `3.1.11 (2022-12-05)` from GitHub (this is the last version before `3.2` where things might get more complicated to install) and install it locally. Nothing too fancy. Execute the following commands in your terminal:
+
+```sh
+# Install "unzip", a tool to extract zip files
+sudo apt install unzip
+
+# Download v3.1.11 of siunitx from GitHub
+curl -L https://github.com/josephwright/siunitx/releases/download/v3.1.11/siunitx-ctan.zip > siunitx-ctan-3.1.11.zip
+
+# Unzip the file
+unzip ./siunitx-ctan-3.1.11.zip
+cd siunitx/
+
+# Run LaTeX on the .ins file to produce a usable .sty file
+# (The .sty file is needed when you use \usepackage{siunitx}
+# in your LaTeX document)
+latex siunitx.ins
+
+# Create a new directory in your home directory
+# to store the new package .sty file
+mkdir -p ~/texmf/tex/latex/siunitx
+cp siunitx.sty ~/texmf/tex/latex/siunitx/
+
+# Make LaTeX recognize the new package by pointing it to the new directory
+texhash ~/texmf/
+
+# ๐ Done. Try to rebuild your LaTeX document again.
+
+# If you don't wan't the new siunitx version anymore, just run the following
+# command to remove the .sty file. LaTeX will then use the version of siunitx
+# it finds somewhere else in your system.
+rm ~/texmf/tex/latex/siunitx/siunitx.sty
+```
+
+Compiling your latex document again, you should see version `v3.1.11` of `siunitx` in the log file. And it should build, yeah ๐. Don't forget to remove the `\listfiles` from your LaTeX document to avoid cluttering your log file (which is ironic for LaTeX, we know).
-> **๐**
-> **For installation/usage/API, refer to our [documentation](https://resultwizard.github.io/ResultWizard/).**
+
diff --git a/TODO.md b/TODO.md
index 15c58d03..5abb47c7 100644
--- a/TODO.md
+++ b/TODO.md
@@ -10,24 +10,14 @@
-> Explain that this has the great potential for loops: users can specify variables in a loop and use format strings, e.g. `wiz.res(f"my_variable_{i}", ...)`
- how to pass in uncertainties. How to pass in one? What about systematic and statistical ones. What if I want to add my own name for the uncertainty? How can I control that output.
- a list of all possible keys for `config_init` including their default values, e.g. `identifier`. In-depth explanation especially for sigfigs and decimal places and how they differ from respective fallback options
-- a hint that the output is completely customizable and that the user can change it with the `\sisetup{...}`, e.g. `\cdot` vs. `\times` for exponent, `separate-uncertainty=true` (!)
+- a hint that the output is completely customizable and that the user can change it with the `\sisetup{...}`, e.g. `\cdot` vs. `\times` for exponent, etc.
- how to use the unit string. explain that strings from `siunitx` can be passed in, e.g. `\cm \per \N` etc. Explain how python raw strings can help, e.g. `r"\cm \per \N"` instead of having to do `\\cm` etc. all the time. However, `r'\\tesla'` will fail as the double backslash is treated a raw string and not as an escape character. Use `r'\tesla'` instead.
- possible ways to print a result. Recommended: activate `print_auto`. Other way: call `print()` on result object. Users can also call `resVariable.to_latex_str()` to retrieve the LaTeX representation. This can be useful to plot the result in a matplotlib figure, e.g. the fit parameter of a curve fit.
- Suggest some good initial configuration for Jupyter notebook, e.g. `print_auto=True` and `ignore_result_overwrite=True`.
- Naming: we call it "uncertainty". Give a hint that others might also call it "error" interchangeably.
-- Jupyter Notebook tip to avoid
-
-```
-
-```
-as output. Instead append a `;` to the `wiz.res(...)` call and the output will be suppressed.
-
-- Use fuzzy search in IntelliSense to search for result names.
-
-
## Other
- Setup issue template and contribution guide. Clean up `DEVELOPMENT.md`.
-- Long-term: Ask real users what they really need in the scientific day-to-day life, see [here](https://github.com/resultwizard/ResultWizard/issues/9).
+- Long-term: Ask real users what they really need in the scientific day-to-day life, see [here](https://github.com/paul019/ResultWizard/issues/9).
- If user enters an uncertainty of `0.0`, don't just issue warning "Uncertainty must be positive", but also give a hint that the user might want to use a different caller syntax for `res` which does not even have the uncertainty as argument.
diff --git a/docs/.gitignore b/docs/.gitignore
deleted file mode 100644
index 93b45e81..00000000
--- a/docs/.gitignore
+++ /dev/null
@@ -1,12 +0,0 @@
-# These are directly copied from Jekyll's first-party docs on `.gitignore` files:
-# https://jekyllrb.com/tutorials/using-jekyll-with-bundler/#commit-to-source-control
-
-# Ignore the default location of the built site, and caches and metadata generated by Jekyll
-_site/
-.sass-cache/
-.jekyll-cache/
-.jekyll-metadata
-
-# Ignore folders generated by Bundler
-.bundle/
-vendor/
diff --git a/docs/404.html b/docs/404.html
deleted file mode 100644
index f75bc878..00000000
--- a/docs/404.html
+++ /dev/null
@@ -1,26 +0,0 @@
----
-permalink: /404.html
-layout: default
----
-
-
-
-
-
404
-
-
Page not found ๐ฅ
-
The requested page could not be found.
-
diff --git a/docs/Gemfile b/docs/Gemfile
deleted file mode 100644
index 25440b6f..00000000
--- a/docs/Gemfile
+++ /dev/null
@@ -1,4 +0,0 @@
-source 'https://rubygems.org'
-
-gem "jekyll", "~> 4.3.3" # installed by `gem jekyll`
-gem "just-the-docs", "0.8.1" # pinned to the current release
diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock
deleted file mode 100644
index 017aea1b..00000000
--- a/docs/Gemfile.lock
+++ /dev/null
@@ -1,82 +0,0 @@
-GEM
- remote: https://rubygems.org/
- specs:
- addressable (2.8.6)
- public_suffix (>= 2.0.2, < 6.0)
- colorator (1.1.0)
- concurrent-ruby (1.2.3)
- em-websocket (0.5.3)
- eventmachine (>= 0.12.9)
- http_parser.rb (~> 0)
- eventmachine (1.2.7)
- ffi (1.16.3)
- forwardable-extended (2.6.0)
- google-protobuf (4.26.1-x86_64-linux)
- rake (>= 13)
- http_parser.rb (0.8.0)
- i18n (1.14.4)
- concurrent-ruby (~> 1.0)
- jekyll (4.3.3)
- addressable (~> 2.4)
- colorator (~> 1.0)
- em-websocket (~> 0.5)
- i18n (~> 1.0)
- jekyll-sass-converter (>= 2.0, < 4.0)
- jekyll-watch (~> 2.0)
- kramdown (~> 2.3, >= 2.3.1)
- kramdown-parser-gfm (~> 1.0)
- liquid (~> 4.0)
- mercenary (>= 0.3.6, < 0.5)
- pathutil (~> 0.9)
- rouge (>= 3.0, < 5.0)
- safe_yaml (~> 1.0)
- terminal-table (>= 1.8, < 4.0)
- webrick (~> 1.7)
- jekyll-include-cache (0.2.1)
- jekyll (>= 3.7, < 5.0)
- jekyll-sass-converter (3.0.0)
- sass-embedded (~> 1.54)
- jekyll-seo-tag (2.8.0)
- jekyll (>= 3.8, < 5.0)
- jekyll-watch (2.2.1)
- listen (~> 3.0)
- just-the-docs (0.8.1)
- jekyll (>= 3.8.5)
- jekyll-include-cache
- jekyll-seo-tag (>= 2.0)
- rake (>= 12.3.1)
- kramdown (2.4.0)
- rexml
- kramdown-parser-gfm (1.1.0)
- kramdown (~> 2.0)
- liquid (4.0.4)
- listen (3.9.0)
- rb-fsevent (~> 0.10, >= 0.10.3)
- rb-inotify (~> 0.9, >= 0.9.10)
- mercenary (0.4.0)
- pathutil (0.16.2)
- forwardable-extended (~> 2.6)
- public_suffix (5.0.5)
- rake (13.2.1)
- rb-fsevent (0.11.2)
- rb-inotify (0.10.1)
- ffi (~> 1.0)
- rexml (3.2.6)
- rouge (4.2.1)
- safe_yaml (1.0.5)
- sass-embedded (1.74.1-x86_64-linux-gnu)
- google-protobuf (>= 3.25, < 5.0)
- terminal-table (3.0.2)
- unicode-display_width (>= 1.1.1, < 3)
- unicode-display_width (2.5.0)
- webrick (1.8.1)
-
-PLATFORMS
- x86_64-linux
-
-DEPENDENCIES
- jekyll (~> 4.3.3)
- just-the-docs (= 0.8.1)
-
-BUNDLED WITH
- 2.4.22
diff --git a/docs/README.md b/docs/README.md
deleted file mode 100644
index eccaa7d3..00000000
--- a/docs/README.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# ResultWizard documentation
-
-๐งพ Find the documentation [here](https://resultwizard.github.io/ResultWizard/).
-
-To build and preview the docs locally, see [this](https://github.com/just-the-docs/just-the-docs-template?tab=readme-ov-file#building-and-previewing-your-site-locally). In summary, have [Bundler](https://bundler.io/) installed, then run:
-
-```bash
-cd docs/
-bundle install
-bundle exec jekyll serve
-```
-
-Preview the docs at [localhost:4000](http://localhost:4000). Files are stored in the `_site` directory locally.
diff --git a/docs/_api/config.md b/docs/_api/config.md
deleted file mode 100644
index cdadfbb8..00000000
--- a/docs/_api/config.md
+++ /dev/null
@@ -1,54 +0,0 @@
----
-layout: default
-title: wiz.config_init() & wiz.config()
-nav_order: 1
----
-
-# `wiz.config_init` & `wiz.config()`
-{: .no_toc }
-
-
-
- Content
-
- {: .text-delta }
-
-- TOC
-{:toc}
-
-
-
-
-## Purpose
-
-The methods `wiz.config_init()` and `wiz.config()` allow you to configure `ResultWizard` to your needs. Note that this mainly affects the rounding mechanism as well as convenience features. How the results are formatted in the LaTeX document is mainly controlled by the `siunitx` package and how you set it up in your LaTeX preamble. If this is what you want to configure, then you should take a look [here]({{site.baseurl}}/tips/siunitx).
-
-## Usage
-
-With `config_init()` you set the initial configuration for `ResultWizard`. With later calls to `config()`, you can update individual settings without having to reconfigure every parameter.
-
-{: .warning }
-Some options are only available in `config_init()` and cannot be changed later with `config()`.
-
TODO: Do we really want that?
-
-Here is the list of available options:
-
-{: .warning }
-TODO: sort options alphabetically? Make clearer what the difference between `sigfigs` and `sigfigs_fallback` is. Maybe even rename/unify these options? Same for `decimal_places` and `decimal_places_fallback`. We also need better explanations for `min_exponent_...` and `max_exponent_...`.
-
-| Option | Default | Available in
`config_init()` | Available in
`config()` | Description |
-|:---|:---:|:---:|:---:|:---|
-| `sigfigs` (int) | `-1` | โ | โ | The number of significant figures to round to.
TODO: explain what a sigfig is. |
-| `decimal_places` (int) | `-1` | โ | โ | The number of decimal places to round to. |
-| `sigfigs_fallback` (int) | `2` | โ | โ | The number of significant figures to use as a fallback if other rounding rules don't apply. |
-| `decimal_places_fallback` (int) | `-1` | โ | โ | The number of decimal places to use as a fallback if other rounding rules don't apply. |
-| `identifier` (str) | `"result"` | โ | | The identifier that will be used in the LaTeX document to reference the result. |
-| `print_auto` (bool) | `False` | โ | โ | If `True`, every call to `wiz.res()` will automatically print the result to the console, such that you don't have to use `.print()` on every single result. |
-| `export_auto_to` (str) | `""` | โ | | If set to a path, every call to `wiz.res()` will automatically export the result to the specified file. This is especially useful for Jupyter notebooks where every execution of a cell that contains a call to `wiz.res()` will automatically export to the file. |
-| `siunitx_fallback` (bool) | `False` | โ | | If `True`, `ResultWizard` will use a fallback for the `siunitx` package if you have an old version installed. See [here]({{site.baseurl}}/trouble#package-siunitx-invalid-number) for more information. We don't recommend to use this option and instead upgrade your `siunitx` version to exploit the full power of `ResultWizard`. |
-`precision` (int) | `100` | โ | | The precision `ResultWizard` uses internally to handle the floating point numbers. You may have to increase this number if you encounter the error "Your precision is set too low". |
-| `ignore_result_overwrite` (bool) | `False` | โ | | If `True`, `ResultWizard` will not raise a warning if you overwrite a result with the same identifier. This is especially useful for Jupyter notebooks where cells are oftentimes run multiple times. |
-| `min_exponent_for_`
`non_scientific_notation` (int) | `-2` | โ | | The minimum exponent for which `ResultWizard` will use non-scientific notation. If the exponent is smaller than this value, scientific notation will be used. TODO: explain better. |
-| `max_exponent_for_`
`non_scientific_notation` (int) | `3` | โ | | The maximum exponent for which `ResultWizard` will use non-scientific notation. If the exponent is larger than this value, scientific notation will be used. TODO: explain better. |
-
-If you're using a Jupyter Notebook, you might find [this configuration]({{site.baseurl}}/tips/jupyter) useful.
diff --git a/docs/_api/export.md b/docs/_api/export.md
deleted file mode 100644
index a476f087..00000000
--- a/docs/_api/export.md
+++ /dev/null
@@ -1,39 +0,0 @@
----
-layout: default
-title: wiz.export()
-nav_order: 3
----
-
-# `wiz.export()`
-{: .no_toc }
-
-
-
- Content
-
- {: .text-delta }
-
-- TOC
-{:toc}
-
-
-
-
-## Purpose
-
-Call `wiz.export()` after you have defined your results with `wiz.res()`. `wiz.export()` will generate a LaTeX file containing all your results. This file can be included in your LaTeX document with `\input{./path/to/results.tex}` in the LaTeX preamble (see [here]({{site.baseurl}}/quickstart#2-include-results-in-latex)).
-
-## Usage
-
-```py
-wiz.export(filepath: str)
-```
-
-- `filepath` (str): The (relative or absolute) path to the LaTeX file to be generated, e.g. `./results.tex`.
-
-
-## Tips
-
-- The `filepath` should end with `.tex` to be recognized as a LaTeX file by your IDE / LaTeX editor.
-- For a convenient setup, have Python code reside next to your LaTeX document. This way, you can easily reference the generated LaTeX file. For example, you could have two folders `latex/` & `code/` in your project. Then export the results to `../latex/results.tex` from your python code residing in the `code` folder. In LaTeX, you can then include the file with `\input{./results.tex}`.
-- Especially for Jupyter Notebooks, we recommend to use the [`export_auto_to` config option]({{site.baseurl}}/api/config#export_auto_to). This way, you can automatically export the results to a file after each call to `wiz.res()`. See [this page]({{site.baseurl}}/tips/jupyter) for a suitable configuration of `ResultWizard` in Jupyter Notebooks.
diff --git a/docs/_api/res.md b/docs/_api/res.md
deleted file mode 100644
index 0f689375..00000000
--- a/docs/_api/res.md
+++ /dev/null
@@ -1,123 +0,0 @@
----
-layout: default
-title: wiz.res()
-nav_order: 2
----
-
-# `wiz.res()`
-{: .no_toc }
-
-
-
- Content
-
- {: .text-delta }
-
-- TOC
-{:toc}
-
-
-
-{: .warning}
-The API for `wiz.res()` is not yet finalized as of `v1.0.0a2` and might change before the stable release `1.0.0`. This is due to some issues we are currently experiencing with the multiple dispatch mechanism in [`plum`].
-
-
-## Purpose
-
-`wiz.res()` is at the heart of `ResultWizard`. With this method, you define your results, i.e. numerical values with uncertaintie(s) (optional) and a unit (optional). See the [basic usage]({{site.baseurl}}/quickstart#-basic-usage) for a first example.
-
-
-When we talk about a **"measurement result"**, we usually refer to these components:
-
-- _Value_: The numerical value of your measurement, i.e. the value you have measured and that you are interested in.
-- _Uncertainties_: They denote the precision of your measurement since you can never measure a value exactly in the real world. Another term commonly used for this is "error", but we will use "uncertainty" throughout.
-- _Unit_: The SI unit of your measurement, e.g. meters, seconds, kilograms etc.
-
-
-## Usage
-
-
-### Define a result
-
-`wiz.res()` is overloaded[^1], i.e. you can call it with different argument types and even different number of arguments. This allows you to define your results in a way that suits you best, e.g. sometimes you might only have the value without any uncertainties, or you don't need a unit etc.
-
-In the following, we use these abbreviations. Refer to the [python docs](https://docs.python.org/3/library/decimal.html) if you're unsure about how `Decimal` works. We recommend using `Decimal` for all numerical values to avoid floating point errors. Also see the [precision page](TODO).
-```py
-numlike := float | int | str | Decimal
-numlike_without_int := float | str | Decimal
-uncertainties := Tuple[numlike, str] | List[numlike | Tuple[numlike, str]]
-```
-
-These are the possible ways to call `wiz.res()`. Note you can use IntelliSense (`Ctrl + Space`) in your IDE to see all possible signatures and get error messages if you use the arguments incorrectly.
-```py
-wiz.res(name: str, value: numlike)
-wiz.res(name: str, value: numlike, unit: str = "")
-wiz.res(name: str, value: numlike, uncert: numlike | uncertainties)
-wiz.res(name: str, value: numlike, sys: float | Decimal, stat: float | Decimal, unit: str = "")
-wiz.res(name: str, value: numlike, uncert: numlike_without_int | uncertainties | None, unit: str = "")
-```
-
-{: .warning }
-Some signatures of `wiz.res()` don't allow for an `int` to be passed in. This is currently due to a technical limitation that we are trying to work around before the stable release.
-
-Note that `uncert` stands for "uncertainties" and can be a single value (for symmetric uncertainties) or a list (for asymmetric uncertainties). When you specify a tuple, the first element is the numerical value of the uncertainty, the second element is a string that describes the type of uncertainty, e.g. "systematic", "statistical" etc.
-```py
-wiz.res("i did it my way", 42.0, [0.22, (0.25, "systematic"), (0.314, "yet another one")])
-
-# These two lines are equivalent (the last line is just a convenient shorthand)
-# Note however with the last line, you cannot pass in "0.1" or "0.2" as strings.
-wiz.res("atom diameter", 42.0, [(0.1, "sys"), (0.2, "stat")])
-wiz.res("atom diameter", 42.0, 0.1, 0.2)
-```
-
-
-### Override the rounding mechanism
-
-Sometimes, you don't want a result to be rounded at all. You can tell `ResultWizard` to not round a numerical value by passing this value as string instead:
-```py
-calculated_uncert = 0.063
-wiz.res("abc", "1.2345", str(calculated_uncert)).print()
-# will print: abc = 1.2345 ยฑ 0.063
-```
-
-You might also use the following keyword arguments with any signature of `wiz.res()`. They will override whatever you have configured via [`config_init()` or `config()`]({{site.baseurl}}/api/config), but just for the specific result.
-```py
-wiz.res(name, ..., sigfigs: int = None, decimal_places: int = None)
-```
-
-
-### Return type
-
-`wiz.res()` returns a `PrintableResult`. On this object, you can call:
-
-```py
-my_res = wiz.res("abc", 1.2345, 0.063)
-my_res.print() # will print: abc = 1.23 ยฑ 0.06
-my_latex_str = my_res.to_latex_str()
-print(my_latex_str) # will print: \num{1.23 \pm 0.06}
-```
-
-- `print()` will print the result to the console. If you find yourself using this a lot, consider setting the [`print_auto` config option]({{site.baseurl}}/api/config#print_auto) to `True`, which will automatically print the result after each call to `wiz.res()`.
-- `to_latex_str()` converts the result to a LaTeX string. This might be useful if you want to show the result as label in a `matplotlib` plot. For this to work, you have to tell `matplotlib` that you're using `siunitx` by defining the preamble in your Python script:
-```py
-import matplotlib.pyplot as plt
-plt.rc('text.latex', preamble=r"""
- \usepackage{siunitx}
- \sisetup{locale=US, group-separator={,}, group-digits=integer,
- per-mode=symbol, separate-uncertainty=true}""")
-```
-
-
-
-## Tips
-
-You might need a variable in your LaTeX document multiple times: in one place _with_ a unit and in another one _without_ a unit (or uncertainty etc.). Don't define the result twice in this case.
-Instead, call `wiz.res()` once and pass in everything you know about your result, e.g. value, unit, uncertainties. Then use `$$\resultMyVariableName[withoutUnit]$$` or `$$\resultMyVariableName[unit]$$` etc. in the LaTeX document to only use a specific part of the result. See the [quickstart]({{site.baseurl}}/quickstart#latex-subset-syntax) for more information.
-
-
----
-
-[^1]: For the technically interested: we use [`plum`] to achieve this "multiple dispatch" in Python. Natively, Python does not allow for method overloading, a concept you might know from other programming languages like Java.
-
-
-[`plum`]: https://github.com/beartype/plum
\ No newline at end of file
diff --git a/docs/_config.yml b/docs/_config.yml
deleted file mode 100644
index c1be61f1..00000000
--- a/docs/_config.yml
+++ /dev/null
@@ -1,41 +0,0 @@
-title: ResultWizard
-description: Documentation for the ResultWizard Python library.
-theme: just-the-docs
-include: ["pages"]
-logo: "https://github.com/resultwizard/ResultWizard/assets/37160523/e3ce32b9-2e41-4ddc-88e3-c1adadd305e9"
-
-url: https://resultwizard.github.io/ResultWizard/
-
-aux_links:
- GitHub: https://github.com/resultwizard/ResultWizard
- Report a bug: https://github.com/resultwizard/ResultWizard/issues
- PyPI: https://pypi.org/project/resultwizard/
-
-collections:
- api:
- permalink: "/:collection/:path/"
- output: true
- tips:
- permalink: "/:collection/:path/"
- output: true
-just_the_docs:
- collections:
- api:
- name: API Reference
- nav_fold: false
- tips:
- name: Tips/Guides
- nav_fold: false
-
-enable_copy_code_button: true
-
-color_scheme: resultwizard-colors
-callouts:
- warning:
- title: Warning
- color: resultwizard-warning-purple
- opacity: 0.1
- tldr:
- title: TL;DR
- color: resultwizard-tldr
- opacity: 0.15
diff --git a/docs/_includes/nav_footer_custom.html b/docs/_includes/nav_footer_custom.html
deleted file mode 100644
index 3f94c423..00000000
--- a/docs/_includes/nav_footer_custom.html
+++ /dev/null
@@ -1,4 +0,0 @@
-
diff --git a/docs/_includes/title.html b/docs/_includes/title.html
deleted file mode 100644
index 6b6eb0a9..00000000
--- a/docs/_includes/title.html
+++ /dev/null
@@ -1,4 +0,0 @@
-{% if site.logo %}
-
-{% endif %}
-{{ site.title }}
\ No newline at end of file
diff --git a/docs/_sass/color_schemes/resultwizard-colors.scss b/docs/_sass/color_schemes/resultwizard-colors.scss
deleted file mode 100644
index 783d1c34..00000000
--- a/docs/_sass/color_schemes/resultwizard-colors.scss
+++ /dev/null
@@ -1,6 +0,0 @@
-$resultwizard-blue: #1C6CB3;
-$resultwizard-purple-light: #A03F70;
-$resultwizard-purple-dark: #773377;
-
-$link-color: $resultwizard-purple-dark;
-$btn-primary-color: $resultwizard-purple-dark;
diff --git a/docs/_sass/custom/setup.scss b/docs/_sass/custom/setup.scss
deleted file mode 100644
index a1fbd3bd..00000000
--- a/docs/_sass/custom/setup.scss
+++ /dev/null
@@ -1,4 +0,0 @@
-$resultwizard-warning-purple-000: #A03F70;
-$resultwizard-warning-purple-300: #773377;
-$resultwizard-tldr-000: #4699CD;
-$resultwizard-tldr-300: #1C6CB3;
diff --git a/docs/_tips/jupyter.md b/docs/_tips/jupyter.md
deleted file mode 100644
index 110d8f18..00000000
--- a/docs/_tips/jupyter.md
+++ /dev/null
@@ -1,54 +0,0 @@
----
-layout: default
-title: Jupyter Notebook
-nav_order: 1
----
-
-# Jupyter Notebook
-{: .no_toc }
-
-
-
- Content
-
- {: .text-delta }
-
-- TOC
-{:toc}
-
-
-
-{: .warning }
-Note that using a Jupyter Notebook **in a browser** won't make much sense in conjunction with `ResultWizard` as you won't be able to directly include the results in your LaTeX document. However, you can still use `ResultWizard` to export the `results.tex` file and copy the contents manually into your LaTeX document. But this is not the originally intended workflow and might be tedious
-
Note that VSCode offers great support for Jupyter Notebook natively, see [this guide](https://code.visualstudio.com/docs/datascience/jupyter-notebooks).
-
-## Useful configuration
-
-In the context of a [*Python Jupyter Notebook*](https://jupyter.org/), you might find this `ResultWizard` configuration useful:
-```py
-wiz.config_init(print_auto=True, export_auto_to="./results.tex", ignore_result_overwrite=True)
-```
-- With the `print_auto` option set to `True`, you will see the results printed to the console automatically without having to call `.print()` on them.
-- The `export_auto_to` option will automatically export the results to a file each time you call `.res()`. That is, you don't have to scroll down to the end of your notebook to call `wiz.export()`. Instead, just execute the cell where you call `.res()` and the results will be exported to the file you specified automatically.
-- With the `ignore_result_overwrite` option you won't see a warning if you overwrite a result with the same name. This is useful in Jupyter notebooks since cells are often executed multiple times.
-
-
-## Cell execution order & cache
-
-Watch out if you use [`wiz.config()`]({{site.baseurl}}/api/config) in a Jupyter Notebook. The order of the cell execution is what matters, not where they appear in the document. E.g. you might call `wiz.config()` somewhere at the end of your notebook. Then go back to the top and execute a cell with `wiz.res()`. The configuration will be applied to this cell as well. This is an inherent limitation/feature of Jupyter Notebooks, just be aware of it.
-
-It might be useful to reset the kernel and clear all outputs from time to time. This way, you can also check if your notebook still runs as expected from top to bottom and exports the results correctly. It can also help get rid of any clutter in `results.tex`, e.g. if you have exported a variable that you deleted later on in the code. This variable will still be in `results.tex` as deleting the `wiz.res()` line in the code doesn't remove the variable from the cache.
-
-
-## Omit output from last line
-
-In interactive python environments like Jupyter Notebooks, the last line of a cell is automatically printed to the console, so you might see something like the following under a cell:
-
-```
-
-```
-
-If you don't want this, you can add a semicolon `;` at the end of the last line in the cell (also see [this StackOverflow answer](https://stackoverflow.com/a/45519070/)). This will suppress the output. For example, write this:
-```py
-wiz.res("jupyter notebook output", 5.0, 0.1, unit="\m\per\s^2"); # <-- note the semicolon here
-```
\ No newline at end of file
diff --git a/docs/_tips/siunitx.md b/docs/_tips/siunitx.md
deleted file mode 100644
index 7f25663c..00000000
--- a/docs/_tips/siunitx.md
+++ /dev/null
@@ -1,58 +0,0 @@
----
-layout: default
-title: Siunitx Configuration
-nav_order: 2
----
-
-# `siunitx` Configuration
-{: .no_toc }
-
-
-
- Content
-
- {: .text-delta }
-
-- TOC
-{:toc}
-
-
-
-
-## Purpose
-
-The [`siunitx`] package offers a wide range of options to configure the formatting of numbers and units in LaTeX. In the exported `results.tex` file, we make use of `siunitx` syntax, e.g. we might transform a `wiz.res()` call into something like `\qty{1.23 \pm 0.05}{\m\per\s^2}` that you also could have written manually. This means, you have full control over how the numbers and units are displayed in your LaTeX document by configuring `siunitx` itself.
-
-If you want to configure `ResultWizard` itself instead, see the [`config_init()` & `config()`]({{site.baseurl}}/api/config) methods.
-
-
-## Important configuration options
-
-All options are specified as `key=value` pairs in `\sisetup{}` inside your LaTeX preamble (before `\begin{document}`), e.g.:
-```latex
-\usepackage{siunitx}
-\sisetup{
- locale=US,
- group-separator={,},
- group-digits=integer,
- per-mode=symbol,
- uncertainty-mode=separate,
-}
-```
-
-Here, we present just a small (admittedly random) subset of the options of [`siunitx`]. See the **[`siunitx` documentation](https://texdoc.org/serve/siunitx/0).** for more details and all available options.
-
-[Siunitx Documentation](https://texdoc.org/serve/siunitx/0){: .btn .btn-primary .fs-5 .mb-4 .mb-md-0 .mr-2 }
-
-- `locale=UK|US|DE|PL|FR|SI|ZA`. This option sets the locale for the output of numbers and units, e.g. in English speaking countries, the decimal separator is a dot `1.234`, while in Germany it's a comma `1,234`.
-- `group-separator={,}`. This option sets the group separator, e.g. `1,234,567`.
-- `group-digits=integer=none|decimal|integer`. This option affects how the grouping into blocks of three is taking blace.
-- `per-mode=power|fraction|symbol`. This option allows to specify how `\per` is handled (e.g. in the case of this unit: `\joule\per\mole\per\kelvin`). `fraction` uses the `\frac{}` command, while `symbol` uses a `/` symbol per default (can be changed with `per-symbol`).
-- `uncertainty-mode=full|compact|compact-marker|separate`. When a single uncertainty is given, it can be printed in parentheses, e.g. `1.234(5)`, or with a `ยฑ` sign, e.g. `1.234 ยฑ 0.005` (use `separate` as option to achieve this). In older versions of `siunitx`, there existed the following flag instead: `separate-uncertainty=true|false` (it might still work in newer versions).
-- `exponent-product=\times`. This option allows to specify the product symbol between mantissa and exponent, e.g. `1.23 \times 10^3` or `1.23 \cdot 10^3`. The latter is more common in European countries. This is also affected by the `locale` option.
-
-
-
-
-
-[`siunitx`]: https://ctan.org/pkg/siunitx
diff --git a/docs/favicon.ico b/docs/favicon.ico
deleted file mode 100644
index 65a75d9462c96b617c968d58ecbb827297812b3e..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 9584
zcmcI~by$=^wD(K6w4`*2G*VL1As~$cBCvFafRr@5fG8az4K7GacP%B|-2&2xz|y%a
zcfH>~_xt|)o_p`S&v|C%dCxoZ&Y78We&@^p00#Q`moNZkz=#b1DADDJS6VNL@M-bU
zMIu!dMV)_d{}C=GI-4Sq75rCob=T6v82j#>4ghQvs*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s-VEz6KK9l{c^nK}~%2xw?8IK7qKG2R{?8Y@ed~<~ZnA-xVBJ!L|=C`CH
z+RmDm&)Jlr-#RBAiMkehPB?ZnaD%7Qu=<0pMd-ZV?taT*EDD)=f~d8{2j?r0
z4leZ`AgNuMumD?Z;QV1P<9v`J|1d_L4+Xc=J0>~T>lD&YF{CIym5>>o2S0D!!K>@C
z^aS_g!nAcVb=fqn&$vl)QVK*i?{cjaJV)z(>j1wW0NK6bceT_`!-9_;Ytt6V`HNMj
z1{)!>F>(z+>(Jv;jaVWen-Y*Bb9~hTvHnztGK7GR*Ikp#?_(d%
z2QSgwKUWP}#r+jX`(otel6Ic)c=!!AFi?-*(lOPt9_*Sym
z!>F}sSt{iU`UGNlJz!7vpC^eJ3f>TatriUeIbUW
zVWM0sT2qBnQ8w}%eMbTQ0TeDC>^7d!LQH#bw?W&+)2*oR^sxqJfoX=rAp_u}i-n0R
zif#1$|52m=w^IGDH2}(vHhs)!V~4&K^FN!7)6L#vctEv?&lMiBqb&}gs-&e@u3#SW
EAMGcZHUIzs
diff --git a/docs/index.md b/docs/index.md
deleted file mode 100644
index da53d172..00000000
--- a/docs/index.md
+++ /dev/null
@@ -1,86 +0,0 @@
----
-layout: home
-title: Home
-nav_order: 1
----
-
-

-
-
-# ResultWizard
-{: .fs-9 }
-
-Think of ResultWizard as the glue
-between Python code & your LaTeX work.
-
-{: .fs-6 .fw-300 }
-
-{% capture intro_link %}{% link pages/quickstart.md %}{% endcapture %}
-[Quickstart]({{intro_link}}){: .btn .btn-primary .fs-5 .mb-4 .mb-md-0 .mr-2 }
-[Source Code (GitHub)](https://github.com/resultwizard/ResultWizard){: .btn .fs-5 .mb-4 .mb-md-0 }
-[PyPI](https://pypi.org/project/resultwizard/){: .btn .fs-5 .mb-4 .mb-md-0 }
-
-
-{: .warning }
-ResultWizard is currently fully functional but still in its **alpha stage**, i.e. the API might change. We're happy to receive your feedback until the first stable release.
-
Please report any issues on [GitHub](https://github.com/resultwizard/ResultWizard/issues). To get the latest alpha version, you have to install it via
-
`pip install resultwizard==1.0.0a2` (otherwise you end up using the older version `0.1`).
-
----
-
-
-## ๐ฅ The problem ResultWizard tries to solve
-
-Various scientific disciplines deal with huge amounts of experimental data on a daily basis. Oftentimes, this data is processed in Python to calculate important quantities. In the end, these quantities will get published in scientific papers written in LaTeX. You may have manually copied values from the Python console or a Jupyter notebook to a LaTeX document. This **lack of a programmatic interface between Python code & LaTeX** is what `ResultWizard` is addressing.
-
-## ๐ก How does ResultWizard help?
-
-In a nutshell, export any variables from Python including possible uncertainties and their units.
-
-```py
-# Your Python code
-import resultwizard as wiz
-wiz.res("Tour Eiffel Height", 330.362019, 0.5, "\m")
-wiz.res("g", 9.81, 0.78, "\m/\s^2")
-wiz.export("./results.tex")
-```
-
-This will generate a LaTeX file `results.tex`. Add this file to your LaTeX preamble:
-
-```latex
-% Your LaTeX preamble
-\input{./results.tex}
-\begin{document}
-...
-```
-
-Then, you can reference the variables in your LaTeX document:
-
-```latex
-% Your LaTeX document
-This allowed us to calculate the acceleration due to gravity $g$ as
-\begin{align}
- g &= \resultG
-\end{align}
-Therefore, the height of the Eiffel Tower is given by $h = \resultTourEiffelHeight$.
-```
-
-It will render as follows:
-
-
-
-
-That's the gist of `ResultWizard`. Of course, there are many more features and customizations available.
-
-
-## Why shouldn't I continue to manually copy-paste values?
-
-Here's a few reasons why you should consider using `ResultWizard` as programmatic interface instead:
-
-- _Sync_: By manually copying values, you risk getting your LaTeX document out of sync with your Python code. The latter might have to be adjusted even during the writing process of your paper. And one line of code might change multiple variables that you have to update in your LaTeX document. With `ResultWizard`, you can simply re-export the variables and you're good to go:
-- _Significant figures_: `ResultWizard` takes care of significant figures rounding for you, e.g. a result `9.81 ยฑ 0.78` will be rendered as `9.8 ยฑ 0.8` in LaTeX (customizable).
-
-`ResultWizard` allows you to have your variables in one place: your Python code where you calculated them anyways. **Focus on your research, not on copying values around**.
-
-[Get started now]({{intro_link}}){: .btn .btn-primary .fs-5 .mb-4 .mb-md-0 .mr-2 }
diff --git a/docs/pages/about.md b/docs/pages/about.md
deleted file mode 100644
index dcc3db18..00000000
--- a/docs/pages/about.md
+++ /dev/null
@@ -1,38 +0,0 @@
----
-layout: default
-title: About
-permalink: about
-nav_order: 4
----
-
-# About
-{: .no_toc }
-
-
-
- Content
-
- {: .text-delta }
-
-- TOC
-{:toc}
-
-
-
-
-## Little bit of history
-This project started out at the end of 2023 under the name `python2latex` when [*Paul Obernolte*](https://github.com/paul019) was working on reports for the practical parts of the physics curriculum at the University of Heidelberg. In these reports, experimental data was processed in Python and many results had to be included in LaTeX. The manual copy-paste process was error-prone and took too much time, so he started this project. Originally, it just consisted of one single file, that got the job done.
-
-In 2024, the project was renamed to `ResultWizard` as [*Dominic Plein*](https://github.com/splines) joined the team. Together, we completely redesigned the project, added new features and improved the code quality with linting, tests, CI/CD and a modular clean architecture approach. We set up a branding, published first alpha releases to PyPI and started this documentation. We learned many things along the way and are proud to have published our first Python package.
-
-We hope that `ResultWizard` will help you save time and make dealing with data in Python and LaTeX more enjoyable. If you have any feedback, please let us know on [GitHub](https://github.com/resultwizard/ResultWizard/issues). If you like the project, consider starring it on GitHub as we're always happy to see that people find our work (we're doing in our free-time) useful.
-
-
-## The future (plans for 2024)
-
-As of mid-April 2024, we're still in the alpha stage. But the first stable release is not that far away. We want to make sure we ship a solid product you can rely on, so expect a few more months of alpha testing. We're happy to receive your feedback until the first stable release. After this release, we plan to maintain the project (especially with regards to security fixes). But we will probably add new features only sparingly (in an effort to keep the API stable and in the light of our limited free-time resources).
-
-
-## Acknowledgements
-
-We like to thank the many great people in our surroundings who have helped make this project see the light of the day. We're grateful for the support of our friends, family and colleagues, both mentally and in the form of very concrete feedback as alpha testers. We also want to thank the open-source community for providing us with so many great tools and libraries, among others: [`siunitx`](https://github.com/josephwright/siunitx) by Joseph Wright, [`plum`](https://github.com/beartype/plum) by Wessel Bruinsma and other contributors as well as [`pylint`](https://github.com/pylint-dev/pylint/) by Pierre Sassoulas and others. We also want to thank the whole `Python` and `LaTeX` communities for providing us with such powerful tools to work with in the first place. And the [`just-the-docs`](https://github.com/just-the-docs/just-the-docs) contributors for such an amazing Docs theme. Thank you all! ๐
diff --git a/docs/pages/quickstart.md b/docs/pages/quickstart.md
deleted file mode 100644
index 3dde4770..00000000
--- a/docs/pages/quickstart.md
+++ /dev/null
@@ -1,192 +0,0 @@
----
-layout: default
-title: Quickstart
-permalink: quickstart
-nav_order: 2
----
-
-# Quickstart
-{: .no_toc }
-
-
-
- Content
-
- {: .text-delta }
-
-- TOC
-{:toc}
-
-
-
-
-
-## โ Is this for me?
-
-**Before you start and to avoid frustration**, let's make sure that `ResultWizard` is the right tool for you:
-
-- It's not primarily for you, if you're writing your LaTeX code in a web-based editor like Overleaf. `ResultWizard` is a Python package that will export a `.tex` file in the end. You have to include this file in your LaTeX project and the closer your Python code is to your LaTeX document, the easier it is to reference it without having to do anything manually in-between. You could still use `ResultWizard` in your Python code and manually copy the contents of the generated `results.tex` file into Overleaf, but this is not the originally intended workflow.
-- The same philosophy applies to Jupyter Notebooks that run in a browser. Instead, you should use a local Jupyter Notebook setup and have your LaTeX project reside next to your Python code. Using VSCode as editor is one way to do this. It has built-in support [for Jupyter Notebooks](https://code.visualstudio.com/docs/datascience/jupyter-notebooks) and with the [LaTeX Workshop extension](https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop) you can easily compile your LaTeX document and see the changes immediately. For a possible setup within WSL, see [this guide](https://github.com/Splines/vscode-latex-wsl-setup).
-
-Ideally, you'd have a folder structure where `code` (or `python` or `src` or whatever) and `thesis` (or `latex` or `document` or whatever) are folders on the same level. See also the [wiz.export() API]({{site.baseurl}}/api/export).
-
-Ideally, you also have used the [`siunitx`] LaTeX package beforehand to know how to format units, e.g. `\m\per\s^2`. But don't worry if you haven't, you can still use `ResultWizard` and learn about `siunitx` along the way. You might also want to check out the [siunitx configuration]({{site.baseurl}}/tips/siunitx) page.
-
-
-
-## ๐ป Installation & prerequisites
-
-{: .tldr }
-> Have a LaTeX toolchain including [`siunitx`] set up and Python `>=3.8` installed.
Then install the `ResultWizard` package via [`pip`]:
-> ```
-pip install resultwizard # use `pip install resultwizard==1.0.0a2` in the current alpha stage
-```
-> Move on to [Basic usage](#-basic-usage).
-
-
-
-### Python package
-
-You can install `ResultWizard` via [`pip`]:
-
-```
-pip install resultwizard
-```
-
-{: .warning }
-ResultWizard is currently fully functional but still in its **alpha stage**, i.e. the API might change. We're happy to receive your feedback until the first stable release.
-
Please report any issues on [GitHub](https://github.com/resultwizard/ResultWizard/issues). To get the latest alpha version, you have to install it via
-
`pip install resultwizard==1.0.0a2` (otherwise you end up using the older version `0.1`).
-
-Verify you're using the version you intended to install:
-
-```
-pip show resultwizard | grep Version
-```
-
-### LaTeX toolchain
-
-To compile the LaTeX document, you need a working LaTeX toolchain. If you don't have one yet, there are many guides available online for different OS, e.g. on the [LaTeX project website](https://www.latex-project.org/get/).
-- For MacOS, you might want to use [MacTex](https://www.tug.org/mactex/).
-- For Windows, we recommend [MikTex](https://miktex.org/).
-- For Linux (Ubuntu, e.g. also in WSL), we recommend [Tex Live](https://www.tug.org/texlive/)[^1]:
-```
-sudo apt install texlive texlive-latex-extra texlive-science
-```
-
-
-No matter what LaTeX distribution you're using, you will have to install the [`siunitx`] LaTeX package. This package is used to format numbers and units in LaTeX, e.g. for units you can use strings like `\kg\per\cm`. In the Tex Live distribution, this package is already included if you have installed `sudo apt texlive-science`.
-
-
-### Checklist
-
-- [x] Python `>=3.8` installed & `ResultWizard` installed via [`pip`]
-- [x] LaTeX toolchain set up, e.g. TeX Live
-- [x] [`siunitx`] LaTeX package installed
-
-
-
-
-
-
-
-
-## ๐ Basic usage
-
-{: .tldr }
-> 1. Import the library in your Python code, declare your results and export them:
->```py
-# In your Python code
-import resultwizard as wiz
-wiz.res("Tour Eiffel Height", 330.362019, 0.5, "\m") # units must be `siunitx` compatible
-wiz.export("./results.tex")
-```
-> 2. Include the results in your LaTeX document:
->```latex
-% In your LaTeX document
-\input{./results.tex}
-\begin{document}
- The height of the Eiffel Tower is given by $h = \resultTourEiffelHeight$.
- % also try out: $h = \resultTourEiffelHeight[value]$
-\end{document}
-```
-
-
-### 1. Declare & export variables in Python
-
-In your Python code, import `ResultWizard` and use the `wiz.res` function to declare your results. Then, export them to a LaTeX file by calling `wiz.export`. For the unit, you must use a [`siunitx`] compatible string, e.g. `\m` for meters or `\kg\per\s^2`. See the [siunitx docs](https://texdoc.org/serve/siunitx/0#page=42) for more information.
-
-```py
-import resultwizard as wiz
-
-# your complex calculations
-# ...
-value = 330.362019 # decimal places are made up
-uncertainty = 0.5
-wiz.res("Tour Eiffel Height", value, uncertainty, "\m").print()
-# will print: TourEiffelHeight = (330.4 ยฑ 0.5) m
-
-wiz.export("./results.tex")
-```
-There are many [more ways to call `wiz.res()`](TODO), try to use IntelliSense (`Ctrl + Space`) in your IDE to see all possibilities. If you want to omit any rounding, pass in values as string, e.g.:
-```py
-wiz.res("pi", "3.1415").print() # congrats, you found an exact value for pi!
-# will print: pi = 3.1415
-wiz.res("Tour Eiffel Height", str(value), str(uncertainty), "\m").print()
-# will print: TourEiffelHeight = (330.362019 ยฑ 0.5) m
-```
-
-You can also use the `wiz.config_init` function to set some defaults for the whole program. See many more [configuration options here](config).
-```py
-wiz.config_init(sigfigs_fallback=3, identifier="customResult")
-# default to 2 and "result" respectively
-```
-
-If you're working in a *Jupyter Notebook*, please see [this page]({{site.baseurl}}/tips/jupyter) for a suitable configuration of `ResultWizard` that doesn't annoy you with warnings and prints/exports the results automatically.
-
-
-### 2. Include results in LaTeX
-
-You have either called `wiz.export(.results.tex)` or set up automatic exporting with `wiz.config_init(export_auto_to="./results.tex")`. In any case, you end up with a LaTeX file `./results.tex`. Import it in your LaTeX preamble (you only have to do this once for every new document you create):
-
-```latex
-% Your LaTeX preamble
-\input{./results.tex}
-\begin{document}
-...
-```
-
-Then, you can reference the variables in your LaTeX document:
-
-```latex
-% Your LaTeX document
-This allowed us to calculate the acceleration due to gravity $g$ as
-\begin{align}
- g &= \resultG
-\end{align}
-Therefore, the height of the Eiffel Tower is given by $h = \resultTourEiffelHeight$.
-```
-
-It will render as follows (given respective values for `g` and `Tour Eiffel Height` are exported):
-
-
-
-If you set up your IDE or your LaTeX editor properly, you can use IntelliSense (`Ctrl + Space`) here as well to see all available results, e.g. type `\resultTo`. Changing the value in Python and re-exporting will automatically update the value in your LaTeX document[^2].
-
-
-Also try out the following syntax:
-
-```latex
-% Your LaTeX document
-The unit of $h$ is $\resultTourEiffelHeight[unit]$ and its value is $\resultTourEiffelHeight[value]$.
-```
-
-Use `\resultTourEiffelHeight[x]` to get a message printed in your LaTeX document informing you about the possible strings you can use instead of `x` (e.g. `withoutUnit`, `value` etc.).
-
----
-
-[^1]: For differences between texlive packages, see [this post](https://tex.stackexchange.com/a/504566/). For Ubuntu users, there's also an installation guide available [here](https://wiki.ubuntuusers.de/TeX_Live/#Installation). If you're interested to see how Tex Live can be configured in VSCode inside WSL, see [this post](https://github.com/Splines/vscode-latex-wsl-setup).
-[^2]: You have to recompile your LaTeX document, of course. But note that you can set up your LaTeX editor / IDE to recompile the PDF automatically for you as soon as any files, like `results.tex` change. For VSCode, you can use the [LaTeX Workshop extension](https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop) for this purpose, see a guide [here](https://github.com/Splines/vscode-latex-wsl-setup). In the best case, you only have to update a variable in your Python code (and run that code) and see the change in your PDF document immediately.
-
-[`siunitx`]: https://ctan.org/pkg/siunitx
-[`pip`]: https://pypi.org/project/resultwizard
diff --git a/docs/pages/trouble.md b/docs/pages/trouble.md
deleted file mode 100644
index ff1951dc..00000000
--- a/docs/pages/trouble.md
+++ /dev/null
@@ -1,94 +0,0 @@
----
-layout: default
-title: Troubleshooting
-permalink: trouble
-nav_order: 3
----
-
-# Troubleshooting
-{: .no_toc }
-
-
-
- Content
-
- {: .text-delta }
-
-- TOC
-{:toc}
-
-
-
-There might be several reasons for your LaTeX document not building. **Try to find the root cause** by looking at the **log file** of your LaTeX compiler (sometimes you have to scroll way up to find the error responsible for the failing build). Also open the [exported]({{site.baseurl}}/api/export) `results.tex` file to see if your editor/IDE shows any errors there. You might encounter one of the following problems. Please make sure to try the solutions provided here before opening an [issue on GitHub](https://github.com/resultwizard/ResultWizard/issues).
-
-
-
-## Package siunitx: Invalid number
-
-{: .tldr}
-You have probably specified **multiple uncertainties** in `wiz.res()`, right? If this is the case and you get this error, you have an **old version of `siunitx`** installed. Please update it (recommended) or use the `siunitx_fallback` option in the [`config_init`]({{site.baseurl}}/api/config) method.
-
-In version [`v3.1.0 (2022-04-25)`](https://github.com/josephwright/siunitx/blob/main/CHANGELOG.md#v310---2022-04-25), `siunitx` introduced "support for multiple uncertainty values in both short and long form input". We make use of this feature in `ResultWizard` when you specify multiple uncertainties for a result.
-
-Unfortunately, it may be the case that you're using an older version of `siunitx` that doesn't ship with this feature yet. Especially if you've installed LaTeX via a package manager (e.g. you installed `siunitx` via `sudo apt install texlive-science`). To determine your `siunitx` version, include the following line in your LaTeX document:
-
-```latex
-\listfiles % add this before \begin{document}, i.e. in your LaTeX preamble
-```
-
-Then, compile your document and check the log for the version of `siunitx`.
-
If it's **older than `v3.1.0 (2022-04-25)`**, don't despair. We have two solutions for you:
-
-### Solution 1: Don't update `siunitx` and stick with your old version
-
-Sure, fine, we won't force you to update `siunitx` (although we'd recommend it). To keep using your old version, specify the following key in the `config_init` method:
-
-```python
-wiz.config_init(siunitx_fallback=True)
-```
-
-Note that with this "solution", you won't be able to fully customize the output of the result in your LaTeX document. For example, we will use a `ยฑ` between the value and the uncertainty, e.g. `3.14 ยฑ 0.02`. You won't be able to change this in your `sisetup` by specifying
-
-```latex
-\sisetup{separate-uncertainty=false}
-```
-
-to get another format like `3.14(2)`. There are also some other `siunitx` options that won't probably work with `ResultWizard`, e.g. [`exponent-product`](https://texdoc.org/serve/siunitx/0#page=29). If you're fine with this, go ahead and use the `siunitx_fallback` option. If not, consider updating `siunitx` to at least version `v3.1.0`.
-
-### Solution 2: Update `siunitx` (recommended, but more effort)
-
-How the update process works depends on your LaTeX distribution and how you installed it. E.g. you might be using `TeX Live` on `Ubuntu` and installed packages via `apt`, e.g. `sudo apt install texlive-science` (which includes the LaTeX `siunitx`). These pre-built packages are often outdated, e.g. for Ubuntu 22.04 LTS (jammy), the `siunitx` version that comes with the `texlive-science` package is `3.0.4`. Therefore, you might have to update `siunitx` manually. See an overview on how to install individual LaTeX packages on Linux [here](https://tex.stackexchange.com/a/73017/).
-
-A quick solution might be to simply install a new version of `siunitx` manually to your system. There's a great and short Ubuntu guide on how to install LaTeX packages manually [here](https://help.ubuntu.com/community/LaTeX#Installing_packages_manually). The following commands are based on this guide. We will download the version `3.1.11 (2022-12-05)` from GitHub (this is the last version before `3.2` where things might get more complicated to install) and install it locally. Don't be scared, do it one step at a time and use the power of GPTs and search engines in case you're stuck. Execute the following commands in your terminal:
-
-```sh
-# Install "unzip", a tool to extract zip files
-sudo apt install unzip
-
-# Download v3.1.11 of siunitx from GitHub
-curl -L https://github.com/josephwright/siunitx/releases/download/v3.1.11/siunitx-ctan.zip > siunitx-ctan-3.1.11.zip
-
-# Unzip the file
-unzip ./siunitx-ctan-3.1.11.zip
-cd siunitx/
-
-# Run LaTeX on the .ins file to generate a usable .sty file
-# (LaTeX needs the .sty file to know what to do with the \usepackage{siunitx}
-# command in your LaTeX preamble.)
-latex siunitx.ins
-
-# Create a new directory in your home directory
-# to store the new package .sty file
-mkdir -p ~/texmf/tex/latex/siunitx # use any location you want, but this one is common
-cp siunitx.sty ~/texmf/tex/latex/siunitx/
-
-# Make LaTeX recognize the new package by pointing it to the new directory
-texhash ~/texmf/
-```
-
-๐ Done. Try to recompile your LaTeX document again. You should see version `v3.1.11` of `siunitx` in the log file. And it should build. Don't forget to remove the `\listfiles` from your LaTeX document to avoid cluttering your log file (which is ironic for LaTeX, we know).
-
-In case you don't wan't the new siunitx version anymore, just run the following command to remove the `.sty` file. LaTeX will then use the version of siunitx it finds somewhere else in your system (which is probably the outdated one you had before).
-```sh
-rm ~/texmf/tex/latex/siunitx/siunitx.sty
-```
diff --git a/pyproject.toml b/pyproject.toml
index 7113c443..2d95a481 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -45,12 +45,15 @@ classifiers = [
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
+dependencies = [
+ "plum-dispatch ~= 2.3"
+]
[project.urls]
-Homepage = "https://resultwizard.github.io/ResultWizard/"
-Repository = "https://github.com/resultwizard/ResultWizard"
-Issues = "https://github.com/resultwizard/ResultWizard/issues"
-Changelog = "https://github.com/resultwizard/ResultWizard/blob/main/CHANGELOG.md"
+Homepage = "https://github.com/paul019/ResultWizard"
+Repository = "https://github.com/paul019/ResultWizard"
+Issues = "https://github.com/paul019/ResultWizard/issues"
+Changelog = "https://github.com/paul019/ResultWizard/blob/main/CHANGELOG.md"
# TODO: Add these checks back
[tool.pylint."messages control"]
diff --git a/src/api/console_stringifier.py b/src/api/console_stringifier.py
index e3a77dbc..a1b9a980 100644
--- a/src/api/console_stringifier.py
+++ b/src/api/console_stringifier.py
@@ -13,8 +13,8 @@ class ConsoleStringifier(Stringifier):
value_prefix = ""
value_suffix = ""
- uncertainty_name_prefix = " ("
- uncertainty_name_suffix = ")"
+ error_name_prefix = " ("
+ error_name_suffix = ")"
scientific_notation_prefix = "e"
scientific_notation_suffix = ""
diff --git a/src/api/parsers.py b/src/api/parsers.py
index c54f6511..87bbd921 100644
--- a/src/api/parsers.py
+++ b/src/api/parsers.py
@@ -12,7 +12,7 @@ def check_if_number_string(value: str) -> None:
try:
float(value)
except ValueError as exc:
- raise ValueError(error_messages.STRING_MUST_BE_NUMBER.format(value=value)) from exc
+ raise ValueError(error_messages.STRING_MUST_BE_NUMBER.format(value)) from exc
def parse_name(name: str) -> str:
@@ -204,12 +204,7 @@ def _parse_uncertainty_value(value: Union[float, int, str, Decimal]) -> Value:
"""Parses the value of an uncertainty."""
if isinstance(value, str):
- try:
- check_if_number_string(value)
- except Exception as exc:
- msg = error_messages.STRING_MUST_BE_NUMBER.format(value=value)
- msg += ". " + error_messages.UNIT_NOT_PASSED_AS_KEYWORD_ARGUMENT
- raise ValueError(msg) from exc
+ check_if_number_string(value)
return_value = parse_exact_value(value)
else:
return_value = Value(Decimal(value))
diff --git a/src/api/res.py b/src/api/res.py
index 101a3fcd..85ae7eeb 100644
--- a/src/api/res.py
+++ b/src/api/res.py
@@ -1,5 +1,6 @@
from decimal import Decimal
from typing import Union, List, Tuple
+from plum import dispatch, overload
from api.printable_result import PrintableResult
from api import parsers
@@ -15,36 +16,80 @@
import api.config as c # pylint: disable=wrong-import-position,ungrouped-imports
-# pylint: disable-next=too-many-arguments,too-many-locals
+@overload
def res(
name: str,
value: Union[float, int, str, Decimal],
- uncerts: Union[
+ unit: str = "",
+ sigfigs: Union[int, None] = None,
+ decimal_places: Union[int, None] = None,
+) -> PrintableResult:
+ return res(name, value, [], unit, sigfigs, decimal_places)
+
+
+@overload
+def res(
+ name: str,
+ value: Union[float, int, str, Decimal],
+ uncert: Union[
float,
- int,
str,
Decimal,
Tuple[Union[float, int, str, Decimal], str],
List[Union[float, int, str, Decimal, Tuple[Union[float, int, str, Decimal], str]]],
None,
] = None,
+ sigfigs: Union[int, None] = None,
+ decimal_places: Union[int, None] = None,
+) -> PrintableResult:
+ return res(name, value, uncert, "", sigfigs, decimal_places)
+
+
+@overload
+def res(
+ name: str,
+ value: Union[float, int, str, Decimal],
+ sigfigs: Union[int, None] = None,
+ decimal_places: Union[int, None] = None,
+) -> PrintableResult:
+ return res(name, value, [], "", sigfigs, decimal_places)
+
+
+@overload
+# pylint: disable=too-many-arguments
+def res(
+ name: str,
+ value: Union[float, int, str, Decimal],
+ sys: Union[float, Decimal],
+ stat: Union[float, Decimal],
unit: str = "",
- sys: Union[float, int, str, Decimal, None] = None,
- stat: Union[float, int, str, Decimal, None] = None,
sigfigs: Union[int, None] = None,
decimal_places: Union[int, None] = None,
- print: Union[bool, None] = None, # pylint: disable=redefined-builtin
) -> PrintableResult:
- """
- Declares your result. Give it a name and a value. You may also optionally provide
- uncertainties (via `uncert` or `sys`/`stat`) and a unit in `siunitx` format.
+ return res(name, value, [(sys, "sys"), (stat, "stat")], unit, sigfigs, decimal_places)
- You may additionally specify the number of significant figures or decimal places
- to round this specific result to, irrespective of your global configuration.
- TODO: provide a link to the docs for more information and examples.
- """
- # Verify user input
+@overload
+# pylint: disable=too-many-arguments,redefined-builtin,too-many-locals
+def res(
+ name: str,
+ value: Union[float, int, str, Decimal],
+ uncert: Union[
+ float,
+ str,
+ Decimal,
+ Tuple[Union[float, int, str, Decimal], str],
+ List[Union[float, int, str, Decimal, Tuple[Union[float, int, str, Decimal], str]]],
+ None,
+ ] = None,
+ unit: str = "",
+ sigfigs: Union[int, None] = None,
+ decimal_places: Union[int, None] = None,
+ print: Union[bool, None] = None, # pylint: disable=redefined-builtin
+) -> PrintableResult:
+ if uncert is None:
+ uncert = []
+
if sigfigs is not None and decimal_places is not None:
raise ValueError(error_messages.SIGFIGS_AND_DECIMAL_PLACES_AT_SAME_TIME)
@@ -54,24 +99,10 @@ def res(
if decimal_places is not None and isinstance(value, str):
raise ValueError(error_messages.DECIMAL_PLACES_AND_EXACT_VALUE_AT_SAME_TIME)
- sys_or_stat_specified = sys is not None or stat is not None
- if uncerts is not None and sys_or_stat_specified:
- raise ValueError(error_messages.UNCERT_AND_SYS_STAT_AT_SAME_TIME)
-
- if sys_or_stat_specified:
- uncerts = []
- if sys is not None:
- uncerts.append((sys, "sys"))
- if stat is not None:
- uncerts.append((stat, "stat"))
-
- if uncerts is None:
- uncerts = []
-
# Parse user input
name_res = parsers.parse_name(name)
value_res = parsers.parse_value(value)
- uncertainties_res = parsers.parse_uncertainties(uncerts)
+ uncertainties_res = parsers.parse_uncertainties(uncert)
unit_res = parsers.parse_unit(unit)
sigfigs_res = parsers.parse_sigfigs(sigfigs)
decimal_places_res = parsers.parse_decimal_places(decimal_places)
@@ -94,3 +125,13 @@ def res(
_export(immediate_export_path, print_completed=False)
return printable_result
+
+
+# Hack for method "overloading" in Python
+# see https://beartype.github.io/plum/integration.html
+# This is a good writeup: https://stackoverflow.com/a/29091980/
+@dispatch
+def res(*args, **kwargs) -> object: # pylint: disable=unused-argument
+ # This method only scans for all `overload`-decorated methods
+ # and properly adds them as Plum methods.
+ pass
diff --git a/src/application/error_messages.py b/src/application/error_messages.py
index d4c019f4..94f05490 100644
--- a/src/application/error_messages.py
+++ b/src/application/error_messages.py
@@ -18,15 +18,11 @@
DECIMAL_PLACES_AND_EXACT_VALUE_AT_SAME_TIME = (
"You can't set decimal places and supply an exact value. Please do one or the other."
)
-UNCERT_AND_SYS_STAT_AT_SAME_TIME = (
- "You can't set uncertainties and systematic/statistical uncertainties at the same time. "
- "Please provide either the `uncert` param or the `sys`/`stat` params."
-)
# Parser error messages (generic)
STRING_MUST_BE_NUMBER = "String value must be a valid number, not {value}"
-FIELD_MUST_BE_STRING = "{field} must be a string, not {type}"
-FIELD_MUST_BE_INT = "{field} must be an int, not {type}"
+FIELD_MUST_BE_STRING = "{field} must be a string, not {type}}"
+FIELD_MUST_BE_INT = "{field} must be an int, not {type}}"
FIELD_MUST_NOT_BE_EMPTY = "{field} must not be empty"
FIELD_MUST_BE_POSITIVE = "{field} must be positive"
FIELD_MUST_BE_NON_NEGATIVE = "{field} must be non-negative"
@@ -39,18 +35,15 @@
UNCERTAINTIES_MUST_BE_TUPLES_OR = (
"Each uncertainty must be a tuple or a float/int/Decimal/str, not {type}"
)
-UNIT_NOT_PASSED_AS_KEYWORD_ARGUMENT = (
- "Could it be the case you provided a unit but forgot `unit=` in front of it?"
-)
-# Helpers
+# Helpers:
PRECISION_TOO_LOW = (
"Your precision is set too low to be able to process the given value without any loss of "
"precision. Set a higher precision via: `wiz.config_init (precision=)`."
)
NUMBER_TO_WORD_TOO_HIGH = "For variable names, only use numbers between 0 and 999. Got {number}."
-# Runtime errors
+# Runtime errors:
SHORT_RESULT_IS_NONE = "Short result is None, but there should be at least two uncertainties."
INTERNAL_ROUNDER_HIERARCHY_ERROR = "Internal rounder hierarchy error. Please report this bug."
INTERNAL_MIN_EXPONENT_ERROR = "Internal min_exponent not set error. Please report this bug."
@@ -58,7 +51,7 @@
"Internal rounding to negative decimal places. Please report this bug."
)
-# Warnings
+# Warnings:
INVALID_CHARS_IGNORED = "Invalid characters in name were ignored: {chars}"
NUM_OF_DECIMAL_PLACES_TOO_LOW = (
"Warning: At least one of the specified values is out of range of the specified "
diff --git a/src/application/latex_better_siunitx_stringifier.py b/src/application/latex_better_siunitx_stringifier.py
index 46ee91b9..4911c33c 100644
--- a/src/application/latex_better_siunitx_stringifier.py
+++ b/src/application/latex_better_siunitx_stringifier.py
@@ -22,8 +22,8 @@ class LatexBetterSiunitxStringifier(Stringifier):
value_prefix = ""
value_suffix = ""
- uncertainty_name_prefix = r"\Uncert"
- uncertainty_name_suffix = ""
+ error_name_prefix = r"\Uncert"
+ error_name_suffix = ""
scientific_notation_prefix = "e"
scientific_notation_suffix = ""
diff --git a/src/application/latex_commandifier.py b/src/application/latex_commandifier.py
index 8012f41a..0b06f193 100644
--- a/src/application/latex_commandifier.py
+++ b/src/application/latex_commandifier.py
@@ -26,29 +26,29 @@ def result_to_latex_cmd(self, result: Result) -> str:
builder.add_branch("", self.result_to_latex_str(result))
builder.add_branch("value", self.result_to_latex_str_value(result))
- # Without uncertainty
+ # Without error
if len(result.uncertainties) > 0:
- builder.add_branch("withoutUncert", self.result_to_latex_str_without_uncert(result))
+ builder.add_branch("withoutError", self.result_to_latex_str_without_error(result))
# Single uncertainties
for i, u in enumerate(result.uncertainties):
if len(result.uncertainties) == 1:
- uncertainty_name = "uncert"
+ uncertainty_name = "error"
else:
uncertainty_name = u.name if u.name != "" else Helpers.number_to_word(i + 1)
- uncertainty_name = f"uncert{Helpers.capitalize(uncertainty_name)}"
- uncertainty_latex_str = self.s.create_str(u.uncertainty, [], result.unit)
- builder.add_branch(uncertainty_name, uncertainty_latex_str)
+ uncertainty_name = f"error{Helpers.capitalize(uncertainty_name)}"
+ error_latex_str = self.s.create_str(u.uncertainty, [], result.unit)
+ builder.add_branch(uncertainty_name, error_latex_str)
# Total uncertainty and short result
if len(result.uncertainties) >= 2:
short_result = result.get_short_result()
if short_result is None:
raise RuntimeError(error_messages.SHORT_RESULT_IS_NONE)
- uncertainty_latex_str = self.s.create_str(
+ error_latex_str = self.s.create_str(
short_result.uncertainties[0].uncertainty, [], result.unit
)
- builder.add_branch("uncertTotal", uncertainty_latex_str)
+ builder.add_branch("errorTotal", error_latex_str)
builder.add_branch("short", self.result_to_latex_str(short_result))
# Unit
@@ -82,9 +82,9 @@ def result_to_latex_str_value(self, result: Result) -> str:
"""
return self.s.create_str(result.value, [], "")
- def result_to_latex_str_without_uncert(self, result: Result) -> str:
+ def result_to_latex_str_without_error(self, result: Result) -> str:
"""
- Returns the result without uncertainty as LaTeX string making use of the siunitx package.
+ Returns the result without error as LaTeX string making use of the siunitx package.
"""
return self.s.create_str(result.value, [], result.unit)
diff --git a/src/application/latex_stringifier.py b/src/application/latex_stringifier.py
index 08ae6f1b..4380b385 100644
--- a/src/application/latex_stringifier.py
+++ b/src/application/latex_stringifier.py
@@ -19,8 +19,8 @@ class LatexStringifier(Stringifier):
value_prefix = r"\num{"
value_suffix = r"}"
- uncertainty_name_prefix = r"_{\text{"
- uncertainty_name_suffix = r"}}"
+ error_name_prefix = r"_{\text{"
+ error_name_suffix = r"}}"
scientific_notation_prefix = r" \cdot 10^{"
scientific_notation_suffix = "}"
diff --git a/src/application/stringifier.py b/src/application/stringifier.py
index 35d70406..ce78fdcd 100644
--- a/src/application/stringifier.py
+++ b/src/application/stringifier.py
@@ -38,8 +38,8 @@ class Stringifier(Protocol):
value_prefix: ClassVar[str]
value_suffix: ClassVar[str]
- uncertainty_name_prefix: ClassVar[str]
- uncertainty_name_suffix: ClassVar[str]
+ error_name_prefix: ClassVar[str]
+ error_name_suffix: ClassVar[str]
scientific_notation_prefix: ClassVar[str]
scientific_notation_suffix: ClassVar[str]
@@ -68,9 +68,9 @@ def create_str(self, value: Value, uncertainties: List[Uncertainty], unit: str)
u_rounded = self._uncertainty_to_str(u, use_scientific_notation, exponent, factor)
u_rounded = f" {self.plus_minus} {self.value_prefix}{u_rounded}{self.value_suffix}"
if u.name != "":
- u_rounded += self.uncertainty_name_prefix
+ u_rounded += self.error_name_prefix
u_rounded += self._modify_uncertainty_name(u.name)
- u_rounded += self.uncertainty_name_suffix
+ u_rounded += self.error_name_suffix
uncertainties_rounded.append(u_rounded)
# Assemble everything together
diff --git a/tests/playground.py b/tests/playground.py
index 6d7f52a7..2f28ad52 100644
--- a/tests/playground.py
+++ b/tests/playground.py
@@ -32,35 +32,37 @@
# wiz.res("", 42.0).print()
# -> Error: "name must not be empty"
-wiz.res("a911", 1.05, unit=r"\mm\s\per\N\kg")
+wiz.res("a911", 1.05, r"\mm\s\per\N\kg")
# wiz.res("a911", "1.052", 0.25, r"\mm\s\per\N\kg")
-wiz.res("1 b", 1.0, 0.01, unit=r"\per\mm\cubed")
+wiz.res("1 b", 1.0, 0.01, r"\per\mm\cubed")
# wiz.config(decimal_places=-1, sigfigs_fallback=3)
wiz.res("c big", 1.0, (0.01, "systematic"), r"\mm")
-wiz.res("d", 1.0e10, [(0.01e10, "sysyeah"), (0.0294999e10, "statyeah")], r"\mm\per\second^2")
-# wiz.res("e", "1.0", r"\mm") # -> except error message that maybe we have forgotten to put `unit=`
-
+wiz.res("d", 1.0e10, [(0.01e10, "systematic"), (0.0294999e10, "stat")], r"\mm\per\second\squared")
+wiz.res("e", "1.0", r"\mm")
wiz.res("f", "1.0e1", 25e-1)
wiz.res("g", 42)
-wiz.res("h", 42, sys=13.0, stat=24.0)
-wiz.res("h&", 42, sys=13.0, stat=24.0)
-
-wiz.res("i", Decimal("42.0e-30"), Decimal("0.1e-31"), unit=r"\m")
-wiz.res(
- "i",
- Decimal("42.0e-30"),
- sys=Decimal("0.1e-31"),
- stat=Decimal("0.05e-31"),
- unit=r"\m\per\s\squared",
-)
-wiz.res("j", 0.009, None, "", 2) # really bad, but this is valid
-# wiz.res("k", 1.55, 0.0, unit=r"\tesla") # -> uncertainty must be positive
-wiz.res("k", 3, 1, r"\tesla") # integers work as well, yeah
-wiz.res("l", 1.0, sys=0.01, stat=0.02, unit=r"\mm").print()
-wiz.res("m", 1.0, uncerts=[(0.01, "systematic"), (0.02, "stat")], unit=r"\mm").print()
+wiz.res("h", 42, 13.0, 24.0)
+wiz.res("h&", 42, 13.0, 24.0)
+wiz.res("i", Decimal("42.0e-30"), Decimal("0.1e-31"), r"\m")
+wiz.res("i", Decimal("42.0e-30"), Decimal("0.1e-31"), Decimal("0.05e-31"), r"\m\per\s\squared")
+wiz.res("j", 0.009, None, None, 2)
+# wiz.res("k", 1.55, 0.0, r"\tesla") # -> uncertainty must be positive
+
+# wiz.res("k", 3, 1, r"\tesla") # -> plum: Could not be resolved
+# TODO: Find out if one can adjust the plum.resolver.NotFoundLookupError such that
+# we can give better hints, e.g. "you cannot pass in value and uncertainty as integers"
+
+# wiz.res("g", 1.0, sys=0.01, stat=0.02, unit=r"\mm").print()
+# g: (1.0 ยฑ 0.01 sys ยฑ 0.02 stat) \mm
+# TODO: Why does this not work?
+# -> This fix might help: https://github.com/beartype/plum/issues/40#issuecomment-1836613508
+
+# The following wont' work as we can't have positional arguments (here: unit)
+# after keyword arguments (here: uncert)
+# wiz.res("d", 1.0, uncert=[(0.01, "systematic"), (0.02, "stat")], r"\mm").print()
# wiz.table(
# "name",
@@ -73,8 +75,6 @@
# horizontal = True,
# )
-wiz.res("Tour Eiffel Height", "330.3141516", "0.5", r"\m")
-wiz.res("g Another Test", 9.81, 0.78, unit=r"\m/\s^2")
#############################
# Export