PyMieSimX 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. pymiesimx-0.1.0/.coveragerc +25 -0
  2. pymiesimx-0.1.0/.flake8 +11 -0
  3. pymiesimx-0.1.0/.github/dependabot.yml +11 -0
  4. pymiesimx-0.1.0/.github/workflows/deploy_PyPi.yml +19 -0
  5. pymiesimx-0.1.0/.github/workflows/deploy_anaconda.yml +21 -0
  6. pymiesimx-0.1.0/.github/workflows/deploy_coverage.yml +51 -0
  7. pymiesimx-0.1.0/.github/workflows/quality.yml +30 -0
  8. pymiesimx-0.1.0/.gitignore +12 -0
  9. pymiesimx-0.1.0/.pre-commit-config.yaml +23 -0
  10. pymiesimx-0.1.0/Dockerfile +12 -0
  11. pymiesimx-0.1.0/LICENSE +21 -0
  12. pymiesimx-0.1.0/PKG-INFO +90 -0
  13. pymiesimx-0.1.0/PyMieSimX/__init__.py +5 -0
  14. pymiesimx-0.1.0/PyMieSimX/__main__.py +35 -0
  15. pymiesimx-0.1.0/PyMieSimX/gui/__init__.py +5 -0
  16. pymiesimx-0.1.0/PyMieSimX/gui/assets/card-state.js +41 -0
  17. pymiesimx-0.1.0/PyMieSimX/gui/assets/dashboard.css +3352 -0
  18. pymiesimx-0.1.0/PyMieSimX/gui/assets/default-settings.json +32 -0
  19. pymiesimx-0.1.0/PyMieSimX/gui/assets/logo.png +0 -0
  20. pymiesimx-0.1.0/PyMieSimX/gui/assets/pymiesim-favicon.svg +6 -0
  21. pymiesimx-0.1.0/PyMieSimX/gui/assets/pymiesim-logo-dark.svg +15 -0
  22. pymiesimx-0.1.0/PyMieSimX/gui/assets/pymiesim-logo.svg +39 -0
  23. pymiesimx-0.1.0/PyMieSimX/gui/components/__init__.py +5 -0
  24. pymiesimx-0.1.0/PyMieSimX/gui/components/cards.py +64 -0
  25. pymiesimx-0.1.0/PyMieSimX/gui/defaults.py +18 -0
  26. pymiesimx-0.1.0/PyMieSimX/gui/interface.py +688 -0
  27. pymiesimx-0.1.0/PyMieSimX/gui/layout.py +329 -0
  28. pymiesimx-0.1.0/PyMieSimX/gui/pages/__init__.py +9 -0
  29. pymiesimx-0.1.0/PyMieSimX/gui/pages/citation.py +66 -0
  30. pymiesimx-0.1.0/PyMieSimX/gui/pages/documentation.py +132 -0
  31. pymiesimx-0.1.0/PyMieSimX/gui/pages/experiment/__init__.py +5 -0
  32. pymiesimx-0.1.0/PyMieSimX/gui/pages/experiment/page.py +49 -0
  33. pymiesimx-0.1.0/PyMieSimX/gui/pages/experiment/sections/__init__.py +5 -0
  34. pymiesimx-0.1.0/PyMieSimX/gui/pages/experiment/sections/configuration.py +42 -0
  35. pymiesimx-0.1.0/PyMieSimX/gui/pages/home.py +152 -0
  36. pymiesimx-0.1.0/PyMieSimX/gui/pages/install_local.py +110 -0
  37. pymiesimx-0.1.0/PyMieSimX/gui/pages/settings.py +87 -0
  38. pymiesimx-0.1.0/PyMieSimX/gui/pages/single/__init__.py +5 -0
  39. pymiesimx-0.1.0/PyMieSimX/gui/pages/single/page.py +28 -0
  40. pymiesimx-0.1.0/PyMieSimX/gui/pages/single/sections/__init__.py +6 -0
  41. pymiesimx-0.1.0/PyMieSimX/gui/pages/single/sections/representations.py +38 -0
  42. pymiesimx-0.1.0/PyMieSimX/gui/pages/single/sections/setup.py +27 -0
  43. pymiesimx-0.1.0/PyMieSimX/gui/parsing.py +149 -0
  44. pymiesimx-0.1.0/PyMieSimX/gui/schemas.py +118 -0
  45. pymiesimx-0.1.0/PyMieSimX/gui/services.py +735 -0
  46. pymiesimx-0.1.0/PyMieSimX.egg-info/PKG-INFO +90 -0
  47. pymiesimx-0.1.0/PyMieSimX.egg-info/SOURCES.txt +57 -0
  48. pymiesimx-0.1.0/PyMieSimX.egg-info/dependency_links.txt +1 -0
  49. pymiesimx-0.1.0/PyMieSimX.egg-info/entry_points.txt +2 -0
  50. pymiesimx-0.1.0/PyMieSimX.egg-info/requires.txt +16 -0
  51. pymiesimx-0.1.0/PyMieSimX.egg-info/top_level.txt +1 -0
  52. pymiesimx-0.1.0/README.rst +43 -0
  53. pymiesimx-0.1.0/makefile +32 -0
  54. pymiesimx-0.1.0/meta.yaml +54 -0
  55. pymiesimx-0.1.0/pyproject.toml +54 -0
  56. pymiesimx-0.1.0/pytest.ini +17 -0
  57. pymiesimx-0.1.0/setup.cfg +4 -0
  58. pymiesimx-0.1.0/tests/gui/cli.py +31 -0
  59. pymiesimx-0.1.0/tests/gui/test_services.py +87 -0
