r2x 1.0.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 (146) hide show
  1. r2x-1.0.0/.bumpversion.cfg +8 -0
  2. r2x-1.0.0/.github/ISSUE_TEMPLATE/bug.md +27 -0
  3. r2x-1.0.0/.github/ISSUE_TEMPLATE/chore.md +8 -0
  4. r2x-1.0.0/.github/ISSUE_TEMPLATE/feat.md +17 -0
  5. r2x-1.0.0/.github/workflows/CI.yaml +100 -0
  6. r2x-1.0.0/.github/workflows/docs-build.yaml +44 -0
  7. r2x-1.0.0/.github/workflows/publish_pypi.yaml +27 -0
  8. r2x-1.0.0/.gitignore +193 -0
  9. r2x-1.0.0/.pre-commit-config.yaml +33 -0
  10. r2x-1.0.0/LICENCE.txt +13 -0
  11. r2x-1.0.0/PKG-INFO +24 -0
  12. r2x-1.0.0/README.md +75 -0
  13. r2x-1.0.0/cliff.toml +92 -0
  14. r2x-1.0.0/codecov.yml +35 -0
  15. r2x-1.0.0/docs/Makefile +33 -0
  16. r2x-1.0.0/docs/make.bat +35 -0
  17. r2x-1.0.0/docs/source/CHANGELOG.md +98 -0
  18. r2x-1.0.0/docs/source/api/config.md +57 -0
  19. r2x-1.0.0/docs/source/api/enums.md +6 -0
  20. r2x-1.0.0/docs/source/api/exporters.md +24 -0
  21. r2x-1.0.0/docs/source/api/models.md +97 -0
  22. r2x-1.0.0/docs/source/api/parsers.md +21 -0
  23. r2x-1.0.0/docs/source/api/plexos.md +7 -0
  24. r2x-1.0.0/docs/source/api/system.md +7 -0
  25. r2x-1.0.0/docs/source/conf.py +81 -0
  26. r2x-1.0.0/docs/source/dev/develop.md +60 -0
  27. r2x-1.0.0/docs/source/dev/git.md +106 -0
  28. r2x-1.0.0/docs/source/dev/plexos_db.md +52 -0
  29. r2x-1.0.0/docs/source/howtos.md +24 -0
  30. r2x-1.0.0/docs/source/index.md +106 -0
  31. r2x-1.0.0/docs/source/install.md +36 -0
  32. r2x-1.0.0/docs/source/model/data_models.md +63 -0
  33. r2x-1.0.0/docs/source/model/diagram.md +23 -0
  34. r2x-1.0.0/docs/source/model/logic.md +17 -0
  35. r2x-1.0.0/docs/source/model/models.md +78 -0
  36. r2x-1.0.0/docs/source/model/terminology.md +71 -0
  37. r2x-1.0.0/docs/source/nodal.md +113 -0
  38. r2x-1.0.0/docs/source/release_notes.md +153 -0
  39. r2x-1.0.0/docs/source/troubleshoot.md +3 -0
  40. r2x-1.0.0/docs/source/usage.md +159 -0
  41. r2x-1.0.0/docs/stylesheets/nrel.css +64 -0
  42. r2x-1.0.0/docs/stylesheets/style.css +56 -0
  43. r2x-1.0.0/docs/stylesheets/style2.css +27 -0
  44. r2x-1.0.0/environment.yml +7 -0
  45. r2x-1.0.0/pyproject.toml +157 -0
  46. r2x-1.0.0/src/r2x/__init__.py +4 -0
  47. r2x-1.0.0/src/r2x/__main__.py +5 -0
  48. r2x-1.0.0/src/r2x/__version__.py +3 -0
  49. r2x-1.0.0/src/r2x/api.py +108 -0
  50. r2x-1.0.0/src/r2x/cli.py +68 -0
  51. r2x-1.0.0/src/r2x/cli_functions.py +173 -0
  52. r2x-1.0.0/src/r2x/config_models.py +138 -0
  53. r2x-1.0.0/src/r2x/config_scenario.py +316 -0
  54. r2x-1.0.0/src/r2x/config_utils.py +96 -0
  55. r2x-1.0.0/src/r2x/core.py +5 -0
  56. r2x-1.0.0/src/r2x/defaults/__init__.py +0 -0
  57. r2x-1.0.0/src/r2x/defaults/config.json +310 -0
  58. r2x-1.0.0/src/r2x/defaults/example_defaults_override.yml +7 -0
  59. r2x-1.0.0/src/r2x/defaults/mapping_schema.json +34 -0
  60. r2x-1.0.0/src/r2x/defaults/master_9.2R6_btu.xml +186158 -0
  61. r2x-1.0.0/src/r2x/defaults/month_hrs.csv +13 -0
  62. r2x-1.0.0/src/r2x/defaults/pcm_defaults.json +1341 -0
  63. r2x-1.0.0/src/r2x/defaults/plexos_horizons.json +454 -0
  64. r2x-1.0.0/src/r2x/defaults/plexos_input.json +74 -0
  65. r2x-1.0.0/src/r2x/defaults/plexos_mapping.json +7 -0
  66. r2x-1.0.0/src/r2x/defaults/plexos_models.json +468 -0
  67. r2x-1.0.0/src/r2x/defaults/plexos_output.json +223 -0
  68. r2x-1.0.0/src/r2x/defaults/plexos_reports.json +842 -0
  69. r2x-1.0.0/src/r2x/defaults/plexos_simulation_objects.json +410 -0
  70. r2x-1.0.0/src/r2x/defaults/plugins_config.json +11 -0
  71. r2x-1.0.0/src/r2x/defaults/reeds_input.json +395 -0
  72. r2x-1.0.0/src/r2x/defaults/reeds_us_mapping.json +488 -0
  73. r2x-1.0.0/src/r2x/defaults/sienna_config.json +330 -0
  74. r2x-1.0.0/src/r2x/defaults/sienna_mapping.json +6 -0
  75. r2x-1.0.0/src/r2x/defaults/user_dict.yaml +16 -0
  76. r2x-1.0.0/src/r2x/enums.py +93 -0
  77. r2x-1.0.0/src/r2x/exceptions.py +34 -0
  78. r2x-1.0.0/src/r2x/exporter/__init__.py +4 -0
  79. r2x-1.0.0/src/r2x/exporter/handler.py +305 -0
  80. r2x-1.0.0/src/r2x/exporter/plexos.py +1060 -0
  81. r2x-1.0.0/src/r2x/exporter/sienna.py +642 -0
  82. r2x-1.0.0/src/r2x/exporter/utils.py +371 -0
  83. r2x-1.0.0/src/r2x/logger.py +87 -0
  84. r2x-1.0.0/src/r2x/models/__init__.py +24 -0
  85. r2x-1.0.0/src/r2x/models/branch.py +120 -0
  86. r2x-1.0.0/src/r2x/models/core.py +60 -0
  87. r2x-1.0.0/src/r2x/models/costs.py +88 -0
  88. r2x-1.0.0/src/r2x/models/generators.py +328 -0
  89. r2x-1.0.0/src/r2x/models/load.py +85 -0
  90. r2x-1.0.0/src/r2x/models/services.py +110 -0
  91. r2x-1.0.0/src/r2x/models/topology.py +97 -0
  92. r2x-1.0.0/src/r2x/models/utils.py +40 -0
  93. r2x-1.0.0/src/r2x/parser/__init__.py +7 -0
  94. r2x-1.0.0/src/r2x/parser/handler.py +305 -0
  95. r2x-1.0.0/src/r2x/parser/parser_helpers.py +346 -0
  96. r2x-1.0.0/src/r2x/parser/plexos.py +1740 -0
  97. r2x-1.0.0/src/r2x/parser/plexos_utils.py +508 -0
  98. r2x-1.0.0/src/r2x/parser/polars_helpers.py +209 -0
  99. r2x-1.0.0/src/r2x/parser/reeds.py +834 -0
  100. r2x-1.0.0/src/r2x/plugins/__init__.py +0 -0
  101. r2x-1.0.0/src/r2x/plugins/break_gens.py +210 -0
  102. r2x-1.0.0/src/r2x/plugins/ccs_credit.py +93 -0
  103. r2x-1.0.0/src/r2x/plugins/emission_cap.py +117 -0
  104. r2x-1.0.0/src/r2x/plugins/hurdle_rate.py +70 -0
  105. r2x-1.0.0/src/r2x/plugins/imports.py +91 -0
  106. r2x-1.0.0/src/r2x/plugins/pcm_defaults.py +168 -0
  107. r2x-1.0.0/src/r2x/plugins/utils.py +71 -0
  108. r2x-1.0.0/src/r2x/runner.py +186 -0
  109. r2x-1.0.0/src/r2x/units.py +78 -0
  110. r2x-1.0.0/src/r2x/upgrader/__init__.py +3 -0
  111. r2x-1.0.0/src/r2x/upgrader/file_tracker.csv +18 -0
  112. r2x-1.0.0/src/r2x/upgrader/functions.py +368 -0
  113. r2x-1.0.0/src/r2x/upgrader/helpers.py +49 -0
  114. r2x-1.0.0/src/r2x/utils.py +664 -0
  115. r2x-1.0.0/src/r2x/validation.py +114 -0
  116. r2x-1.0.0/tests/__init__.py +1 -0
  117. r2x-1.0.0/tests/conftest.py +64 -0
  118. r2x-1.0.0/tests/models/__init__.py +3 -0
  119. r2x-1.0.0/tests/models/ieee5bus.py +164 -0
  120. r2x-1.0.0/tests/models/pjm.py +187 -0
  121. r2x-1.0.0/tests/test_api.py +37 -0
  122. r2x-1.0.0/tests/test_break_gens.py +64 -0
  123. r2x-1.0.0/tests/test_configuration_class.py +202 -0
  124. r2x-1.0.0/tests/test_configuration_utils.py +45 -0
  125. r2x-1.0.0/tests/test_csv_handler.py +29 -0
  126. r2x-1.0.0/tests/test_defaults.py +25 -0
  127. r2x-1.0.0/tests/test_exporter.py +4 -0
  128. r2x-1.0.0/tests/test_exporter_handler.py +0 -0
  129. r2x-1.0.0/tests/test_exporter_utils.py +205 -0
  130. r2x-1.0.0/tests/test_models.py +50 -0
  131. r2x-1.0.0/tests/test_operational_cost.py +57 -0
  132. r2x-1.0.0/tests/test_parser_handler.py +16 -0
  133. r2x-1.0.0/tests/test_parser_helper.py +209 -0
  134. r2x-1.0.0/tests/test_parser_utils.py +68 -0
  135. r2x-1.0.0/tests/test_plexos_exporter.py +58 -0
  136. r2x-1.0.0/tests/test_plexos_parser.py +79 -0
  137. r2x-1.0.0/tests/test_plexos_utils.py +96 -0
  138. r2x-1.0.0/tests/test_plugin_emission_cap.py +137 -0
  139. r2x-1.0.0/tests/test_plugin_hurdle_rate.py +83 -0
  140. r2x-1.0.0/tests/test_reeds_parser.py +89 -0
  141. r2x-1.0.0/tests/test_runner.py +39 -0
  142. r2x-1.0.0/tests/test_sienna_exporter.py +156 -0
  143. r2x-1.0.0/tests/test_upgrader.py +125 -0
  144. r2x-1.0.0/tests/test_upgrader_helpers.py +26 -0
  145. r2x-1.0.0/tests/test_utils.py +64 -0
  146. r2x-1.0.0/tests/utils.py +11 -0
