VeraGridServer 5.4.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.
@@ -0,0 +1,28 @@
1
+ Metadata-Version: 2.1
2
+ Name: VeraGridServer
3
+ Version: 5.4.0
4
+ Summary: VeraGrid is a Power Systems simulation program intended for professional use and research
5
+ Home-page: https://github.com/SanPen/VeraGrid
6
+ Author: Santiago Peñate Vera et. Al.
7
+ Author-email: spenate@eroots.tech
8
+ License: MPL2
9
+ Keywords: power systems planning
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ Provides-Extra: gch5
14
+
15
+ # VeraGrid
16
+ This software aims to be a complete platform for power systems research and simulation.)
17
+
18
+ [Watch the video https](https://youtu.be/SY66WgLGo54)
19
+ [Check out the documentation](https://veragrid.readthedocs.io)
20
+
21
+ ## Installation
22
+
23
+ pip install veragrid
24
+
25
+ For more options (including a standalone setup one), follow the
26
+ [installation instructions]( https://veragrid.readthedocs.io/en/latest/getting_started/install.html)
27
+ from the project's [documentation](https://veragrid.readthedocs.io)
28
+
@@ -0,0 +1,373 @@
1
+ Mozilla Public License Version 2.0
2
+ ==================================
3
+
4
+ 1. Definitions
5
+ --------------
6
+
7
+ 1.1. "Contributor"
8
+ means each individual or legal entity that creates, contributes to
9
+ the creation of, or owns Covered Software.
10
+
11
+ 1.2. "Contributor Version"
12
+ means the combination of the Contributions of others (if any) used
13
+ by a Contributor and that particular Contributor's Contribution.
14
+
15
+ 1.3. "Contribution"
16
+ means Covered Software of a particular Contributor.
17
+
18
+ 1.4. "Covered Software"
19
+ means Source Code Form to which the initial Contributor has attached
20
+ the notice in Exhibit A, the Executable Form of such Source Code
21
+ Form, and Modifications of such Source Code Form, in each case
22
+ including portions thereof.
23
+
24
+ 1.5. "Incompatible With Secondary Licenses"
25
+ means
26
+
27
+ (a) that the initial Contributor has attached the notice described
28
+ in Exhibit B to the Covered Software; or
29
+
30
+ (b) that the Covered Software was made available under the terms of
31
+ version 1.1 or earlier of the License, but not also under the
32
+ terms of a Secondary License.
33
+
34
+ 1.6. "Executable Form"
35
+ means any form of the work other than Source Code Form.
36
+
37
+ 1.7. "Larger Work"
38
+ means a work that combines Covered Software with other material, in
39
+ a separate file or files, that is not Covered Software.
40
+
41
+ 1.8. "License"
42
+ means this document.
43
+
44
+ 1.9. "Licensable"
45
+ means having the right to grant, to the maximum extent possible,
46
+ whether at the time of the initial grant or subsequently, any and
47
+ all of the rights conveyed by this License.
48
+
49
+ 1.10. "Modifications"
50
+ means any of the following:
51
+
52
+ (a) any file in Source Code Form that results from an addition to,
53
+ deletion from, or modification of the contents of Covered
54
+ Software; or
55
+
56
+ (b) any new file in Source Code Form that contains any Covered
57
+ Software.
58
+
59
+ 1.11. "Patent Claims" of a Contributor
60
+ means any patent claim(s), including without limitation, method,
61
+ process, and apparatus claims, in any patent Licensable by such
62
+ Contributor that would be infringed, but for the grant of the
63
+ License, by the making, using, selling, offering for sale, having
64
+ made, import, or transfer of either its Contributions or its
65
+ Contributor Version.
66
+
67
+ 1.12. "Secondary License"
68
+ means either the GNU General Public License, Version 2.0, the GNU
69
+ Lesser General Public License, Version 2.1, the GNU Affero General
70
+ Public License, Version 3.0, or any later versions of those
71
+ licenses.
72
+
73
+ 1.13. "Source Code Form"
74
+ means the form of the work preferred for making modifications.
75
+
76
+ 1.14. "You" (or "Your")
77
+ means an individual or a legal entity exercising rights under this
78
+ License. For legal entities, "You" includes any entity that
79
+ controls, is controlled by, or is under common control with You. For
80
+ purposes of this definition, "control" means (a) the power, direct
81
+ or indirect, to cause the direction or management of such entity,
82
+ whether by contract or otherwise, or (b) ownership of more than
83
+ fifty percent (50%) of the outstanding shares or beneficial
84
+ ownership of such entity.
85
+
86
+ 2. License Grants and Conditions
87
+ --------------------------------
88
+
89
+ 2.1. Grants
90
+
91
+ Each Contributor hereby grants You a world-wide, royalty-free,
92
+ non-exclusive license:
93
+
94
+ (a) under intellectual property rights (other than patent or trademark)
95
+ Licensable by such Contributor to use, reproduce, make available,
96
+ modify, display, perform, distribute, and otherwise exploit its
97
+ Contributions, either on an unmodified basis, with Modifications, or
98
+ as part of a Larger Work; and
99
+
100
+ (b) under Patent Claims of such Contributor to make, use, sell, offer
101
+ for sale, have made, import, and otherwise transfer either its
102
+ Contributions or its Contributor Version.
103
+
104
+ 2.2. Effective Date
105
+
106
+ The licenses granted in Section 2.1 with respect to any Contribution
107
+ become effective for each Contribution on the date the Contributor first
108
+ distributes such Contribution.
109
+
110
+ 2.3. Limitations on Grant Scope
111
+
112
+ The licenses granted in this Section 2 are the only rights granted under
113
+ this License. No additional rights or licenses will be implied from the
114
+ distribution or licensing of Covered Software under this License.
115
+ Notwithstanding Section 2.1(b) above, no patent license is granted by a
116
+ Contributor:
117
+
118
+ (a) for any code that a Contributor has removed from Covered Software;
119
+ or
120
+
121
+ (b) for infringements caused by: (i) Your and any other third party's
122
+ modifications of Covered Software, or (ii) the combination of its
123
+ Contributions with other software (except as part of its Contributor
124
+ Version); or
125
+
126
+ (c) under Patent Claims infringed by Covered Software in the absence of
127
+ its Contributions.
128
+
129
+ This License does not grant any rights in the trademarks, service marks,
130
+ or logos of any Contributor (except as may be necessary to comply with
131
+ the notice requirements in Section 3.4).
132
+
133
+ 2.4. Subsequent Licenses
134
+
135
+ No Contributor makes additional grants as a result of Your choice to
136
+ distribute the Covered Software under a subsequent version of this
137
+ License (see Section 10.2) or under the terms of a Secondary License (if
138
+ permitted under the terms of Section 3.3).
139
+
140
+ 2.5. Representation
141
+
142
+ Each Contributor represents that the Contributor believes its
143
+ Contributions are its original creation(s) or it has sufficient rights
144
+ to grant the rights to its Contributions conveyed by this License.
145
+
146
+ 2.6. Fair Use
147
+
148
+ This License is not intended to limit any rights You have under
149
+ applicable copyright doctrines of fair use, fair dealing, or other
150
+ equivalents.
151
+
152
+ 2.7. Conditions
153
+
154
+ Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
155
+ in Section 2.1.
156
+
157
+ 3. Responsibilities
158
+ -------------------
159
+
160
+ 3.1. Distribution of Source Form
161
+
162
+ All distribution of Covered Software in Source Code Form, including any
163
+ Modifications that You create or to which You contribute, must be under
164
+ the terms of this License. You must inform recipients that the Source
165
+ Code Form of the Covered Software is governed by the terms of this
166
+ License, and how they can obtain a copy of this License. You may not
167
+ attempt to alter or restrict the recipients' rights in the Source Code
168
+ Form.
169
+
170
+ 3.2. Distribution of Executable Form
171
+
172
+ If You distribute Covered Software in Executable Form then:
173
+
174
+ (a) such Covered Software must also be made available in Source Code
175
+ Form, as described in Section 3.1, and You must inform recipients of
176
+ the Executable Form how they can obtain a copy of such Source Code
177
+ Form by reasonable means in a timely manner, at a charge no more
178
+ than the cost of distribution to the recipient; and
179
+
180
+ (b) You may distribute such Executable Form under the terms of this
181
+ License, or sublicense it under different terms, provided that the
182
+ license for the Executable Form does not attempt to limit or alter
183
+ the recipients' rights in the Source Code Form under this License.
184
+
185
+ 3.3. Distribution of a Larger Work
186
+
187
+ You may create and distribute a Larger Work under terms of Your choice,
188
+ provided that You also comply with the requirements of this License for
189
+ the Covered Software. If the Larger Work is a combination of Covered
190
+ Software with a work governed by one or more Secondary Licenses, and the
191
+ Covered Software is not Incompatible With Secondary Licenses, this
192
+ License permits You to additionally distribute such Covered Software
193
+ under the terms of such Secondary License(s), so that the recipient of
194
+ the Larger Work may, at their option, further distribute the Covered
195
+ Software under the terms of either this License or such Secondary
196
+ License(s).
197
+
198
+ 3.4. Notices
199
+
200
+ You may not remove or alter the substance of any license notices
201
+ (including copyright notices, patent notices, disclaimers of warranty,
202
+ or limitations of liability) contained within the Source Code Form of
203
+ the Covered Software, except that You may alter any license notices to
204
+ the extent required to remedy known factual inaccuracies.
205
+
206
+ 3.5. Application of Additional Terms
207
+
208
+ You may choose to offer, and to charge a fee for, warranty, support,
209
+ indemnity or liability obligations to one or more recipients of Covered
210
+ Software. However, You may do so only on Your own behalf, and not on
211
+ behalf of any Contributor. You must make it absolutely clear that any
212
+ such warranty, support, indemnity, or liability obligation is offered by
213
+ You alone, and You hereby agree to indemnify every Contributor for any
214
+ liability incurred by such Contributor as a result of warranty, support,
215
+ indemnity or liability terms You offer. You may include additional
216
+ disclaimers of warranty and limitations of liability specific to any
217
+ jurisdiction.
218
+
219
+ 4. Inability to Comply Due to Statute or Regulation
220
+ ---------------------------------------------------
221
+
222
+ If it is impossible for You to comply with any of the terms of this
223
+ License with respect to some or all of the Covered Software due to
224
+ statute, judicial order, or regulation then You must: (a) comply with
225
+ the terms of this License to the maximum extent possible; and (b)
226
+ describe the limitations and the code they affect. Such description must
227
+ be placed in a text file included with all distributions of the Covered
228
+ Software under this License. Except to the extent prohibited by statute
229
+ or regulation, such description must be sufficiently detailed for a
230
+ recipient of ordinary skill to be able to understand it.
231
+
232
+ 5. Termination
233
+ --------------
234
+
235
+ 5.1. The rights granted under this License will terminate automatically
236
+ if You fail to comply with any of its terms. However, if You become
237
+ compliant, then the rights granted under this License from a particular
238
+ Contributor are reinstated (a) provisionally, unless and until such
239
+ Contributor explicitly and finally terminates Your grants, and (b) on an
240
+ ongoing basis, if such Contributor fails to notify You of the
241
+ non-compliance by some reasonable means prior to 60 days after You have
242
+ come back into compliance. Moreover, Your grants from a particular
243
+ Contributor are reinstated on an ongoing basis if such Contributor
244
+ notifies You of the non-compliance by some reasonable means, this is the
245
+ first time You have received notice of non-compliance with this License
246
+ from such Contributor, and You become compliant prior to 30 days after
247
+ Your receipt of the notice.
248
+
249
+ 5.2. If You initiate litigation against any entity by asserting a patent
250
+ infringement claim (excluding declaratory judgment actions,
251
+ counter-claims, and cross-claims) alleging that a Contributor Version
252
+ directly or indirectly infringes any patent, then the rights granted to
253
+ You by any and all Contributors for the Covered Software under Section
254
+ 2.1 of this License shall terminate.
255
+
256
+ 5.3. In the event of termination under Sections 5.1 or 5.2 above, all
257
+ end user license agreements (excluding distributors and resellers) which
258
+ have been validly granted by You or Your distributors under this License
259
+ prior to termination shall survive termination.
260
+
261
+ ************************************************************************
262
+ * *
263
+ * 6. Disclaimer of Warranty *
264
+ * ------------------------- *
265
+ * *
266
+ * Covered Software is provided under this License on an "as is" *
267
+ * basis, without warranty of any kind, either expressed, implied, or *
268
+ * statutory, including, without limitation, warranties that the *
269
+ * Covered Software is free of defects, merchantable, fit for a *
270
+ * particular purpose or non-infringing. The entire risk as to the *
271
+ * quality and performance of the Covered Software is with You. *
272
+ * Should any Covered Software prove defective in any respect, You *
273
+ * (not any Contributor) assume the cost of any necessary servicing, *
274
+ * repair, or correction. This disclaimer of warranty constitutes an *
275
+ * essential part of this License. No use of any Covered Software is *
276
+ * authorized under this License except under this disclaimer. *
277
+ * *
278
+ ************************************************************************
279
+
280
+ ************************************************************************
281
+ * *
282
+ * 7. Limitation of Liability *
283
+ * -------------------------- *
284
+ * *
285
+ * Under no circumstances and under no legal theory, whether tort *
286
+ * (including negligence), contract, or otherwise, shall any *
287
+ * Contributor, or anyone who distributes Covered Software as *
288
+ * permitted above, be liable to You for any direct, indirect, *
289
+ * special, incidental, or consequential damages of any character *
290
+ * including, without limitation, damages for lost profits, loss of *
291
+ * goodwill, work stoppage, computer failure or malfunction, or any *
292
+ * and all other commercial damages or losses, even if such party *
293
+ * shall have been informed of the possibility of such damages. This *
294
+ * limitation of liability shall not apply to liability for death or *
295
+ * personal injury resulting from such party's negligence to the *
296
+ * extent applicable law prohibits such limitation. Some *
297
+ * jurisdictions do not allow the exclusion or limitation of *
298
+ * incidental or consequential damages, so this exclusion and *
299
+ * limitation may not apply to You. *
300
+ * *
301
+ ************************************************************************
302
+
303
+ 8. Litigation
304
+ -------------
305
+
306
+ Any litigation relating to this License may be brought only in the
307
+ courts of a jurisdiction where the defendant maintains its principal
308
+ place of business and such litigation shall be governed by laws of that
309
+ jurisdiction, without reference to its conflict-of-law provisions.
310
+ Nothing in this Section shall prevent a party's ability to bring
311
+ cross-claims or counter-claims.
312
+
313
+ 9. Miscellaneous
314
+ ----------------
315
+
316
+ This License represents the complete agreement concerning the subject
317
+ matter hereof. If any provision of this License is held to be
318
+ unenforceable, such provision shall be reformed only to the extent
319
+ necessary to make it enforceable. Any law or regulation which provides
320
+ that the language of a contract shall be construed against the drafter
321
+ shall not be used to construe this License against a Contributor.
322
+
323
+ 10. Versions of the License
324
+ ---------------------------
325
+
326
+ 10.1. New Versions
327
+
328
+ Mozilla Foundation is the license steward. Except as provided in Section
329
+ 10.3, no one other than the license steward has the right to modify or
330
+ publish new versions of this License. Each version will be given a
331
+ distinguishing version number.
332
+
333
+ 10.2. Effect of New Versions
334
+
335
+ You may distribute the Covered Software under the terms of the version
336
+ of the License under which You originally received the Covered Software,
337
+ or under the terms of any subsequent version published by the license
338
+ steward.
339
+
340
+ 10.3. Modified Versions
341
+
342
+ If you create software not governed by this License, and you want to
343
+ create a new license for such software, you may create and use a
344
+ modified version of this License if you rename the license and remove
345
+ any references to the name of the license steward (except to note that
346
+ such modified license differs from this License).
347
+
348
+ 10.4. Distributing Source Code Form that is Incompatible With Secondary
349
+ Licenses
350
+
351
+ If You choose to distribute Source Code Form that is Incompatible With
352
+ Secondary Licenses under the terms of this version of the License, the
353
+ notice described in Exhibit B of this License must be attached.
354
+
355
+ Exhibit A - Source Code Form License Notice
356
+ -------------------------------------------
357
+
358
+ This Source Code Form is subject to the terms of the Mozilla Public
359
+ License, v. 2.0. If a copy of the MPL was not distributed with this
360
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
361
+
362
+ If it is not possible or desirable to put the notice in a particular
363
+ file, then You may include the notice in a location (such as a LICENSE
364
+ file in a relevant directory) where a recipient would be likely to look
365
+ for such a notice.
366
+
367
+ You may add additional accurate notices of copyright ownership.
368
+
369
+ Exhibit B - "Incompatible With Secondary Licenses" Notice
370
+ ---------------------------------------------------------
371
+
372
+ This Source Code Form is "Incompatible With Secondary Licenses", as
373
+ defined by the Mozilla Public License, v. 2.0.
@@ -0,0 +1,4 @@
1
+ # This Source Code Form is subject to the terms of the Mozilla Public
2
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ # file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
+ # SPDX-License-Identifier: MPL-2.0
@@ -0,0 +1,26 @@
1
+ # This Source Code Form is subject to the terms of the Mozilla Public
2
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ # file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
+ # SPDX-License-Identifier: MPL-2.0
5
+ import datetime
6
+ _current_year_ = datetime.datetime.now().year
7
+
8
+ # remember to keep a three-number version!!!
9
+ __VeraGridServer_VERSION__ = "5.4.0"
10
+
11
+ url = 'https://github.com/SanPen/VeraGrid'
12
+
13
+ about_msg = "VeraGridServer v" + str(__VeraGridServer_VERSION__) + '\n\n'
14
+
15
+ about_msg += """
16
+ VeraGrid has been carefully crafted since 2015 to
17
+ serve as a platform for research and consultancy.\n"""
18
+
19
+ about_msg += """
20
+ This program is free software; you can redistribute it and/or
21
+ modify it subject to the terms of the Mozilla Public License, v. 2.0.
22
+ If a copy of the MPL was not distributed with this file,
23
+ You can obtain one at https://mozilla.org/MPL/2.0/.
24
+
25
+ The source of VeraGrid can be found at:
26
+ """ + url + "\n\n"
@@ -0,0 +1,56 @@
1
+ # This Source Code Form is subject to the terms of the Mozilla Public
2
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ # file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
+ # SPDX-License-Identifier: MPL-2.0
5
+ import os
6
+ import asyncio
7
+ import websockets
8
+ from typing import Callable
9
+
10
+
11
+ async def send_large_file(file_path: str,
12
+ websocket: websockets.WebSocketClientProtocol,
13
+ progress_func: Callable[[float], None] = None) -> None:
14
+ """
15
+ Send a large file via web-socket
16
+ :param file_path: local file path
17
+ :param websocket: web socket instance
18
+ :param progress_func: Progress function
19
+ :return: None
20
+ """
21
+ # Get the size of the file
22
+ file_size = os.path.getsize(file_path)
23
+ bytes_sent = 0
24
+
25
+ # Open the file in binary mode
26
+ with open(file_path, "rb") as file:
27
+ # Read the file in chunks
28
+ while True:
29
+ # Read 4KB of data
30
+ data = file.read(4096)
31
+ if not data:
32
+ break # End of file
33
+
34
+ # Send the chunk over the WebSocket
35
+ await websocket.send(data)
36
+
37
+ # Update bytes sent
38
+ bytes_sent += len(data)
39
+
40
+ # Calculate progress
41
+ progress = (bytes_sent / file_size) * 100
42
+
43
+ if progress_func is not None:
44
+ progress_func(progress)
45
+
46
+
47
+ async def connect_and_send(file_path: str, url: str = 'ws://localhost:8000/ws'):
48
+ """
49
+ Connect and send data to web-socket
50
+ """
51
+ async with websockets.connect(url) as websocket:
52
+ await send_large_file(file_path, websocket)
53
+
54
+
55
+ if __name__ == '__main__':
56
+ asyncio.get_event_loop().run_until_complete(connect_and_send(file_path="my_file.dat", url="ws://localhost:8000"))
File without changes
@@ -0,0 +1,9 @@
1
+ # This Source Code Form is subject to the terms of the Mozilla Public
2
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ # file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
+ # SPDX-License-Identifier: MPL-2.0
5
+
6
+ from fastapi import APIRouter
7
+
8
+ router = APIRouter()
9
+
@@ -0,0 +1,221 @@
1
+ # This Source Code Form is subject to the terms of the Mozilla Public
2
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ # file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
+ # SPDX-License-Identifier: MPL-2.0
5
+ import os
6
+ import json
7
+ from typing import Dict
8
+ from fastapi import APIRouter, HTTPException, BackgroundTasks, Response
9
+ from starlette.responses import StreamingResponse
10
+
11
+ from VeraGridEngine.IO.veragrid.remote import RemoteInstruction, RemoteJob, run_job
12
+ from VeraGridEngine.IO.veragrid.pack_unpack import parse_veragrid_data
13
+ from VeraGridEngine.Devices.multi_circuit import MultiCircuit
14
+ from VeraGridEngine.enumerations import SimulationTypes, JobStatus
15
+
16
+ router = APIRouter()
17
+
18
+ JOBS_LIST: Dict[str, RemoteJob] = dict()
19
+
20
+
21
+ def get_fs_folder() -> str:
22
+ """
23
+ Get the folder where to save files
24
+ :return:
25
+ """
26
+ return "."
27
+
28
+
29
+ def generate_job_file_path(job_id: str):
30
+ """
31
+
32
+ :param job_id:
33
+ :return:
34
+ """
35
+ return os.path.join(get_fs_folder(), f"{job_id}.zip")
36
+
37
+
38
+ async def process_json_data(json_data: Dict[str, Dict[str, Dict[str, str]]]):
39
+ """
40
+ Action called on the upload
41
+ :param json_data: the grid info generated with 'gather_model_as_jsons_for_communication'
42
+ """
43
+ grid = parse_veragrid_data(data=json_data)
44
+ print(f'Circuit loaded alright nbus{grid.get_bus_number()}, '
45
+ f'nbr{grid.get_branch_number(add_vsc=False, add_hvdc=False, add_switch=True)}')
46
+
47
+ if 'instruction' in json_data:
48
+ instruction = RemoteInstruction(data=json_data['instruction'])
49
+
50
+ job = RemoteJob(grid=grid, instruction=instruction)
51
+
52
+ # register the job
53
+ JOBS_LIST[job.id_tag] = job
54
+
55
+ # print("Job data\n", job.get_data())
56
+ if job.instruction.operation != SimulationTypes.NoSim:
57
+ driver = run_job(grid=grid, job=job)
58
+
59
+ if driver is not None:
60
+ print("Driver:", driver.name)
61
+ if driver.results is not None:
62
+ return driver.results.get_dict()
63
+ else:
64
+ return dict()
65
+ else:
66
+ return dict()
67
+
68
+ else:
69
+ print("No simulation")
70
+ return dict()
71
+
72
+ else:
73
+ print('No Instruction found\n\n', json_data)
74
+ return dict()
75
+
76
+
77
+ async def stream_load_json(json_data):
78
+ """
79
+ Async function to stream a json file
80
+ :param json_data:
81
+ :return:
82
+ """
83
+
84
+ async def generate():
85
+ """
86
+ generate
87
+ """
88
+ yield json.dumps(json_data).encode()
89
+
90
+ return StreamingResponse(generate())
91
+
92
+
93
+ @router.post("/upload_job/")
94
+ async def upload_job(json_data: dict, background_tasks: BackgroundTasks):
95
+ """
96
+ Endpoint to upload a job into here
97
+ :param json_data:
98
+ :param background_tasks:
99
+ :return:
100
+ """
101
+ background_tasks.add_task(stream_load_json, json_data)
102
+
103
+ grid: MultiCircuit = parse_veragrid_data(data=json_data)
104
+
105
+ print(f'Circuit loaded alright nbus{grid.get_bus_number()}, '
106
+ f'nbr{grid.get_branch_number(add_vsc=False, add_hvdc=False, add_switch=True)}')
107
+
108
+ if 'instruction' in json_data:
109
+ instruction = RemoteInstruction(data=json_data['instruction'])
110
+
111
+ job = RemoteJob(grid=grid, instruction=instruction)
112
+
113
+ # register the job
114
+ JOBS_LIST[job.id_tag] = job
115
+ job.status = JobStatus.Running
116
+
117
+ # print("Job data\n", job.get_data())
118
+ if job.instruction.operation != SimulationTypes.NoSim:
119
+
120
+ try:
121
+ driver = run_job(grid=grid, job=job)
122
+ except Exception as e:
123
+ print("Job running error:\n", e)
124
+ return {"success": False, "results": None, "msg": f"Job running error"}
125
+
126
+ job.status = JobStatus.Done
127
+ JOBS_LIST.pop(job.id_tag)
128
+
129
+ if driver is not None:
130
+ print("Driver:", driver.name)
131
+ if driver.results is not None:
132
+ return {"success": True, "results": driver.results.get_dict(), "msg": "all good"}
133
+ else:
134
+ return {"success": False, "results": None, "msg": "No results in the driver"}
135
+ else:
136
+ return {"success": False, "results": None, "msg": "The driver is None"}
137
+
138
+ else:
139
+ return {"success": False, "results": None, "msg": "No simulation"}
140
+
141
+ else:
142
+ return {"success": False, "results": None, "msg": "No Instruction found"}
143
+
144
+
145
+ @router.get("/jobs_list")
146
+ async def jobs_list():
147
+ """
148
+ Endpoint to return the list of jobs
149
+ :return: string
150
+ """
151
+ return [job.get_data() for id_tag, job in JOBS_LIST.items()]
152
+
153
+
154
+ @router.delete("/jobs/{job_id}")
155
+ async def delete_job(job_id: str):
156
+ """
157
+ Delete a specific job by ID
158
+ :param job_id: The ID of the job to delete_with_dialogue
159
+ :return: A message indicating the result
160
+ """
161
+ if job_id in JOBS_LIST:
162
+ del JOBS_LIST[job_id]
163
+ return {"message": f"Job {job_id} deleted successfully"}
164
+ else:
165
+ raise HTTPException(status_code=404, detail="Job not found")
166
+
167
+
168
+ @router.post("/jobs/{job_id}/cancel")
169
+ async def cancel_job(job_id: str):
170
+ """
171
+ Cancel a specific job by ID
172
+ :param job_id: The ID of the job to cancel
173
+ :return: A message indicating the result
174
+ """
175
+ job = JOBS_LIST.get(job_id)
176
+ if not job:
177
+ raise HTTPException(status_code=404, detail="Job not found")
178
+
179
+ job.cancel()
180
+ return {"message": f"Job {job_id} canceled successfully"}
181
+
182
+
183
+ @router.get("/download_results/{job_id}")
184
+ async def download_large_file(job_id: str):
185
+ """
186
+ Function to download a large file, ie the results of a simulation
187
+ """
188
+
189
+ job = JOBS_LIST.get(job_id, None)
190
+
191
+ if job is None:
192
+ return Response(status_code=404, content="Job not found")
193
+
194
+ if job.status != JobStatus.Done:
195
+ return Response(status_code=405, content="Job not finished yet :/")
196
+
197
+ # Path to your large binary file
198
+ file_path = generate_job_file_path(job_id=job_id)
199
+
200
+ # Check if the file exists
201
+ if not os.path.exists(file_path):
202
+ return Response(status_code=406, content=f"File not found {file_path}")
203
+
204
+ # Function to stream the file
205
+ def iter_file(chunk_size=1024 * 1024):
206
+ """
207
+
208
+ :param chunk_size:
209
+ :return:
210
+ """
211
+ with open(file_path, "rb") as file:
212
+ sent = 0
213
+ while chunk := file.read(chunk_size): # Read in chunks of 1MB
214
+ sent += chunk_size
215
+ job.progress = f"{sent} MB"
216
+ yield chunk
217
+
218
+ print("Sending", job_id)
219
+
220
+ # Return a streaming response
221
+ return StreamingResponse(iter_file(), media_type="application/octet-stream")
@@ -0,0 +1,68 @@
1
+ # This Source Code Form is subject to the terms of the Mozilla Public
2
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ # file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
+ # SPDX-License-Identifier: MPL-2.0
5
+
6
+ import socket
7
+ import requests
8
+ from fastapi import APIRouter
9
+
10
+ from VeraGridServer.settings import settings
11
+
12
+
13
+ def get_local_ip():
14
+ try:
15
+ return socket.gethostbyname(socket.gethostname()) # Gets internal IP
16
+ except Exception:
17
+ return "127.0.0.1" # Fallback to localhost
18
+
19
+
20
+ def register_with_master(host: str, port: int, this_port: int, username: str, password: str):
21
+ """
22
+ register this service with a master service
23
+ :param host:
24
+ :param port:
25
+ :param this_port:
26
+ :param username:
27
+ :param password:
28
+ :return:
29
+ """
30
+
31
+ url = f"{host}:{port}/register_child_server"
32
+
33
+ worker_data = {
34
+ "ip": get_local_ip(), # Detect IP dynamically
35
+ "port": this_port, # Set worker's port
36
+ "username": username,
37
+ "password": password,
38
+ }
39
+
40
+ response = requests.post(url,
41
+ json=worker_data,
42
+ verify=False,
43
+ timeout=5)
44
+ response.raise_for_status()
45
+ return response.json() # Return JSON response
46
+
47
+
48
+ def lifespan(app: APIRouter):
49
+ """
50
+ Function that is called once the app starts.
51
+ :param app:
52
+ :return:
53
+ """
54
+ if not settings.am_i_master:
55
+ print("I am a child service")
56
+ res = register_with_master(host=settings.master_host,
57
+ port=settings.master_port,
58
+ this_port=settings.this_port,
59
+ username=settings.this_username,
60
+ password=settings.this_password)
61
+ print("registering response:", res)
62
+ else:
63
+ print("I am the master service")
64
+
65
+ yield # The application runs here
66
+
67
+
68
+ router = APIRouter(lifespan=lifespan)
@@ -0,0 +1,48 @@
1
+ # This Source Code Form is subject to the terms of the Mozilla Public
2
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ # file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
+ # SPDX-License-Identifier: MPL-2.0
5
+
6
+ from fastapi import APIRouter, HTTPException
7
+
8
+ # Dictionary to store registered services
9
+ registered_services = dict()
10
+
11
+ router = APIRouter()
12
+
13
+
14
+ @router.post("/register_child_server")
15
+ async def register_child_server(data: dict):
16
+ try:
17
+ # data = await request.json() # Parse JSON manually
18
+ ip = data.get("ip", None)
19
+ port = data.get("port", None)
20
+ username = data.get("username", None)
21
+ password = data.get("password", None)
22
+
23
+ key = f"{username}:{ip}:{port}"
24
+
25
+ if ip is None or port is None:
26
+ raise HTTPException(status_code=400, detail="Missing 'ip' or 'port'")
27
+
28
+ if key in registered_services:
29
+ raise HTTPException(status_code=400, detail="Service already registered")
30
+
31
+ # Store the service information
32
+ registered_services[key] = {"ip": ip, "port": port}
33
+
34
+ return {"message": "Service registered successfully", "service": username, "ip": ip, "port": port}
35
+
36
+ except Exception as e:
37
+ raise HTTPException(status_code=400, detail=f"Invalid request: {str(e)}")
38
+
39
+
40
+ @router.get("/registered_child_servers")
41
+ def get_registered_child_servers():
42
+ """
43
+ Return all registered services
44
+ :return:
45
+ """
46
+ if not registered_services:
47
+ raise HTTPException(status_code=404, detail="No services registered")
48
+ return registered_services
@@ -0,0 +1,97 @@
1
+ # This Source Code Form is subject to the terms of the Mozilla Public
2
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ # file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
+ # SPDX-License-Identifier: MPL-2.0
5
+ from cryptography import x509
6
+ from cryptography.x509.oid import NameOID
7
+ from cryptography.hazmat.backends import default_backend
8
+ from cryptography.hazmat.primitives import hashes, serialization
9
+ from cryptography.hazmat.primitives.asymmetric import rsa
10
+ import datetime
11
+ import socket
12
+ import ipaddress
13
+
14
+
15
+ def get_my_ip():
16
+ """Returns the IP address of the machine running the FastAPI server."""
17
+ try:
18
+ # Connect to an external server (Google's DNS) to determine our outward-facing IP
19
+ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
20
+ s.connect(("8.8.8.8", 80))
21
+ ip = s.getsockname()[0]
22
+ s.close()
23
+ except Exception:
24
+ ip = "127.0.0.1" # Fallback to localhost if detection fails
25
+ return ip
26
+
27
+
28
+ def generate_ssl_certificate(ip: str | None = None, domain: str | None = None,
29
+ key_file_name="key.pem", cert_file_name="cert.pem"):
30
+ """
31
+ Generates a new SSL certificate and saves it to a file
32
+ :param ip: IP address of the server (optional)
33
+ :param domain: Domain name of the server (optional)
34
+ :param key_file_name: name of the key file
35
+ :param cert_file_name: name of the certificate file
36
+ """
37
+
38
+ subjects_list = [x509.DNSName(u"localhost")]
39
+
40
+ if ip is not None:
41
+ subjects_list.append(x509.IPAddress(ipaddress.ip_address(ip)))
42
+
43
+ if domain is not None:
44
+ subjects_list.append(x509.DNSName(domain))
45
+
46
+ # Generate a private key
47
+ private_key = rsa.generate_private_key(
48
+ public_exponent=65537,
49
+ key_size=2048,
50
+ backend=default_backend()
51
+ )
52
+
53
+ # Write the private key to a file
54
+ with open(key_file_name, "wb") as key_file:
55
+ key_file.write(private_key.private_bytes(
56
+ encoding=serialization.Encoding.PEM,
57
+ format=serialization.PrivateFormat.TraditionalOpenSSL,
58
+ encryption_algorithm=serialization.NoEncryption()
59
+ ))
60
+
61
+ # Define certificate subject and issuer details
62
+ subject = issuer = x509.Name([
63
+ x509.NameAttribute(NameOID.COUNTRY_NAME, u"ES"),
64
+ x509.NameAttribute(NameOID.STATE_OR_PROVINCE_NAME, u"Barcelona"),
65
+ x509.NameAttribute(NameOID.LOCALITY_NAME, u"Barcelona"),
66
+ x509.NameAttribute(NameOID.ORGANIZATION_NAME, u"eRoots Analytics"),
67
+ x509.NameAttribute(NameOID.COMMON_NAME, ip),
68
+ ])
69
+
70
+ # Build the certificate
71
+ cert = x509.CertificateBuilder().subject_name(
72
+ subject
73
+ ).issuer_name(
74
+ issuer
75
+ ).public_key(
76
+ private_key.public_key()
77
+ ).serial_number(
78
+ x509.random_serial_number()
79
+ ).not_valid_before(
80
+ datetime.datetime.now(datetime.UTC)
81
+ ).not_valid_after(
82
+ # Certificate is valid for 365 days
83
+ datetime.datetime.now(datetime.UTC) + datetime.timedelta(days=365)
84
+ ).add_extension(
85
+ x509.SubjectAlternativeName(subjects_list),
86
+ critical=False,
87
+ ).sign(private_key, hashes.SHA256(), default_backend())
88
+
89
+ # Write the certificate to a file
90
+ with open(cert_file_name, "wb") as cert_file:
91
+ cert_file.write(cert.public_bytes(serialization.Encoding.PEM))
92
+
93
+ print(f"SSL certificate and key have been generated: cert={cert_file_name}, key={key_file_name}")
94
+
95
+
96
+ if __name__ == "__main__":
97
+ generate_ssl_certificate(ip="127.0.0.1", key_file_name="key.pem")
@@ -0,0 +1,77 @@
1
+ # This Source Code Form is subject to the terms of the Mozilla Public
2
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ # file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
+ # SPDX-License-Identifier: MPL-2.0
5
+ import os
6
+ from hashlib import sha256
7
+ from fastapi import FastAPI, Header, HTTPException, Response, Query
8
+ from fastapi.responses import FileResponse
9
+
10
+ from VeraGridServer.endpoints import register_in_master
11
+ from VeraGridServer.endpoints import register_sub_servers
12
+ from VeraGridServer.endpoints import calculations
13
+ from VeraGridServer.endpoints import jobs
14
+ from cryptography import x509
15
+ from cryptography.x509.oid import NameOID
16
+ from cryptography.hazmat.primitives import hashes
17
+ from cryptography.hazmat.primitives.asymmetric import rsa
18
+ from cryptography.hazmat.primitives.serialization import Encoding, PrivateFormat, NoEncryption
19
+ from datetime import datetime, timedelta
20
+ import ipaddress
21
+
22
+ app = FastAPI()
23
+ app.include_router(register_in_master.router)
24
+ app.include_router(register_sub_servers.router)
25
+ app.include_router(calculations.router)
26
+ app.include_router(jobs.router)
27
+
28
+ # Store WebSocket connections in a set
29
+ __connections__ = set()
30
+
31
+ # GC_FOLDER = get_create_gridcal_folder()
32
+ # GC_SERVER_FILE = os.path.join(GC_FOLDER, "server_config.json")
33
+ SECRET_KEY = ""
34
+
35
+
36
+ def verify_api_key(api_key: str = Header(None)):
37
+ """
38
+ Define a function to verify the API key
39
+ :param api_key:
40
+ """
41
+ if api_key is None:
42
+ raise HTTPException(status_code=401, detail="API Key is missing")
43
+
44
+ # Hash the provided API key using the same algorithm and compare with the stored hash
45
+ hashed_api_key = sha256(api_key.encode()).hexdigest()
46
+ if hashed_api_key != SECRET_KEY:
47
+ raise HTTPException(status_code=403, detail="Invalid API Key")
48
+
49
+
50
+
51
+ @app.get("/get_cert")
52
+ def get_cert():
53
+ """
54
+ Get the certificate from the server
55
+ :return:
56
+ """
57
+ # Serve the certificate file
58
+ return FileResponse("cert.pem",
59
+ media_type="application/x-pem-file",
60
+ filename="cert.pem")
61
+
62
+ @app.get("/")
63
+ async def read_root():
64
+ """
65
+ Root
66
+ :return: string
67
+ """
68
+ return {"message": "VeraGrid server running", "status": "ok"}
69
+
70
+
71
+ @app.get('/favicon.ico', include_in_schema=False)
72
+ async def favicon():
73
+ """
74
+
75
+ :return:
76
+ """
77
+ return FileResponse(os.path.join(os.path.dirname(__file__), "data", "VeraGrid_icon.ico"))
@@ -0,0 +1,122 @@
1
+ # This Source Code Form is subject to the terms of the Mozilla Public
2
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ # file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
+ # SPDX-License-Identifier: MPL-2.0
5
+ import os
6
+ import sys
7
+ import uvicorn
8
+ import argparse
9
+
10
+ PACKAGE_PARENT = '..'
11
+ SCRIPT_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
12
+ sys.path.append(os.path.normpath(os.path.join(SCRIPT_DIR, PACKAGE_PARENT)))
13
+
14
+ from VeraGridServer.main import app
15
+ from VeraGridServer.settings import settings
16
+ from VeraGridServer.generate_ssl_key import generate_ssl_certificate, get_my_ip
17
+ from VeraGridServer.__version__ import __VeraGridServer_VERSION__
18
+
19
+
20
+ def start_server(key_file_name: str = "key.pem", cert_file_name: str = "cert.pem",
21
+ port: int = 8000, domain="localhost",
22
+ master_host: str = "", master_port: int = 0,
23
+ username: str = "", password: str = "", is_master: bool = True,
24
+ secure: bool = True):
25
+ """
26
+ Start server function
27
+ :param key_file_name: name of the key file that the server generates
28
+ :param cert_file_name: name of the certificate file that the server generates
29
+ :param port: Port to serve (8000 usually)
30
+ :param domain: Domain to serve (i.e. localhost)
31
+ :param master_host: IP address to register the server to (if this runs in child mode)
32
+ :param master_port: Port to register the server to (if this runs in child mode)
33
+ :param username: Username to authenticate with
34
+ :param password: Password to authenticate with
35
+ :param is_master: Whether the server is master or not
36
+ :param secure: Whether the server is secure or not (if it looks for the certificates or not)
37
+ """
38
+
39
+ # find out my IP
40
+ host = get_my_ip()
41
+
42
+ print(f"""
43
+ ┏┓ • ┓┏┓ ┓┏┓ ({__VeraGridServer_VERSION__} Alpha)
44
+ ┃┓┏┓┓┏┫┃ ┏┓┃┗┓┏┓┏┓┓┏┏┓┏┓
45
+ ┗┛┛ ┗┗┻┗┛┗┻┗┗┛┗ ┛ ┗┛┗ ┛
46
+ {host}:{port}
47
+ """)
48
+
49
+ if secure:
50
+ generate_ssl_certificate(
51
+ ip=host,
52
+ domain=domain,
53
+ key_file_name=key_file_name,
54
+ cert_file_name=cert_file_name
55
+ )
56
+
57
+ # extra attributed on launch
58
+ settings.am_i_master = is_master
59
+ settings.master_host = master_host
60
+ settings.master_port = master_port
61
+ settings.this_host = host
62
+ settings.this_port = port
63
+ settings.this_username = username
64
+ settings.this_password = password
65
+
66
+ if secure:
67
+ uvicorn.run(app,
68
+ host=host, port=port, ssl_keyfile=key_file_name, ssl_certfile=cert_file_name)
69
+ else:
70
+ uvicorn.run(app,
71
+ host=host, port=port)
72
+
73
+ def str2bool(value):
74
+ if isinstance(value, bool):
75
+ return value
76
+ if value.lower() in {'True', 'true', 't', 'yes', '1'}:
77
+ return True
78
+ elif value.lower() in {'False', 'false', 'f', 'no', '0'}:
79
+ return False
80
+ else:
81
+ raise argparse.ArgumentTypeError(f'Invalid boolean value: {value}')
82
+
83
+ if __name__ == "__main__":
84
+ # Initialize parser
85
+ parser = argparse.ArgumentParser(description="Start a secure VeraGrid server")
86
+
87
+ # Add arguments
88
+ parser.add_argument("--key_fname", type=str, default="key.pem",
89
+ help="Path to the private key file that the server generates")
90
+ parser.add_argument("--cert_fname", type=str, default="cert.pem",
91
+ help="Path to the certificate file that the server generates")
92
+ parser.add_argument("--host", type=str, default="0.0.0.0", help="Host IP address")
93
+ parser.add_argument("--port", type=int, default=8000, help="Port to run the server on")
94
+
95
+ parser.add_argument("--secure", type=str2bool,
96
+ choices=[True, False], default=True, help="Use https?")
97
+
98
+ parser.add_argument("--master", type=str2bool,
99
+ choices=[True, False], default=True, help="Use https?")
100
+
101
+ parser.add_argument("--master_host", type=str, default="0.0.0.0", help="URL of the master instance")
102
+ parser.add_argument("--master_port", type=int, default=80, help="Port of the master instance")
103
+ parser.add_argument("--user", type=str, default="", help="username")
104
+ parser.add_argument("--pwd", type=str, default="", help="Password")
105
+
106
+ # Parse arguments
107
+ args = parser.parse_args()
108
+
109
+ print("Arguments:")
110
+ print('\n'.join(f'{k}: {v}' for k, v in vars(args).items()))
111
+
112
+ # Call the start_server function with the parsed arguments
113
+ start_server(key_file_name=args.key_fname,
114
+ cert_file_name=args.cert_fname,
115
+ port=args.port,
116
+ domain=args.host,
117
+ master_host=args.master_host,
118
+ master_port=args.master_port,
119
+ secure=args.secure,
120
+ is_master=args.master,
121
+ username=args.user,
122
+ password=args.pwd)
@@ -0,0 +1,16 @@
1
+ # This Source Code Form is subject to the terms of the Mozilla Public
2
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ # file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
+ # SPDX-License-Identifier: MPL-2.0
5
+
6
+ class ExtraSettings:
7
+ def __init__(self):
8
+ self.am_i_master: bool = True
9
+ self.master_host: str = ""
10
+ self.master_port = 0
11
+ self.this_port = 0
12
+ self.this_username = ""
13
+ self.this_password = ""
14
+
15
+
16
+ settings = ExtraSettings()
@@ -0,0 +1,3 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
@@ -0,0 +1,105 @@
1
+ # This Source Code Form is subject to the terms of the Mozilla Public
2
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ # file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
+ # SPDX-License-Identifier: MPL-2.0
5
+ """
6
+ A setuptools based setup module.
7
+ See:
8
+ https://packaging.python.org/guides/distributing-packages-using-setuptools/
9
+ https://github.com/pypa/sampleproject
10
+ """
11
+
12
+ # Always prefer setuptools over distutils
13
+ from setuptools import setup, find_packages
14
+ import os
15
+
16
+ from VeraGridServer.__version__ import __VeraGridServer_VERSION__
17
+
18
+ here = os.path.abspath(os.path.dirname(__file__))
19
+
20
+ long_description = """# VeraGrid
21
+
22
+ This software aims to be a complete platform for power systems research and simulation.
23
+
24
+ [Watch the video https](https://youtu.be/SY66WgLGo54)
25
+
26
+ [Check out the documentation](https://gridcal.readthedocs.io)
27
+
28
+
29
+ ## Installation
30
+
31
+ pip install VeraGridServer
32
+
33
+ For more options (including a standalone setup one), follow the
34
+ [installation instructions]( https://gridcal.readthedocs.io/en/latest/getting_started/install.html)
35
+ from the project's [documentation](https://gridcal.readthedocs.io)
36
+ """
37
+
38
+ description = 'VeraGrid is a Power Systems simulation program intended for professional use and research'
39
+
40
+ base_path = os.path.join('VeraGridServer')
41
+
42
+ pkgs_to_exclude = ['docs', 'research', 'tests', 'tutorials', 'VeraGridEngine']
43
+
44
+ packages = find_packages(exclude=pkgs_to_exclude)
45
+
46
+ # ... so we have to do the filtering ourselves
47
+ packages2 = list()
48
+ for package in packages:
49
+ elms = package.split('.')
50
+ excluded = False
51
+ for exclude in pkgs_to_exclude:
52
+ if exclude in elms:
53
+ excluded = True
54
+
55
+ if not excluded:
56
+ packages2.append(package)
57
+
58
+ package_data = {'VeraGridServer': ['*.md',
59
+ '*.rst',
60
+ 'LICENSE.txt',
61
+ 'setup.py',
62
+ 'data/VeraGrid_icon.ico'],
63
+ }
64
+
65
+ dependencies = ['setuptools>=41.0.1',
66
+ 'wheel>=0.37.2',
67
+ "fastapi",
68
+ "uvicorn",
69
+ "websockets",
70
+ "cryptography",
71
+ "VeraGridEngine==" + __VeraGridServer_VERSION__, # the VeraGridEngine version must be exactly the same
72
+ ]
73
+
74
+ extras_require = {
75
+ 'gch5 files': ["tables"] # this is for h5 compatibility
76
+ }
77
+ # Arguments marked as "Required" below must be included for upload to PyPI.
78
+ # Fields marked as "Optional" may be commented out.
79
+
80
+ setup(
81
+ name='VeraGridServer', # Required
82
+ version=__VeraGridServer_VERSION__, # Required
83
+ license='MPL2',
84
+ description=description, # Optional
85
+ long_description=long_description, # Optional
86
+ long_description_content_type='text/markdown', # Optional (see note above)
87
+ url='https://github.com/SanPen/VeraGrid', # Optional
88
+ author='Santiago Peñate Vera et. Al.', # Optional
89
+ author_email='spenate@eroots.tech', # Optional
90
+ classifiers=[
91
+ 'Programming Language :: Python :: 3.8',
92
+ ],
93
+ keywords='power systems planning', # Optional
94
+ packages=packages2, # Required
95
+ include_package_data=True,
96
+ python_requires='>=3.8',
97
+ install_requires=dependencies,
98
+ extras_require=extras_require,
99
+ package_data=package_data,
100
+ entry_points={
101
+ 'console_scripts': [
102
+ 'gridcalserver = VeraGridServer.run:start_server',
103
+ ],
104
+ },
105
+ )