@@ -0,0 +1,25 @@
1
+ [run]
2
+ source = PyMieSimX
3
+ branch = True
4
+ relative_files = True
5
+ parallel = True
6
+ omit =
7
+ **/__init__.py
8
+ PyMieSimX/**/__main__.py
9
+
10
+ [report]
11
+ skip_covered = True
12
+ show_missing = True
13
+ precision = 2
14
+
15
+ [html]
16
+ directory = htmlcov
17
+
18
+ [xml]
19
+ output = coverage.xml
20
+
21
+ [paths]
22
+ source =
23
+ PyMieSimX
24
+ /home/runner/work/PyMieSimX/PyMieSimX/PyMieSimX
25
+ /github/workspace/PyMieSimX
@@ -0,0 +1,11 @@
1
+ [flake8]
2
+ max-line-length = 300
3
+ exclude =
4
+ .git
5
+ docs/build
6
+ docs/source/gallery
7
+ development
8
+
9
+ count = true
10
+ per-file-ignores =
11
+ __init__.py: F403, F401
@@ -0,0 +1,11 @@
1
+ # Specify reviewers for pull requests
2
+
3
+ version: 2
4
+ updates:
5
+ - package-ecosystem: "pip"
6
+ directory: "/"
7
+ target-branch: "master"
8
+ schedule:
9
+ interval: "monthly"
10
+ day: "sunday"
11
+ time: "09:00"
@@ -0,0 +1,19 @@
1
+ name: Deploy to PyPI
2
+
3
+ on:
4
+ push:
5
+ branches: ["master"]
6
+ tags: ["*"]
7
+ pull_request:
8
+ branches: ["master"]
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ jobs:
14
+ PyPI:
15
+ uses: MartinPdeS/MPSActions/.github/workflows/publish_pure_package_to_PyPi.yml@master
16
+ with:
17
+ python-version: "3.11"
18
+ secrets:
19
+ PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
@@ -0,0 +1,21 @@
1
+ name: Deploy Conda Packages
2
+
3
+ on:
4
+ push:
5
+ branches: [ "master" ]
6
+ tags: '*'
7
+ pull_request:
8
+ branches: [ "master" ]
9
+
10
+ permissions:
11
+ contents: write
12
+
13
+ jobs:
14
+ linux:
15
+ uses: MartinPdeS/MPSActions/.github/workflows/publish_compiled_package_to_anaconda.yml@master
16
+ with:
17
+ python_versions: '["3.11", "3.12", "3.13"]'
18
+ apt_package: ""
19
+ os_list: '["ubuntu-latest", "macos-latest", "windows-latest"]'
20
+ secrets:
21
+ ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }}
@@ -0,0 +1,51 @@
1
+ name: Deploy GUI coverage
2
+
3
+ on:
4
+ push:
5
+ branches: ["master"]
6
+ tags: ["*"]
7
+ pull_request:
8
+ branches: ["master"]
9
+
10
+ permissions:
11
+ contents: write
12
+ pull-requests: write
13
+
14
+ jobs:
15
+ coverage:
16
+ name: Run GUI tests and publish coverage
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ with:
21
+ fetch-depth: 0
22
+
23
+ - uses: actions/setup-python@v5
24
+ with:
25
+ python-version: "3.11"
26
+
27
+ - name: Install package and test dependencies
28
+ run: |
29
+ python -m pip install --upgrade pip wheel build
30
+ python -m pip install -e ".[testing]"
31
+
32
+ - name: Run GUI tests with coverage
33
+ run: |
34
+ coverage erase
35
+ python -m pytest \
36
+ --import-mode=importlib \
37
+ --cov=PyMieSimX \
38
+ --cov-config=.coveragerc \
39
+ --cov-report=term-missing \
40
+ --cov-report=xml:coverage.xml \
41
+ tests/gui \
42
+ --config-file=pytest.ini
43
+
44
+ - name: Post coverage comment
45
+ if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
46
+ uses: py-cov-action/python-coverage-comment-action@v3
47
+ with:
48
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49
+ MINIMUM_GREEN: 90
50
+ MINIMUM_ORANGE: 50
51
+ COVERAGE_PATH: .
@@ -0,0 +1,30 @@
1
+ name: Quality and GUI tests
2
+
3
+ on:
4
+ push:
5
+ branches: ["master"]
6
+ pull_request:
7
+ branches: ["master"]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ python-quality:
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ matrix:
17
+ python-version: ["3.11", "3.13"]
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ - uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+ - name: Install package and quality tools
24
+ run: python -m pip install --upgrade pip && python -m pip install -e ".[testing,dev]"
25
+ - name: Ruff
26
+ run: python -m ruff check PyMieSimX tests
27
+ - name: Mypy
28
+ run: python -m mypy PyMieSimX/gui/parsing.py PyMieSimX/gui/schemas.py
29
+ - name: GUI tests
30
+ run: python -m pytest
@@ -0,0 +1,12 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ .venv/
5
+ .pytest_cache/
6
+ .ruff_cache/
7
+ .mypy_cache/
8
+ build/
9
+ dist/
10
+ .coverage
11
+ htmlcov/
12
+ .DS_Store
@@ -0,0 +1,23 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v4.6.0
4
+ hooks:
5
+ - id: check-merge-conflict
6
+ - id: end-of-file-fixer
7
+ - id: mixed-line-ending
8
+ - id: check-yaml
9
+ - id: check-toml
10
+ - id: detect-private-key
11
+ - id: check-json
12
+ - id: check-case-conflict
13
+
14
+ - repo: https://github.com/psf/black
15
+ rev: 24.4.2
16
+ hooks:
17
+ - id: black
18
+
19
+ - repo: https://github.com/astral-sh/ruff-pre-commit
20
+ rev: v0.11.2
21
+ hooks:
22
+ - id: ruff
23
+ args: [--output-format, concise]
@@ -0,0 +1,12 @@
1
+ FROM python:3.11-slim
2
+
3
+ ENV PYTHONDONTWRITEBYTECODE=1 \
4
+ PYTHONUNBUFFERED=1
5
+
6
+ WORKDIR /app
7
+ COPY . .
8
+
9
+ RUN python -m pip install --upgrade pip \
10
+ && python -m pip install --no-cache-dir .
11
+
12
+ CMD ["sh", "-c", "exec gunicorn PyMieSimX.gui.interface:app --bind 0.0.0.0:${PORT:-8050} --workers 1 --threads 2 --timeout 3600"]
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Martin Poinsinet de Sivry-Houle
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,90 @@
1
+ Metadata-Version: 2.4
2
+ Name: PyMieSimX
3
+ Version: 0.1.0
4
+ Summary: Graphical Dash interface for PyMieSim.
5
+ Author-email: Martin Poinsinet de Sivry-Houle <martin.poinsinet.de.sivry@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2020 Martin Poinsinet de Sivry-Houle
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Repository, https://github.com/MartinPdeS/PyMieSimX
29
+ Requires-Python: >=3.10
30
+ Description-Content-Type: text/x-rst
31
+ License-File: LICENSE
32
+ Requires-Dist: PyMieSim>=5.1.2
33
+ Requires-Dist: dash>=4.1.0
34
+ Requires-Dist: gunicorn>=23.0.0
35
+ Requires-Dist: numpy>=2.0
36
+ Requires-Dist: pandas>=2.2
37
+ Requires-Dist: plotly<7,>=5.24
38
+ Provides-Extra: testing
39
+ Requires-Dist: pytest>=8.0; extra == "testing"
40
+ Requires-Dist: pytest-cov>=5.0; extra == "testing"
41
+ Requires-Dist: coverage>=7.0; extra == "testing"
42
+ Provides-Extra: dev
43
+ Requires-Dist: build>=1.2; extra == "dev"
44
+ Requires-Dist: mypy==1.15.0; extra == "dev"
45
+ Requires-Dist: ruff==0.11.2; extra == "dev"
46
+ Dynamic: license-file
47
+
48
+ PyMieSimX
49
+ =========
50
+
51
+ PyMieSimX is the standalone graphical interface for `PyMieSim
52
+ <https://github.com/MartinPdeS/PyMieSim>`_. It provides a Dash application for
53
+ configuring optical setups, running parameter sweeps, exploring individual
54
+ particles, and exporting results.
55
+
56
+ Installation
57
+ ------------
58
+
59
+ Install the GUI and its PyMieSim dependency with::
60
+
61
+ pip install PyMieSimX
62
+
63
+ Launch the dashboard with::
64
+
65
+ pymiesimx
66
+
67
+ Use ``pymiesimx --help`` to see the available host, port, browser, and debug
68
+ options.
69
+
70
+ Development
71
+ -----------
72
+
73
+ Install an editable checkout with::
74
+
75
+ pip install -e .
76
+
77
+ The GUI source lives in ``PyMieSimX/gui``. Scientific calculations are provided
78
+ by the installed ``PyMieSim`` package rather than duplicated here.
79
+
80
+ Testing and automation
81
+ ----------------------
82
+
83
+ Run the GUI test suite with::
84
+
85
+ pip install -e ".[testing]"
86
+ python -m pytest
87
+
88
+ GitHub Actions includes quality checks, GUI tests, PyPI publishing, Conda
89
+ recipe publishing, and coverage deployment. The Conda recipe is in
90
+ ``meta.yaml`` and the container entry point is defined in ``Dockerfile``.
@@ -0,0 +1,5 @@
1
+ """Dash graphical interface for PyMieSim."""
2
+
3
+ from PyMieSimX.gui.interface import OpticalSetupGUI, create_dash_app
4
+
5
+ __all__ = ["OpticalSetupGUI", "create_dash_app"]
@@ -0,0 +1,35 @@
1
+ """Entry point for launching the PyMieSimX dashboard."""
2
+
3
+ import argparse
4
+ import logging
5
+
6
+ from PyMieSimX.gui.interface import OpticalSetupGUI
7
+
8
+
9
+ def _build_argument_parser() -> argparse.ArgumentParser:
10
+ """Create the CLI parser for the dashboard launcher."""
11
+ parser = argparse.ArgumentParser(description="Launch the PyMieSimX dashboard.")
12
+ parser.add_argument("--host", default="0.0.0.0", help="Host interface for the Dash server.")
13
+ parser.add_argument("--port", default="8050", help="Port for the Dash server.")
14
+ parser.add_argument("--debug", action="store_true", help="Enable Dash debug mode and verbose debug logging.")
15
+ parser.add_argument("--no-browser", action="store_true", help="Start the server without opening a browser window.")
16
+ return parser
17
+
18
+
19
+ def main(argv: list[str] | None = None) -> None:
20
+ """Launch the PyMieSimX dashboard from a console entry point."""
21
+ args = _build_argument_parser().parse_args(argv)
22
+ logging.basicConfig(
23
+ level=logging.DEBUG if args.debug else logging.INFO,
24
+ format="%(asctime)s | %(levelname)s | %(name)s | %(message)s",
25
+ )
26
+ OpticalSetupGUI().run(
27
+ host=args.host,
28
+ port=args.port,
29
+ open_browser=not args.no_browser,
30
+ debug=args.debug,
31
+ )
32
+
33
+
34
+ if __name__ == "__main__":
35
+ main()
@@ -0,0 +1,5 @@
1
+ """Dash dashboard for configuring and running PyMieSim experiment sets."""
2
+
3
+ from PyMieSimX.gui.interface import OpticalSetupGUI, create_dash_app
4
+
5
+ __all__ = ["OpticalSetupGUI", "create_dash_app"]
@@ -0,0 +1,41 @@
1
+ (function () {
2
+ "use strict";
3
+
4
+ const storagePrefix = "pymiesim-card-state:";
5
+
6
+ function restoreCard(card) {
7
+ if (!card.id || !card.matches("details.workflow-card")) {
8
+ return;
9
+ }
10
+
11
+ const savedState = window.sessionStorage.getItem(storagePrefix + card.id);
12
+ if (savedState === "open") {
13
+ card.open = true;
14
+ } else if (savedState === "closed") {
15
+ card.open = false;
16
+ }
17
+
18
+ if (!card.dataset.statePersistenceBound) {
19
+ card.addEventListener("toggle", function () {
20
+ window.sessionStorage.setItem(storagePrefix + card.id, card.open ? "open" : "closed");
21
+ });
22
+ card.dataset.statePersistenceBound = "true";
23
+ }
24
+ }
25
+
26
+ function scan(root) {
27
+ if (root instanceof HTMLElement) {
28
+ restoreCard(root);
29
+ root.querySelectorAll("details.workflow-card").forEach(restoreCard);
30
+ }
31
+ }
32
+
33
+ document.addEventListener("DOMContentLoaded", function () {
34
+ scan(document.body);
35
+ new MutationObserver(function (mutations) {
36
+ mutations.forEach(function (mutation) {
37
+ mutation.addedNodes.forEach(scan);
38
+ });
39
+ }).observe(document.body, { childList: true, subtree: true });
40
+ });
41
+ })();