@@ -0,0 +1,8 @@
1
+ [bumpversion]
2
+ current_version = 1.0.0
3
+ commit = true
4
+ tag = true
5
+
6
+ [bumpversion:file:src/r2x/__version__.py]
7
+
8
+ [bumpversion:file:pyproject.toml]
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: bug
3
+ about: Create a report to help us improve
4
+ title: 'bug:'
5
+ labels: bug
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+
16
+ **Expected behavior**
17
+ A clear and concise description of what you expected to happen.
18
+
19
+ **Screenshots**
20
+ If applicable, add screenshots to help explain your problem.
21
+
22
+ **Environement (please complete the following information):**
23
+ - OS: [e.g. Windows, MacOs]
24
+ - R2X version: [e.g. 0.3.X]
25
+
26
+ **Additional context**
27
+ Add any other context about the problem here.
@@ -0,0 +1,8 @@
1
+ ---
2
+ name: chore
3
+ about: Create a todo (chore) for the developers
4
+ title: 'chore:'
5
+ labels: Backlog
6
+ assignees: pesap
7
+
8
+ ---
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: feat
3
+ about: Suggest an idea for this project
4
+ title: 'feat:'
5
+ labels: Idea
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+
12
+ **Describe the solution you'd like**
13
+
14
+ **Describe alternatives you've considered**
15
+
16
+ **Additional context**
17
+ Add any other context or screenshots about the feature request here.
@@ -0,0 +1,100 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches:
8
+ - main
9
+ workflow_dispatch:
10
+
11
+ env:
12
+ DEFAULT_PYTHON: "3.12"
13
+ DEFAULT_OS: ubuntu-latest
14
+
15
+ jobs:
16
+ pytest:
17
+ strategy:
18
+ matrix:
19
+ python-version: ["3.11", "3.12"]
20
+ os: [ubuntu-latest, windows-latest]
21
+ permissions:
22
+ pull-requests: write
23
+ contents: write
24
+
25
+ runs-on: ${{ matrix.os }}
26
+ steps:
27
+ - uses: actions/checkout@v4
28
+ - name: Install uv
29
+ uses: astral-sh/setup-uv@v3
30
+
31
+ - name: Set up Python ${{ matrix.python-version }}
32
+ run: uv python install ${{ matrix.python-version }}
33
+
34
+ - name: Installing dependencies
35
+ run: uv sync --dev
36
+
37
+ - name: Running package tests
38
+ run: |
39
+ uv run pytest -vvl --cov --cov-report=xml
40
+
41
+ - name: codecov
42
+ uses: codecov/codecov-action@v4.2.0
43
+ if: ${{ matrix.os == env.DEFAULT_OS && matrix.python-version == env.DEFAULT_PYTHON }}
44
+ with:
45
+ token: ${{ secrets.CODECOV_TOKEN }}
46
+ name: r2x-test
47
+ fail_ci_if_error: false
48
+ verbose: true
49
+
50
+ pre-commit:
51
+ runs-on: ubuntu-latest
52
+ steps:
53
+ - uses: actions/checkout@v4
54
+
55
+ - name: Install uv
56
+ uses: astral-sh/setup-uv@v3
57
+
58
+ - name: Set up pinned Python version
59
+ uses: actions/setup-python@v5
60
+ with:
61
+ python-version-file: "pyproject.toml"
62
+
63
+ - name: Installing dependencies
64
+ run: uv sync --dev
65
+ - name: Run pre-commit
66
+ run: |
67
+ uv run pre-commit run --all-files
68
+
69
+ mypy:
70
+ runs-on: ubuntu-latest
71
+ name: "mypy"
72
+ steps:
73
+ - uses: actions/checkout@v4
74
+
75
+ - name: Install uv
76
+ uses: astral-sh/setup-uv@v3
77
+ - name: Set up Python
78
+ uses: actions/setup-python@v5
79
+ with:
80
+ python-version-file: "pyproject.toml"
81
+ - name: Installing dependencies
82
+ run: uv sync --dev
83
+ - name: Run mypy
84
+ run: |
85
+ uv run mypy --config-file=pyproject.toml src/
86
+
87
+ ruff:
88
+ runs-on: ubuntu-latest
89
+ steps:
90
+ - uses: actions/checkout@v4
91
+ - name: Install uv
92
+ uses: astral-sh/setup-uv@v3
93
+ - name: Set up Python
94
+ uses: actions/setup-python@v5
95
+ with:
96
+ python-version-file: "pyproject.toml"
97
+ - name: Installing dependencies
98
+ run: uv sync --dev
99
+ - name: Run Ruff
100
+ run: uv run ruff check --output-format=github src/
@@ -0,0 +1,44 @@
1
+ # This is a basic workflow to help you get started with Actions
2
+
3
+ name: Documentation
4
+
5
+ # Controls when the workflow will run
6
+ on:
7
+ # Triggers the workflow on push or pull request events but only for the "main" branch
8
+ push:
9
+ branches:
10
+ - main
11
+ pull_request:
12
+ branches:
13
+ - main
14
+
15
+ # Allows you to run this workflow manually from the Actions tab
16
+ workflow_dispatch:
17
+
18
+ jobs:
19
+ build:
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+ - name: Install uv
24
+ uses: astral-sh/setup-uv@v3
25
+
26
+ - name: "Set up Python"
27
+ uses: actions/setup-python@v5
28
+ with:
29
+ python-version-file: "pyproject.toml"
30
+
31
+ - name: Install the project
32
+ run: uv sync --group docs
33
+
34
+ - name: Build Sphinx documentation
35
+ run: uv run sphinx-build docs/source/ docs/build/
36
+
37
+ - name: Deploy to GitHub Pages
38
+ uses: peaceiris/actions-gh-pages@v3
39
+ if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
40
+ with:
41
+ publish_branch: gh-pages
42
+ github_token: ${{ secrets.GITHUB_TOKEN }}
43
+ publish_dir: docs/build/
44
+ force_orphan: true
@@ -0,0 +1,27 @@
1
+ name: Upload to PyPi
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ deploy:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - name: Set up Python
13
+ uses: actions/setup-python@v5
14
+ with:
15
+ python-version: 3.11
16
+ - name: Install dependencies
17
+ run: |
18
+ python -m pip install --upgrade pip
19
+ python -m pip install build
20
+ pip install setuptools wheel twine
21
+ - name: Build and publish
22
+ env:
23
+ TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
24
+ TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
25
+ run: |
26
+ python -m build
27
+ twine upload dist/*
r2x-1.0.0/.gitignore ADDED
@@ -0,0 +1,193 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ target/
76
+
77
+ # Jupyter Notebook
78
+ .ipynb_checkpoints
79
+
80
+ # IPython
81
+ profile_default/
82
+ ipython_config.py
83
+
84
+ # pyenv
85
+ .python-version
86
+
87
+ # pipenv
88
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
90
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
91
+ # install all needed dependencies.
92
+ #Pipfile.lock
93
+
94
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95
+ __pypackages__/
96
+
97
+ # Celery stuff
98
+ celerybeat-schedule
99
+ celerybeat.pid
100
+
101
+ # SageMath parsed files
102
+ *.sage.py
103
+
104
+ # Environments
105
+ .env
106
+ .venv
107
+ env/
108
+ venv/
109
+ ENV/
110
+ env.bak/
111
+ venv.bak/
112
+
113
+ # Spyder project settings
114
+ .spyderproject
115
+ .spyproject
116
+
117
+ # Rope project settings
118
+ .ropeproject
119
+
120
+ # mkdocs documentation
121
+ /site
122
+
123
+ # mypy
124
+ .mypy_cache/
125
+ .dmypy.json
126
+ dmypy.json
127
+
128
+ # Pyre type checker
129
+ .pyre/
130
+
131
+ ### macOS ###
132
+ # General
133
+ .DS_Store
134
+ .AppleDouble
135
+ .LSOverride
136
+
137
+ # Icon must end with two \r
138
+ Icon
139
+
140
+
141
+ # Thumbnails
142
+ ._*
143
+
144
+ # Files that might appear in the root of a volume
145
+ .DocumentRevisions-V100
146
+ .fseventsd
147
+ .Spotlight-V100
148
+ .TemporaryItems
149
+ .Trashes
150
+ .VolumeIcon.icns
151
+ .com.apple.timemachine.donotpresent
152
+
153
+ # Directories potentially created on remote AFP share
154
+ .AppleDB
155
+ .AppleDesktop
156
+ Network Trash Folder
157
+ Temporary Items
158
+ .apdisk
159
+
160
+ ### macOS Patch ###
161
+ # iCloud generated files
162
+ *.icloud
163
+
164
+ ### VisualStudioCode ###
165
+ .vscode
166
+ .vscode/*
167
+ !.vscode/settings.json
168
+ !.vscode/tasks.json
169
+ !.vscode/launch.json
170
+ !.vscode/extensions.json
171
+ !.vscode/*.code-snippets
172
+
173
+ # Local History for Visual Studio Code
174
+ .history/
175
+
176
+ # Built Visual Studio Code Extensions
177
+ *.vsix
178
+
179
+ ### VisualStudioCode Patch ###
180
+ # Ignore all local history of files
181
+ .history
182
+ .ionide
183
+
184
+
185
+ ### Data folder and random stuff###
186
+ data/
187
+ notebooks/
188
+ *.pstats
189
+ *.png
190
+ *.parquet
191
+ *.xlsx
192
+ .worktree
193
+ tags
@@ -0,0 +1,33 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v4.6.0 # Use the ref you want to point at
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ - id: check-added-large-files
7
+ args: ["--maxkb=10000"]
8
+ - id: check-json
9
+ - id: pretty-format-json
10
+ args: ["--autofix"]
11
+ - id: check-yaml
12
+ - id: check-case-conflict
13
+ - id: check-xml
14
+ - id: end-of-file-fixer
15
+ - repo: https://github.com/pre-commit/mirrors-prettier
16
+ rev: "v4.0.0-alpha.8"
17
+ hooks:
18
+ - id: prettier
19
+ types_or: [yaml]
20
+ - repo: https://github.com/astral-sh/ruff-pre-commit
21
+ rev: v0.5.2
22
+ hooks:
23
+ - id: ruff
24
+ args: [--fix]
25
+ - id: ruff-format
26
+ - repo: https://github.com/pre-commit/mirrors-mypy
27
+ rev: "v1.11.0"
28
+ hooks:
29
+ - id: mypy
30
+ types: [python]
31
+ args: [--config-file=pyproject.toml, ./src/r2x]
32
+ pass_filenames: false
33
+ language: system
r2x-1.0.0/LICENCE.txt ADDED
@@ -0,0 +1,13 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2024, Alliance for Sustainable Energy LLC, All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8
+
9
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10
+
11
+ * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
r2x-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,24 @@
1
+ Metadata-Version: 2.4
2
+ Name: r2x
3
+ Version: 1.0.0
4
+ Summary: ReEDS to X parser
5
+ Author-email: Pedro Sanchez <psanchez@nrel.gov>, Obika Kodi <kodi.obika@nrel.gov>, Vivienne Liu <vivienne.liu@nrel.gov>
6
+ License-File: LICENCE.txt
7
+ Classifier: Development Status :: 4 - Beta
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: License :: OSI Approved :: BSD License
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Topic :: Software Development :: Build Tools
14
+ Requires-Python: <3.13,>=3.11
15
+ Requires-Dist: cvxpy~=1.5.3
16
+ Requires-Dist: infrasys~=0.1.1
17
+ Requires-Dist: jsonschema~=4.23
18
+ Requires-Dist: loguru~=0.7.2
19
+ Requires-Dist: pandas~=2.2
20
+ Requires-Dist: plexosdb~=0.0.6
21
+ Requires-Dist: polars~=1.1.0
22
+ Requires-Dist: pyyaml~=6.0.1
23
+ Requires-Dist: rich~=13.7.1
24
+ Requires-Dist: tables~=3.9.2
r2x-1.0.0/README.md ADDED
@@ -0,0 +1,75 @@
1
+ <img src="https://www.nrel.gov/client/img/icon-manufacturing.svg" alt="SWC" align="left" width="192px" height="192px"/>
2
+ <img align="left" width="0" height="192px" hspace="10"/>
3
+
4
+ ### R2X
5
+ > Model translation parsing tool (ReEDS to X)
6
+ >
7
+ > [![image](https://img.shields.io/pypi/v/r2x.svg)](https://pypi.python.org/pypi/r2x)
8
+ > [![image](https://img.shields.io/pypi/l/r2x.svg)](https://pypi.python.org/pypi/r2x)
9
+ > [![image](https://img.shields.io/pypi/pyversions/r2x.svg)](https://pypi.python.org/pypi/r2x)
10
+ > [![CI](https://github.com/NREL/r2x/actions/workflows/CI.yaml/badge.svg)](https://github.com/NREL/r2x/actions/workflows/CI.yaml)
11
+ > [![codecov](https://codecov.io/gh/NREL/r2x/branch/main/graph/badge.svg)](https://codecov.io/gh/NREL/r2x)
12
+ > [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
13
+ > [![Documentation](https://github.com/NREL/R2X/actions/workflows/docs-build.yaml/badge.svg?branch=main)](https://nrel.github.io/R2X/)
14
+ <br/>
15
+ <br/>
16
+ <br/>
17
+
18
+
19
+ ## Table of contents
20
+ * [Installation](#installation)
21
+ * [Features](#features)
22
+ * [Documentation](#documentation)
23
+ * [Roadmap](#roadmap)
24
+ * [Compatibility](#compatibility)
25
+
26
+
27
+ ## Installation
28
+
29
+ Install R2X on your local Python installation from PyPi
30
+
31
+ ```console
32
+ python -m pip install r2x
33
+ ```
34
+
35
+ Or use it as standalone tool,
36
+
37
+ ```console
38
+ uvx r2x --help
39
+ ```
40
+
41
+ ## Features
42
+
43
+ - [PowerSystem.jl](https://github.com/NREL-Sienna/PowerSystems.jl) model representations
44
+ - Translate [ReEDS](https://github.com/NREL/ReEDS-2.0) models to PCM models like [Sienna](https://github.com/NREL-Sienna) or PLEXOS,
45
+ - Translate from PLEXOS XML's to Sienna,
46
+ - Comprehensive PLEXOS XML parser,
47
+
48
+ ## Documentation
49
+
50
+ R2X documentation is available at [https://nrel.github.io/R2X/](https://nrel.github.io/R2X/)
51
+
52
+
53
+ ## Roadmap
54
+
55
+ If you're curious about what we're working on, check out the roadmap:
56
+
57
+ - [Active issues](https://github.com/NREL/R2X/issues?q=is%3Aopen+is%3Aissue+label%3A%22Working+on+it+%F0%9F%92%AA%22+sort%3Aupdated-asc): Issues that we are actively working on.
58
+ - [Prioritized backlog](https://github.com/NREL/R2X/issues?q=is%3Aopen+is%3Aissue+label%3ABacklog): Issues we'll be working on next.
59
+ - [Nice-to-have](https://github.com/NREL/R2X/labels/Optional): Nice to have features or Issues to fix. Anyone can start working on (please let us know before you do).
60
+ - [Ideas](https://github.com/NREL/R2X/issues?q=is%3Aopen+is%3Aissue+label%3AIdea): Future work or ideas for R2X.
61
+
62
+
63
+ ## Model compatibility
64
+
65
+ | R2X Version | Supported Input Model Versions | Supported Output Model Versions |
66
+ |--------------|----------------------------------------- |----------------------------------------- |
67
+ | 1.0 | ReEDS (v2024.8.0) | PLEXOS (9.0, 9.2, 10) |
68
+ | | Sienna (PSY 3.0) | Sienna (PSY 3.0, 4.0) |
69
+ | | PLEXOS (9.0, 9.2, 10) | |
70
+
71
+ ### Licence
72
+
73
+ R2X is released under a BSD 3-Clause License.
74
+
75
+ R2X was developed under software record SWR-24-91 at the National Renewable Energy Laboratory (NREL).
r2x-1.0.0/cliff.toml ADDED
@@ -0,0 +1,92 @@
1
+ # git-cliff ~ configuration file
2
+ # https://git-cliff.org/docs/configuration
3
+
4
+ [changelog]
5
+ # changelog header
6
+ header = """
7
+ # Changelog\n
8
+ All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines.\n
9
+ """
10
+ # template for the changelog body
11
+ # https://keats.github.io/tera/docs/#introduction
12
+ body = """
13
+ ---
14
+ {% if version %}\
15
+ {% if previous.version %}\
16
+ ## [{{ version | trim_start_matches(pat="v") }}]($REPO/compare/{{ previous.version }}..{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }}
17
+ {% else %}\
18
+ ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
19
+ {% endif %}\
20
+ {% else %}\
21
+ ## [unreleased]
22
+ {% endif %}\
23
+ {% for group, commits in commits | group_by(attribute="group") %}
24
+ ### {{ group | striptags | trim | upper_first }}
25
+ {% for commit in commits
26
+ | filter(attribute="scope")
27
+ | sort(attribute="scope") %}
28
+ - **({{commit.scope}})**{% if commit.breaking %} [**breaking**]{% endif %} \
29
+ {{ commit.message }} - ([{{ commit.id | truncate(length=7, end="") }}]($REPO/commit/{{ commit.id }})) - {{ commit.author.name }}
30
+ {%- endfor -%}
31
+ {% raw %}\n{% endraw %}\
32
+ {%- for commit in commits %}
33
+ {%- if commit.scope -%}
34
+ {% else -%}
35
+ - {% if commit.breaking %} [**breaking**]{% endif %}\
36
+ {{ commit.message }} - ([{{ commit.id | truncate(length=7, end="") }}]($REPO/commit/{{ commit.id }})) - {{ commit.author.name }}
37
+ {% endif -%}
38
+ {% endfor -%}
39
+ {% endfor %}\n
40
+ """
41
+ # template for the changelog footer
42
+ footer = """
43
+ <!-- generated by git-cliff -->
44
+ """
45
+ # remove the leading and trailing whitespace from the templates
46
+ trim = true
47
+ # postprocessors
48
+ postprocessors = [
49
+ { pattern = '\$REPO', replace = "https://github.com/NREL/R2X" }, # replace repository URL
50
+ ]
51
+
52
+ [git]
53
+ # parse the commits based on https://www.conventionalcommits.org
54
+ conventional_commits = true
55
+ # filter out the commits that are not conventional
56
+ filter_unconventional = true
57
+ # process each line of a commit as an individual commit
58
+ split_commits = false
59
+ # regex for preprocessing the commit messages
60
+ commit_preprocessors = [
61
+ # { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://github.com/orhun/git-cliff/issues/${2}))"}, # replace issue numbers
62
+ ]
63
+ # regex for parsing and grouping commits
64
+ commit_parsers = [
65
+ { message = "^feat", group = "Features" },
66
+ { message = "^fix", group = "Bug Fixes" },
67
+ { message = "^doc", group = "Documentation" },
68
+ { message = "^perf", group = "Performance" },
69
+ { message = "^refactor", group = "Refactoring" },
70
+ { message = "^style", group = "Style" },
71
+ { message = "^revert", group = "Revert" },
72
+ { message = "^test", group = "Tests" },
73
+ { message = "^chore\\(version\\):", skip = true },
74
+ { message = "^chore", group = "Miscellaneous Chores" },
75
+ { body = ".*security", group = "Security" },
76
+ ]
77
+ # protect breaking changes from being skipped due to matching a skipping commit_parser
78
+ protect_breaking_commits = false
79
+ # filter out the commits that are not matched by commit parsers
80
+ filter_commits = false
81
+ # regex for matching git tags
82
+ tag_pattern = "v[0-9].*"
83
+ # regex for skipping tags
84
+ skip_tags = "v0.1.0-beta.1"
85
+ # regex for ignoring tags
86
+ ignore_tags = ""
87
+ # sort the tags topologically
88
+ topo_order = false
89
+ # sort the commits inside sections by oldest/newest order
90
+ sort_commits = "oldest"
91
+ # limit the number of commits included in the changelog.
92
+ # limit_commits = 42