cave-utils 3.2.0__tar.gz → 3.3.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.
- cave_utils-3.3.0/PKG-INFO +121 -0
- cave_utils-3.3.0/README.md +104 -0
- cave_utils-3.3.0/cave_utils/__init__.py +110 -0
- {cave_utils-3.2.0 → cave_utils-3.3.0}/cave_utils/api/__init__.py +5 -3
- {cave_utils-3.2.0 → cave_utils-3.3.0}/cave_utils/api/appBar.py +4 -4
- {cave_utils-3.2.0 → cave_utils-3.3.0}/cave_utils/api/globalOutputs.py +1 -1
- {cave_utils-3.2.0 → cave_utils-3.3.0}/cave_utils/api/groupedOutputs.py +11 -11
- {cave_utils-3.2.0 → cave_utils-3.3.0}/cave_utils/api/mapFeatures.py +11 -11
- {cave_utils-3.2.0 → cave_utils-3.3.0}/cave_utils/api/maps.py +47 -32
- {cave_utils-3.2.0 → cave_utils-3.3.0}/cave_utils/api/pages.py +42 -26
- {cave_utils-3.2.0 → cave_utils-3.3.0}/cave_utils/api/panes.py +8 -5
- {cave_utils-3.2.0 → cave_utils-3.3.0}/cave_utils/api/settings.py +17 -17
- {cave_utils-3.2.0 → cave_utils-3.3.0}/cave_utils/api_utils/general.py +226 -68
- {cave_utils-3.2.0 → cave_utils-3.3.0}/cave_utils/api_utils/validator_utils.py +3 -3
- {cave_utils-3.2.0 → cave_utils-3.3.0}/cave_utils/builders/groups.py +9 -9
- {cave_utils-3.2.0 → cave_utils-3.3.0}/cave_utils/geo_utils.py +14 -14
- {cave_utils-3.2.0 → cave_utils-3.3.0}/cave_utils/log.py +2 -2
- cave_utils-3.3.0/cave_utils.egg-info/PKG-INFO +121 -0
- {cave_utils-3.2.0 → cave_utils-3.3.0}/cave_utils.egg-info/SOURCES.txt +1 -1
- cave_utils-3.3.0/cave_utils.egg-info/requires.txt +2 -0
- {cave_utils-3.2.0 → cave_utils-3.3.0}/pyproject.toml +3 -3
- {cave_utils-3.2.0 → cave_utils-3.3.0}/setup.cfg +1 -1
- cave_utils-3.3.0/test/test_arguments.py +47 -0
- {cave_utils-3.2.0 → cave_utils-3.3.0}/test/test_builders_groups.py +1 -1
- cave_utils-3.3.0/test/test_geo_utils.py +21 -0
- cave_utils-3.3.0/test/test_log.py +31 -0
- cave_utils-3.3.0/test/test_socket.py +11 -0
- cave_utils-3.3.0/test/test_validator.py +59 -0
- cave_utils-3.2.0/PKG-INFO +0 -120
- cave_utils-3.2.0/README.md +0 -104
- cave_utils-3.2.0/cave_utils/__init__.py +0 -13
- cave_utils-3.2.0/cave_utils.egg-info/PKG-INFO +0 -120
- cave_utils-3.2.0/cave_utils.egg-info/requires.txt +0 -2
- cave_utils-3.2.0/test/test_arguments.py +0 -19
- cave_utils-3.2.0/test/test_geo_utils.py +0 -17
- cave_utils-3.2.0/test/test_import.py +0 -3
- cave_utils-3.2.0/test/test_log.py +0 -8
- cave_utils-3.2.0/test/test_validator.py +0 -2060
- {cave_utils-3.2.0 → cave_utils-3.3.0}/LICENSE +0 -0
- {cave_utils-3.2.0 → cave_utils-3.3.0}/NOTICE.md +0 -0
- {cave_utils-3.2.0 → cave_utils-3.3.0}/cave_utils/api/extraKwargs.py +0 -0
- {cave_utils-3.2.0 → cave_utils-3.3.0}/cave_utils/api_utils/__init__.py +0 -0
- {cave_utils-3.2.0 → cave_utils-3.3.0}/cave_utils/api_utils/validator.py +0 -0
- {cave_utils-3.2.0 → cave_utils-3.3.0}/cave_utils/arguments.py +0 -0
- {cave_utils-3.2.0 → cave_utils-3.3.0}/cave_utils/builders/__init__.py +0 -0
- {cave_utils-3.2.0 → cave_utils-3.3.0}/cave_utils/socket.py +0 -0
- {cave_utils-3.2.0 → cave_utils-3.3.0}/cave_utils.egg-info/dependency_links.txt +0 -0
- {cave_utils-3.2.0 → cave_utils-3.3.0}/cave_utils.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cave_utils
|
|
3
|
+
Version: 3.3.0
|
|
4
|
+
Summary: Python wrapper for api use in the cave_app
|
|
5
|
+
Author-email: Connor Makowski <conmak@mit.edu>
|
|
6
|
+
Project-URL: Homepage, https://github.com/mit-cave/cave_utils
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/mit-cave/cave_utils/issues
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.11
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
License-File: NOTICE.md
|
|
14
|
+
Requires-Dist: pamda<3.0.0,>=2.7.0
|
|
15
|
+
Requires-Dist: type_enforced<3.0.0,>=2.2.0
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
|
|
18
|
+
# Cave Utilities for the Cave App
|
|
19
|
+
[](https://badge.fury.io/py/cave_utils)
|
|
20
|
+
[](https://opensource.org/licenses/MIT)
|
|
21
|
+
Basic utilities for the MIT Cave App.
|
|
22
|
+
This package is intended to be used by the Cave App and the Cave API.
|
|
23
|
+
|
|
24
|
+
## Overview
|
|
25
|
+
|
|
26
|
+
This package is part of the larger [Cave App](https://github.com/MIT-CAVE/cave_app) framework. It provides utilities that are commonly used across different Cave applications, such as validation and logging. It is designed to be an easy to integrate library that can be used in any Cave application. It also serves to provide automated documentation and testing.
|
|
27
|
+
|
|
28
|
+
You can find the low level documentation for this package [here](https://mit-cave.github.io/cave_utils/index.html).
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## Setup
|
|
33
|
+
|
|
34
|
+
Make sure you have Python 3.11.x (or higher) installed on your system. You can download it [here](https://www.python.org/downloads/).
|
|
35
|
+
|
|
36
|
+
### Installation
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
pip install cave_utils
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
# cave_utils development
|
|
43
|
+
|
|
44
|
+
## Running Tests, Prettifying Code, and Updating Docs
|
|
45
|
+
|
|
46
|
+
Make sure Docker is installed and running.
|
|
47
|
+
|
|
48
|
+
- Create a docker container and drop into a shell
|
|
49
|
+
- `./run.sh`
|
|
50
|
+
- Run all tests (see ./utils/test.sh)
|
|
51
|
+
- `./run.sh test`
|
|
52
|
+
- Prettify the code (see ./utils/prettify.sh)
|
|
53
|
+
- `./run.sh prettify`
|
|
54
|
+
- Update the docs (see ./utils/docs.sh)
|
|
55
|
+
- `./run.sh docs`
|
|
56
|
+
|
|
57
|
+
- Note: You can and should modify the `Dockerfile` to test different python versions.
|
|
58
|
+
|
|
59
|
+
### Using Local Hotloading With a Cave App
|
|
60
|
+
|
|
61
|
+
1. In your `cave_app`, update the following file:
|
|
62
|
+
|
|
63
|
+
`utils/run_server.sh`
|
|
64
|
+
```
|
|
65
|
+
#!/bin/bash
|
|
66
|
+
|
|
67
|
+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
68
|
+
APP_DIR=$(dirname "$SCRIPT_DIR")
|
|
69
|
+
|
|
70
|
+
pip install -e /cave_utils
|
|
71
|
+
|
|
72
|
+
source ./utils/helpers/shell_functions.sh
|
|
73
|
+
source ./utils/helpers/ensure_postgres_running.sh
|
|
74
|
+
# Check if the app is functional before proceeding
|
|
75
|
+
if [ "$(python ./manage.py check --deployment_type development | grep "System check identified no issues" | wc -l)" -eq "0" ]; then
|
|
76
|
+
printf "Unable to start the app due to an error in the code. See the stacktrace above." 2>&1 | pipe_log "ERROR"
|
|
77
|
+
rm -r "./tmp"
|
|
78
|
+
exit 1
|
|
79
|
+
fi
|
|
80
|
+
source ./utils/helpers/ensure_db_setup.sh
|
|
81
|
+
|
|
82
|
+
python "$APP_DIR/manage.py" runserver 0.0.0.0:8000 2>&1 | pipe_log "INFO"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
2. Remove `cave_utils` from the root `requirements.txt` file
|
|
86
|
+
|
|
87
|
+
3. In your `cave_app`, set `LIVE_API_VALIDATION_PRINT=True` in the `.env` file
|
|
88
|
+
- This will validate your data every time an API command is called for each session
|
|
89
|
+
|
|
90
|
+
4. Use the following command to run your `cave_app`:
|
|
91
|
+
`cave run --docker-args "--volume {local_path_to_cave_utils}/cave_utils:/cave_utils"`
|
|
92
|
+
- As you edit `cave_utils`, any changes will be hotloaded into your running `cave_app`
|
|
93
|
+
|
|
94
|
+
### Using interactive mode in your Cave App and running tests
|
|
95
|
+
|
|
96
|
+
- Note: This is for very specific use cases, such as running tests or debugging in an interactive shell.
|
|
97
|
+
- Note: In general, we copy all included examples from the cave_app to the `cave_utils/test/api_examples` directory, so you can run tests against them without needing to run the cave_app.
|
|
98
|
+
- These copied examples can be tested by running `./run.sh test` in the cave_utils directory, which will run all tests in the `cave_utils/test`.
|
|
99
|
+
- This includes `test_validator.py` which runs all examples in the `cave_utils/test/api_examples` directory
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
1. Run cave_app in interactive mode mounting cave_utils as a volume:
|
|
103
|
+
`cave run --docker-args "--volume {local_path_to_cave_utils}/cave_utils:/cave_utils" -it`
|
|
104
|
+
2. Then install cave utils in the docker container:
|
|
105
|
+
`pip install -e /cave_utils`
|
|
106
|
+
3. Then run some tests (eg `validate_all_examples.py`):
|
|
107
|
+
`python cave_api/tests/validate_all_examples.py`
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
# Generate a New Release
|
|
111
|
+
|
|
112
|
+
1. Make sure all tests are passing and the code is prettified.
|
|
113
|
+
2. Make sure the documentation is up to date.
|
|
114
|
+
3. Make sure the version number is updated in `setup.cfg` and `pyproject.toml`.
|
|
115
|
+
4. Set up your virtual environment
|
|
116
|
+
- `python3 -m virtualenv venv`
|
|
117
|
+
- `source venv/bin/activate`
|
|
118
|
+
- `pip install -r requirements.txt`
|
|
119
|
+
5. Update the release
|
|
120
|
+
- `source venv/bin/activate`
|
|
121
|
+
- `./publish.sh`
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Cave Utilities for the Cave App
|
|
2
|
+
[](https://badge.fury.io/py/cave_utils)
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
Basic utilities for the MIT Cave App.
|
|
5
|
+
This package is intended to be used by the Cave App and the Cave API.
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
This package is part of the larger [Cave App](https://github.com/MIT-CAVE/cave_app) framework. It provides utilities that are commonly used across different Cave applications, such as validation and logging. It is designed to be an easy to integrate library that can be used in any Cave application. It also serves to provide automated documentation and testing.
|
|
10
|
+
|
|
11
|
+
You can find the low level documentation for this package [here](https://mit-cave.github.io/cave_utils/index.html).
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## Setup
|
|
16
|
+
|
|
17
|
+
Make sure you have Python 3.11.x (or higher) installed on your system. You can download it [here](https://www.python.org/downloads/).
|
|
18
|
+
|
|
19
|
+
### Installation
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
pip install cave_utils
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
# cave_utils development
|
|
26
|
+
|
|
27
|
+
## Running Tests, Prettifying Code, and Updating Docs
|
|
28
|
+
|
|
29
|
+
Make sure Docker is installed and running.
|
|
30
|
+
|
|
31
|
+
- Create a docker container and drop into a shell
|
|
32
|
+
- `./run.sh`
|
|
33
|
+
- Run all tests (see ./utils/test.sh)
|
|
34
|
+
- `./run.sh test`
|
|
35
|
+
- Prettify the code (see ./utils/prettify.sh)
|
|
36
|
+
- `./run.sh prettify`
|
|
37
|
+
- Update the docs (see ./utils/docs.sh)
|
|
38
|
+
- `./run.sh docs`
|
|
39
|
+
|
|
40
|
+
- Note: You can and should modify the `Dockerfile` to test different python versions.
|
|
41
|
+
|
|
42
|
+
### Using Local Hotloading With a Cave App
|
|
43
|
+
|
|
44
|
+
1. In your `cave_app`, update the following file:
|
|
45
|
+
|
|
46
|
+
`utils/run_server.sh`
|
|
47
|
+
```
|
|
48
|
+
#!/bin/bash
|
|
49
|
+
|
|
50
|
+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
51
|
+
APP_DIR=$(dirname "$SCRIPT_DIR")
|
|
52
|
+
|
|
53
|
+
pip install -e /cave_utils
|
|
54
|
+
|
|
55
|
+
source ./utils/helpers/shell_functions.sh
|
|
56
|
+
source ./utils/helpers/ensure_postgres_running.sh
|
|
57
|
+
# Check if the app is functional before proceeding
|
|
58
|
+
if [ "$(python ./manage.py check --deployment_type development | grep "System check identified no issues" | wc -l)" -eq "0" ]; then
|
|
59
|
+
printf "Unable to start the app due to an error in the code. See the stacktrace above." 2>&1 | pipe_log "ERROR"
|
|
60
|
+
rm -r "./tmp"
|
|
61
|
+
exit 1
|
|
62
|
+
fi
|
|
63
|
+
source ./utils/helpers/ensure_db_setup.sh
|
|
64
|
+
|
|
65
|
+
python "$APP_DIR/manage.py" runserver 0.0.0.0:8000 2>&1 | pipe_log "INFO"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
2. Remove `cave_utils` from the root `requirements.txt` file
|
|
69
|
+
|
|
70
|
+
3. In your `cave_app`, set `LIVE_API_VALIDATION_PRINT=True` in the `.env` file
|
|
71
|
+
- This will validate your data every time an API command is called for each session
|
|
72
|
+
|
|
73
|
+
4. Use the following command to run your `cave_app`:
|
|
74
|
+
`cave run --docker-args "--volume {local_path_to_cave_utils}/cave_utils:/cave_utils"`
|
|
75
|
+
- As you edit `cave_utils`, any changes will be hotloaded into your running `cave_app`
|
|
76
|
+
|
|
77
|
+
### Using interactive mode in your Cave App and running tests
|
|
78
|
+
|
|
79
|
+
- Note: This is for very specific use cases, such as running tests or debugging in an interactive shell.
|
|
80
|
+
- Note: In general, we copy all included examples from the cave_app to the `cave_utils/test/api_examples` directory, so you can run tests against them without needing to run the cave_app.
|
|
81
|
+
- These copied examples can be tested by running `./run.sh test` in the cave_utils directory, which will run all tests in the `cave_utils/test`.
|
|
82
|
+
- This includes `test_validator.py` which runs all examples in the `cave_utils/test/api_examples` directory
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
1. Run cave_app in interactive mode mounting cave_utils as a volume:
|
|
86
|
+
`cave run --docker-args "--volume {local_path_to_cave_utils}/cave_utils:/cave_utils" -it`
|
|
87
|
+
2. Then install cave utils in the docker container:
|
|
88
|
+
`pip install -e /cave_utils`
|
|
89
|
+
3. Then run some tests (eg `validate_all_examples.py`):
|
|
90
|
+
`python cave_api/tests/validate_all_examples.py`
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
# Generate a New Release
|
|
94
|
+
|
|
95
|
+
1. Make sure all tests are passing and the code is prettified.
|
|
96
|
+
2. Make sure the documentation is up to date.
|
|
97
|
+
3. Make sure the version number is updated in `setup.cfg` and `pyproject.toml`.
|
|
98
|
+
4. Set up your virtual environment
|
|
99
|
+
- `python3 -m virtualenv venv`
|
|
100
|
+
- `source venv/bin/activate`
|
|
101
|
+
- `pip install -r requirements.txt`
|
|
102
|
+
5. Update the release
|
|
103
|
+
- `source venv/bin/activate`
|
|
104
|
+
- `./publish.sh`
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"""
|
|
2
|
+
# Cave Utilities for the Cave App
|
|
3
|
+
[](https://badge.fury.io/py/cave_utils)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
Basic utilities for the MIT Cave App.
|
|
6
|
+
This package is intended to be used by the Cave App and the Cave API.
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
This package is part of the larger [Cave App](https://github.com/MIT-CAVE/cave_app) framework. It provides utilities that are commonly used across different Cave applications, such as validation and logging. It is designed to be an easy to integrate library that can be used in any Cave application. It also serves to provide automated documentation and testing.
|
|
11
|
+
|
|
12
|
+
You can find the low level documentation for this package [here](https://mit-cave.github.io/cave_utils/index.html).
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## Setup
|
|
17
|
+
|
|
18
|
+
Make sure you have Python 3.11.x (or higher) installed on your system. You can download it [here](https://www.python.org/downloads/).
|
|
19
|
+
|
|
20
|
+
### Installation
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
pip install cave_utils
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
# cave_utils development
|
|
27
|
+
|
|
28
|
+
## Running Tests, Prettifying Code, and Updating Docs
|
|
29
|
+
|
|
30
|
+
Make sure Docker is installed and running.
|
|
31
|
+
|
|
32
|
+
- Create a docker container and drop into a shell
|
|
33
|
+
- `./run.sh`
|
|
34
|
+
- Run all tests (see ./utils/test.sh)
|
|
35
|
+
- `./run.sh test`
|
|
36
|
+
- Prettify the code (see ./utils/prettify.sh)
|
|
37
|
+
- `./run.sh prettify`
|
|
38
|
+
- Update the docs (see ./utils/docs.sh)
|
|
39
|
+
- `./run.sh docs`
|
|
40
|
+
|
|
41
|
+
- Note: You can and should modify the `Dockerfile` to test different python versions.
|
|
42
|
+
|
|
43
|
+
### Using Local Hotloading With a Cave App
|
|
44
|
+
|
|
45
|
+
1. In your `cave_app`, update the following file:
|
|
46
|
+
|
|
47
|
+
`utils/run_server.sh`
|
|
48
|
+
```
|
|
49
|
+
#!/bin/bash
|
|
50
|
+
|
|
51
|
+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
52
|
+
APP_DIR=$(dirname "$SCRIPT_DIR")
|
|
53
|
+
|
|
54
|
+
pip install -e /cave_utils
|
|
55
|
+
|
|
56
|
+
source ./utils/helpers/shell_functions.sh
|
|
57
|
+
source ./utils/helpers/ensure_postgres_running.sh
|
|
58
|
+
# Check if the app is functional before proceeding
|
|
59
|
+
if [ "$(python ./manage.py check --deployment_type development | grep "System check identified no issues" | wc -l)" -eq "0" ]; then
|
|
60
|
+
printf "Unable to start the app due to an error in the code. See the stacktrace above." 2>&1 | pipe_log "ERROR"
|
|
61
|
+
rm -r "./tmp"
|
|
62
|
+
exit 1
|
|
63
|
+
fi
|
|
64
|
+
source ./utils/helpers/ensure_db_setup.sh
|
|
65
|
+
|
|
66
|
+
python "$APP_DIR/manage.py" runserver 0.0.0.0:8000 2>&1 | pipe_log "INFO"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
2. Remove `cave_utils` from the root `requirements.txt` file
|
|
70
|
+
|
|
71
|
+
3. In your `cave_app`, set `LIVE_API_VALIDATION_PRINT=True` in the `.env` file
|
|
72
|
+
- This will validate your data every time an API command is called for each session
|
|
73
|
+
|
|
74
|
+
4. Use the following command to run your `cave_app`:
|
|
75
|
+
`cave run --docker-args "--volume {local_path_to_cave_utils}/cave_utils:/cave_utils"`
|
|
76
|
+
- As you edit `cave_utils`, any changes will be hotloaded into your running `cave_app`
|
|
77
|
+
|
|
78
|
+
### Using interactive mode in your Cave App and running tests
|
|
79
|
+
|
|
80
|
+
- Note: This is for very specific use cases, such as running tests or debugging in an interactive shell.
|
|
81
|
+
- Note: In general, we copy all included examples from the cave_app to the `cave_utils/test/api_examples` directory, so you can run tests against them without needing to run the cave_app.
|
|
82
|
+
- These copied examples can be tested by running `./run.sh test` in the cave_utils directory, which will run all tests in the `cave_utils/test`.
|
|
83
|
+
- This includes `test_validator.py` which runs all examples in the `cave_utils/test/api_examples` directory
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
1. Run cave_app in interactive mode mounting cave_utils as a volume:
|
|
87
|
+
`cave run --docker-args "--volume {local_path_to_cave_utils}/cave_utils:/cave_utils" -it`
|
|
88
|
+
2. Then install cave utils in the docker container:
|
|
89
|
+
`pip install -e /cave_utils`
|
|
90
|
+
3. Then run some tests (eg `validate_all_examples.py`):
|
|
91
|
+
`python cave_api/tests/validate_all_examples.py`
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
# Generate a New Release
|
|
95
|
+
|
|
96
|
+
1. Make sure all tests are passing and the code is prettified.
|
|
97
|
+
2. Make sure the documentation is up to date.
|
|
98
|
+
3. Make sure the version number is updated in `setup.cfg` and `pyproject.toml`.
|
|
99
|
+
4. Set up your virtual environment
|
|
100
|
+
- `python3 -m virtualenv venv`
|
|
101
|
+
- `source venv/bin/activate`
|
|
102
|
+
- `pip install -r requirements.txt`
|
|
103
|
+
5. Update the release
|
|
104
|
+
- `source venv/bin/activate`
|
|
105
|
+
- `./publish.sh`"""
|
|
106
|
+
from .log import LogObject, LogHelper
|
|
107
|
+
from .socket import Socket
|
|
108
|
+
from .api_utils.validator import Validator
|
|
109
|
+
from .arguments import Arguments
|
|
110
|
+
from .geo_utils import GeoUtils
|
|
@@ -36,7 +36,7 @@ class Root(ApiValidator):
|
|
|
36
36
|
@staticmethod
|
|
37
37
|
def spec(
|
|
38
38
|
settings: dict,
|
|
39
|
-
appBar: dict,
|
|
39
|
+
appBar: dict = dict(),
|
|
40
40
|
panes: dict = dict(),
|
|
41
41
|
pages: dict = dict(),
|
|
42
42
|
maps: dict = dict(),
|
|
@@ -52,8 +52,10 @@ class Root(ApiValidator):
|
|
|
52
52
|
* **`settings`**: `[dict]` → General settings for your application.
|
|
53
53
|
* **Note**: `settings.iconUrl` is the only required field in `settings`
|
|
54
54
|
* **See**: `cave_utils.api.settings`
|
|
55
|
-
* **`appBar`**: `[dict]` → Configure actions for your app bar(s).
|
|
56
|
-
* **
|
|
55
|
+
* **`appBar`**: `[dict]` = `None` → Configure actions for your app bar(s).
|
|
56
|
+
* **Notes**:
|
|
57
|
+
* If left unspecified, there will be no action elements on the app bar.
|
|
58
|
+
* Otherwise, `appBar.data` is required and should have at least one item in it.
|
|
57
59
|
* **See**: `cave_utils.api.appBar`
|
|
58
60
|
* **`panes`**: `[dict]` = `{}` → Configure panes for your application.
|
|
59
61
|
* **See**: `cave_utils.api.panes`
|
|
@@ -51,10 +51,10 @@ class appBar_data_star(ApiValidator):
|
|
|
51
51
|
icon: str,
|
|
52
52
|
type: str,
|
|
53
53
|
bar: str,
|
|
54
|
-
variant:
|
|
55
|
-
color:
|
|
56
|
-
apiCommand:
|
|
57
|
-
apiCommandKeys:
|
|
54
|
+
variant: str | None = None,
|
|
55
|
+
color: str | None = None,
|
|
56
|
+
apiCommand: str | None = None,
|
|
57
|
+
apiCommandKeys: list[str] | None = None,
|
|
58
58
|
**kwargs,
|
|
59
59
|
):
|
|
60
60
|
"""
|
|
@@ -15,7 +15,7 @@ class globalOutputs(ApiValidator):
|
|
|
15
15
|
"""
|
|
16
16
|
|
|
17
17
|
@staticmethod
|
|
18
|
-
def spec(props: dict, values:
|
|
18
|
+
def spec(props: dict, values: dict | None = None, layout: dict | None = None, **kwargs):
|
|
19
19
|
"""
|
|
20
20
|
Arguments:
|
|
21
21
|
|
|
@@ -121,12 +121,12 @@ class groupedOutputs_data_star_stats(ApiValidator):
|
|
|
121
121
|
@staticmethod
|
|
122
122
|
def spec(
|
|
123
123
|
name: str,
|
|
124
|
-
unit:
|
|
125
|
-
unitPlacement:
|
|
126
|
-
precision:
|
|
127
|
-
trailingZeros:
|
|
128
|
-
notation:
|
|
129
|
-
notationDisplay:
|
|
124
|
+
unit: str | None = None,
|
|
125
|
+
unitPlacement: str | None = None,
|
|
126
|
+
precision: int | None = None,
|
|
127
|
+
trailingZeros: bool | None = None,
|
|
128
|
+
notation: str | None = None,
|
|
129
|
+
notationDisplay: str | None = None,
|
|
130
130
|
**kwargs,
|
|
131
131
|
):
|
|
132
132
|
"""
|
|
@@ -150,7 +150,7 @@ class groupedOutputs_data_star_stats(ApiValidator):
|
|
|
150
150
|
* **Notes**:
|
|
151
151
|
* This ensures that all precision digits are shown. For example: `1.5` → `1.500` when precision is `3`.
|
|
152
152
|
* If left unspecified (i.e., `None`), it will default to `settings.defaults.trailingZeros`.
|
|
153
|
-
* **`notation`**: `[
|
|
153
|
+
* **`notation`**: `[str]` = `"standard"` → The formatting style of a numeric value.
|
|
154
154
|
* **`notationDisplay`**: `[str]` = `"e+"` | `"short"` | `None` → Further customize the formatting within the selected `notation`.
|
|
155
155
|
* **Notes**:
|
|
156
156
|
* No `notationDisplay` option is provided for a `"standard"` notation
|
|
@@ -266,7 +266,7 @@ class groupedOutputs_groupings_star(ApiValidator):
|
|
|
266
266
|
data: dict,
|
|
267
267
|
name: str,
|
|
268
268
|
layoutDirection: str = "vertical",
|
|
269
|
-
grouping:
|
|
269
|
+
grouping: str | None = None,
|
|
270
270
|
**kwargs,
|
|
271
271
|
):
|
|
272
272
|
"""
|
|
@@ -374,10 +374,10 @@ class groupedOutputs_groupings_star_levels_star(ApiValidator):
|
|
|
374
374
|
@staticmethod
|
|
375
375
|
def spec(
|
|
376
376
|
name: str,
|
|
377
|
-
parent:
|
|
378
|
-
ordering:
|
|
377
|
+
parent: str | None = None,
|
|
378
|
+
ordering: list | None = None,
|
|
379
379
|
orderWithParent: bool = True,
|
|
380
|
-
coloring:
|
|
380
|
+
coloring: dict | None = None,
|
|
381
381
|
**kwargs,
|
|
382
382
|
):
|
|
383
383
|
"""
|
|
@@ -46,8 +46,8 @@ class mapFeatures_data_star(ApiValidator):
|
|
|
46
46
|
name: str,
|
|
47
47
|
props: dict,
|
|
48
48
|
data: dict,
|
|
49
|
-
layout:
|
|
50
|
-
geoJson:
|
|
49
|
+
layout: dict | None = None,
|
|
50
|
+
geoJson: dict | None = None,
|
|
51
51
|
**kwargs,
|
|
52
52
|
):
|
|
53
53
|
"""
|
|
@@ -165,28 +165,28 @@ class mapFeatures_data_star_data_location(ApiValidator):
|
|
|
165
165
|
|
|
166
166
|
@staticmethod
|
|
167
167
|
def spec(
|
|
168
|
-
latitude:
|
|
169
|
-
longitude:
|
|
170
|
-
altitude:
|
|
171
|
-
path:
|
|
172
|
-
geoJsonValue:
|
|
168
|
+
latitude: list[list[float | int]] | None = None,
|
|
169
|
+
longitude: list[list[float | int]] | None = None,
|
|
170
|
+
altitude: list[list[float | int]] | None = None,
|
|
171
|
+
path: list[list[list[float | int]]] | None = None,
|
|
172
|
+
geoJsonValue: list[str] | None = None,
|
|
173
173
|
**kwargs,
|
|
174
174
|
):
|
|
175
175
|
"""
|
|
176
176
|
Arguments:
|
|
177
177
|
|
|
178
|
-
* **`latitude`**: `list[list[float
|
|
178
|
+
* **`latitude`**: `list[list[float | int]]` = `None` → A list of latitudes for each node.
|
|
179
179
|
* ** Example **: `[45.34, 46.27, 47.34, 48.34]`
|
|
180
180
|
* ** Notes **: Used for `node` layers
|
|
181
|
-
* **`longitude`**: `list[list[float
|
|
181
|
+
* **`longitude`**: `list[list[float | int]]` = `None` → A list of longitudes for each node.
|
|
182
182
|
* ** Example **: `[120.34, 121.27, 122.34, 123.34]`
|
|
183
183
|
* ** Note **: Used for `node` layers
|
|
184
|
-
* **`altitude`**: `list[list[float
|
|
184
|
+
* **`altitude`**: `list[list[float | int]]` = `None` → The altitude for each node / geo in kilometers.
|
|
185
185
|
* ** Example **: `[0, 1000, 2000, 3000]`
|
|
186
186
|
* ** Notes **:
|
|
187
187
|
* Used for `node` and `geo` layers
|
|
188
188
|
* This is currently ignored but is planned to be supported in the future.
|
|
189
|
-
* **`path`**: `list[list[list[float
|
|
189
|
+
* **`path`**: `list[list[list[float | int]]]` = `None` → A path for each arc in the format `[[long1,lat1,(optional alt1)],[long2,lat2,(optional alt2)],...]`.
|
|
190
190
|
* ** Example **: `[[[0,0],[1,1]],[[2,2],[3,3],[4,4],[5,5]]]`
|
|
191
191
|
* ** Example with Altitude **: `[[[0,0,0],[1,1,1000]],[[2,2,2000],[3,3,3000],[4,4,4000],[5,5,5000]]]`
|
|
192
192
|
* ** Note **: Used for `arc` layers
|
|
@@ -62,9 +62,12 @@ class maps_additionalMapStyles_star(ApiValidator):
|
|
|
62
62
|
@staticmethod
|
|
63
63
|
def spec(
|
|
64
64
|
name: str,
|
|
65
|
-
spec:
|
|
66
|
-
fog:
|
|
65
|
+
spec: dict | str,
|
|
66
|
+
fog: dict | None = None,
|
|
67
67
|
icon: str = "md/MdMap",
|
|
68
|
+
mapbox: bool = False,
|
|
69
|
+
light: bool = False,
|
|
70
|
+
sky: dict | None = None,
|
|
68
71
|
**kwargs,
|
|
69
72
|
):
|
|
70
73
|
"""
|
|
@@ -81,8 +84,20 @@ class maps_additionalMapStyles_star(ApiValidator):
|
|
|
81
84
|
* Carto: https://github.com/CartoDB/basemap-styles/blob/master/docs/basemap_styles.json
|
|
82
85
|
* Raster: https://docs.mapbox.com/mapbox-gl-js/example/map-tiles/
|
|
83
86
|
* **`fog`**: `[dict]` = `None` → The fog to show in the map selection menu.
|
|
84
|
-
* **
|
|
85
|
-
|
|
87
|
+
* **Notes**:
|
|
88
|
+
* `fog` is only validated for its type (`dict`).
|
|
89
|
+
* This is only used for when Mapbox is rendering the map.
|
|
90
|
+
* When not using Mapbox, use the `sky` property instead.
|
|
91
|
+
* **See**: https://docs.mapbox.com/mapbox-gl-js/api/map/#map#setfog
|
|
92
|
+
* **`mapbox`**: `[bool]` = `False` → Enforces Mapbox rendering engine for this map style, even if using non-Mapbox tile sources.
|
|
93
|
+
* **`light`**: `[bool]` = `False` → Enforces a light theme for map properties, root styling, and controls to improve visualization on light maps.
|
|
94
|
+
* **`sky`**: `[dict | None]` = `None` → The sky settings for the map style.
|
|
95
|
+
* **Notes**:
|
|
96
|
+
* This is only used for when Mapbox is not rendering the map. This allows for sky rendering when using maplibre globe rendering.
|
|
97
|
+
* When using Mapbox, use the `fog` property instead.
|
|
98
|
+
* `sky` is only validated for its type `dict` and not its contents.
|
|
99
|
+
* **See**: https://maplibre.org/maplibre-style-spec/sky/
|
|
100
|
+
|
|
86
101
|
"""
|
|
87
102
|
return {"kwargs": kwargs, "accepted_values": {}}
|
|
88
103
|
|
|
@@ -101,15 +116,15 @@ class maps_data_star(ApiValidator):
|
|
|
101
116
|
@staticmethod
|
|
102
117
|
def spec(
|
|
103
118
|
name: str,
|
|
104
|
-
currentStyle:
|
|
105
|
-
currentProjection:
|
|
106
|
-
defaultViewport:
|
|
107
|
-
optionalViewports:
|
|
108
|
-
legendGroups:
|
|
109
|
-
legendView:
|
|
110
|
-
showLegendGroupNames:
|
|
111
|
-
legendLayout:
|
|
112
|
-
legendWidth:
|
|
119
|
+
currentStyle: str | None = None,
|
|
120
|
+
currentProjection: str | None = None,
|
|
121
|
+
defaultViewport: dict | None = None,
|
|
122
|
+
optionalViewports: dict | None = None,
|
|
123
|
+
legendGroups: dict | None = None,
|
|
124
|
+
legendView: str | None = None,
|
|
125
|
+
showLegendGroupNames: bool | None = None,
|
|
126
|
+
legendLayout: str | None = None,
|
|
127
|
+
legendWidth: str | None = None,
|
|
113
128
|
**kwargs,
|
|
114
129
|
):
|
|
115
130
|
"""
|
|
@@ -197,15 +212,15 @@ class viewport(ApiValidator):
|
|
|
197
212
|
|
|
198
213
|
@staticmethod
|
|
199
214
|
def spec(
|
|
200
|
-
latitude:
|
|
201
|
-
longitude:
|
|
202
|
-
zoom:
|
|
203
|
-
bearing:
|
|
204
|
-
pitch:
|
|
205
|
-
maxZoom:
|
|
206
|
-
minZoom:
|
|
207
|
-
icon:
|
|
208
|
-
name:
|
|
215
|
+
latitude: int | float,
|
|
216
|
+
longitude: int | float,
|
|
217
|
+
zoom: int | float,
|
|
218
|
+
bearing: int | float | None = None,
|
|
219
|
+
pitch: int | float | None = None,
|
|
220
|
+
maxZoom: int | float | None = None,
|
|
221
|
+
minZoom: int | float | None = None,
|
|
222
|
+
icon: str | None = None,
|
|
223
|
+
name: str | None = None,
|
|
209
224
|
**kwargs,
|
|
210
225
|
):
|
|
211
226
|
"""
|
|
@@ -304,18 +319,18 @@ class maps_data_star_legendGroups_star_data_star(ApiValidator):
|
|
|
304
319
|
@staticmethod
|
|
305
320
|
def spec(
|
|
306
321
|
value: bool,
|
|
307
|
-
sizeBy:
|
|
308
|
-
colorBy:
|
|
309
|
-
lineStyle:
|
|
322
|
+
sizeBy: str | None = None,
|
|
323
|
+
colorBy: str | None = None,
|
|
324
|
+
lineStyle: str | None = None,
|
|
310
325
|
allowGrouping: bool = False,
|
|
311
|
-
group:
|
|
312
|
-
groupCalcBySize:
|
|
313
|
-
groupCalcByColor:
|
|
326
|
+
group: bool | None = False,
|
|
327
|
+
groupCalcBySize: str | None = None,
|
|
328
|
+
groupCalcByColor: str | None = None,
|
|
314
329
|
groupScaleWithZoom: bool = False,
|
|
315
|
-
groupScale:
|
|
316
|
-
colorByOptions:
|
|
317
|
-
sizeByOptions:
|
|
318
|
-
icon:
|
|
330
|
+
groupScale: int | float | None = None,
|
|
331
|
+
colorByOptions: list | None = None,
|
|
332
|
+
sizeByOptions: list | None = None,
|
|
333
|
+
icon: str | None = None,
|
|
319
334
|
**kwargs,
|
|
320
335
|
):
|
|
321
336
|
"""
|