stouputils 1.10.3__tar.gz → 1.11.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.
- {stouputils-1.10.3 → stouputils-1.11.0}/LICENSE +21 -21
- {stouputils-1.10.3 → stouputils-1.11.0}/PKG-INFO +9 -10
- stouputils-1.11.0/pyproject.toml +106 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/applications/automatic_docs.py +1 -1
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/collections.py +6 -3
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/collections.pyi +2 -2
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/continuous_delivery/cd_utils.py +2 -2
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/continuous_delivery/pypi.py +90 -90
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/continuous_delivery/pyproject.py +43 -20
- stouputils-1.11.0/stouputils/continuous_delivery/pyproject.pyi +67 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/continuous_delivery/stubs.py +4 -1
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/ctx.py +408 -408
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/ctx.pyi +1 -1
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/config/set.py +125 -125
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/models/keras_utils/callbacks/model_checkpoint_v2.py +31 -31
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/utils.py +285 -285
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/image.py +30 -15
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/image.pyi +14 -5
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/installer/__init__.py +18 -18
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/installer/linux.py +144 -144
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/installer/main.py +223 -223
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/installer/windows.py +136 -136
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/io.py +6 -20
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/parallel.py +14 -12
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/parallel.pyi +10 -10
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/print.py +4 -3
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/print.pyi +2 -2
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/py.typed +1 -1
- stouputils-1.10.3/pyproject.toml +0 -89
- stouputils-1.10.3/stouputils/applications/automatic_docs.pyi +0 -106
- stouputils-1.10.3/stouputils/applications/upscaler/__init__.pyi +0 -3
- stouputils-1.10.3/stouputils/applications/upscaler/config.pyi +0 -18
- stouputils-1.10.3/stouputils/applications/upscaler/image.pyi +0 -109
- stouputils-1.10.3/stouputils/applications/upscaler/video.pyi +0 -60
- stouputils-1.10.3/stouputils/continuous_delivery/pyproject.pyi +0 -47
- {stouputils-1.10.3 → stouputils-1.11.0}/.gitignore +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/README.md +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/__init__.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/__init__.pyi +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/__main__.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/_deprecated.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/_deprecated.pyi +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/all_doctests.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/all_doctests.pyi +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/applications/__init__.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/applications/__init__.pyi +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/applications/upscaler/__init__.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/applications/upscaler/config.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/applications/upscaler/image.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/applications/upscaler/video.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/archive.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/archive.pyi +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/backup.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/backup.pyi +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/continuous_delivery/__init__.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/continuous_delivery/__init__.pyi +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/continuous_delivery/cd_utils.pyi +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/continuous_delivery/github.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/continuous_delivery/github.pyi +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/continuous_delivery/pypi.pyi +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/continuous_delivery/stubs.pyi +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/config/get.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image/__init__.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image/auto_contrast.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image/axis_flip.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image/bias_field_correction.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image/binary_threshold.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image/blur.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image/brightness.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image/canny.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image/clahe.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image/common.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image/contrast.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image/curvature_flow_filter.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image/denoise.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image/histogram_equalization.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image/invert.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image/laplacian.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image/median_blur.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image/noise.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image/normalize.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image/random_erase.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image/resize.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image/rotation.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image/salt_pepper.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image/sharpening.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image/shearing.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image/threshold.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image/translation.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image/zoom.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image_augmentation.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/image_preprocess.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/prosthesis_detection.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/data_processing/technique.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/dataset/__init__.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/dataset/dataset.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/dataset/dataset_loader.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/dataset/grouping_strategy.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/dataset/image_loader.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/dataset/xy_tuple.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/metric_dictionnary.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/metric_utils.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/mlflow_utils.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/models/abstract_model.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/models/all.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/models/base_keras.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/models/keras/all.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/models/keras/convnext.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/models/keras/densenet.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/models/keras/efficientnet.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/models/keras/mobilenet.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/models/keras/resnet.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/models/keras/squeezenet.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/models/keras/vgg.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/models/keras/xception.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/models/keras_utils/callbacks/__init__.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/models/keras_utils/callbacks/colored_progress_bar.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/models/keras_utils/callbacks/learning_rate_finder.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/models/keras_utils/callbacks/progressive_unfreezing.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/models/keras_utils/callbacks/warmup_scheduler.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/models/keras_utils/losses/__init__.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/models/keras_utils/losses/next_generation_loss.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/models/keras_utils/visualizations.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/models/model_interface.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/models/sandbox.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/range_tuple.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/scripts/augment_dataset.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/scripts/exhaustive_process.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/scripts/preprocess_dataset.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/data_science/scripts/routine.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/decorators.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/decorators.pyi +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/installer/__init__.pyi +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/installer/common.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/installer/common.pyi +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/installer/downloader.py +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/installer/downloader.pyi +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/installer/linux.pyi +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/installer/main.pyi +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/installer/windows.pyi +0 -0
- {stouputils-1.10.3 → stouputils-1.11.0}/stouputils/io.pyi +0 -0
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 Alexandre Collignon
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Alexandre Collignon
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: stouputils
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.11.0
|
|
4
4
|
Summary: Stouputils is a collection of utility modules designed to simplify and enhance the development process. It includes a range of tools for tasks such as execution of doctests, display utilities, decorators, as well as context managers, and many more.
|
|
5
5
|
Project-URL: Homepage, https://github.com/Stoupy51/stouputils
|
|
6
6
|
Project-URL: Issues, https://github.com/Stoupy51/stouputils/issues
|
|
@@ -9,22 +9,20 @@ License-File: LICENSE
|
|
|
9
9
|
Classifier: License :: OSI Approved :: MIT License
|
|
10
10
|
Classifier: Operating System :: OS Independent
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
12
15
|
Requires-Python: >=3.12
|
|
13
16
|
Requires-Dist: argcomplete>=3.0.0
|
|
14
|
-
Requires-Dist:
|
|
15
|
-
Requires-Dist: numpy>=2.
|
|
16
|
-
Requires-Dist: opencv-python>=4.0.0
|
|
17
|
-
Requires-Dist: orjson>=3.0.0
|
|
17
|
+
Requires-Dist: msgspec[toml,yaml]>=0.20.0
|
|
18
|
+
Requires-Dist: numpy>=2.3.0
|
|
18
19
|
Requires-Dist: pillow>=10.0.0
|
|
19
|
-
Requires-Dist:
|
|
20
|
-
Requires-Dist: python-box[all]>=7.0.0
|
|
21
|
-
Requires-Dist: pyyaml>=6.0.0
|
|
20
|
+
Requires-Dist: python-box>=7.0.0
|
|
22
21
|
Requires-Dist: requests>=2.20.0
|
|
23
|
-
Requires-Dist: toml>=0.10.0
|
|
24
22
|
Requires-Dist: tqdm>=4.0.0
|
|
25
|
-
Requires-Dist: zarr>=2.18.3
|
|
26
23
|
Provides-Extra: data-science
|
|
27
24
|
Requires-Dist: mlflow; extra == 'data-science'
|
|
25
|
+
Requires-Dist: opencv-python; extra == 'data-science'
|
|
28
26
|
Requires-Dist: pywavelets; extra == 'data-science'
|
|
29
27
|
Requires-Dist: scikit-image; extra == 'data-science'
|
|
30
28
|
Requires-Dist: scikit-learn; extra == 'data-science'
|
|
@@ -32,6 +30,7 @@ Requires-Dist: simpleitk; extra == 'data-science'
|
|
|
32
30
|
Requires-Dist: tensorflow; extra == 'data-science'
|
|
33
31
|
Provides-Extra: docs
|
|
34
32
|
Requires-Dist: m2r2; extra == 'docs'
|
|
33
|
+
Requires-Dist: mypy; extra == 'docs'
|
|
35
34
|
Requires-Dist: myst-parser; extra == 'docs'
|
|
36
35
|
Requires-Dist: pydata-sphinx-theme; extra == 'docs'
|
|
37
36
|
Requires-Dist: sphinx-breeze-theme; extra == 'docs'
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
|
|
2
|
+
[build-system]
|
|
3
|
+
requires = [
|
|
4
|
+
"hatchling",
|
|
5
|
+
]
|
|
6
|
+
build-backend = "hatchling.build"
|
|
7
|
+
|
|
8
|
+
[project]
|
|
9
|
+
name = "stouputils"
|
|
10
|
+
version = "1.11.0"
|
|
11
|
+
description = "Stouputils is a collection of utility modules designed to simplify and enhance the development process. It includes a range of tools for tasks such as execution of doctests, display utilities, decorators, as well as context managers, and many more."
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.12"
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3.12",
|
|
17
|
+
"Programming Language :: Python :: 3.13",
|
|
18
|
+
"Programming Language :: Python :: 3.14",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Operating System :: OS Independent",
|
|
21
|
+
]
|
|
22
|
+
dependencies = [
|
|
23
|
+
"tqdm>=4.0.0",
|
|
24
|
+
"requests>=2.20.0",
|
|
25
|
+
"msgspec[toml,yaml]>=0.20.0",
|
|
26
|
+
"pillow>=10.0.0",
|
|
27
|
+
"numpy>=2.3.0",
|
|
28
|
+
"python-box>=7.0.0",
|
|
29
|
+
"argcomplete>=3.0.0",
|
|
30
|
+
]
|
|
31
|
+
authors = [
|
|
32
|
+
{ name = "Stoupy51", email = "stoupy51@gmail.com" },
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.optional-dependencies]
|
|
36
|
+
docs = [
|
|
37
|
+
"mypy",
|
|
38
|
+
"m2r2",
|
|
39
|
+
"myst_parser",
|
|
40
|
+
"sphinx_copybutton",
|
|
41
|
+
"sphinx_design",
|
|
42
|
+
"sphinx_treeview",
|
|
43
|
+
"sphinx_breeze_theme",
|
|
44
|
+
"pydata_sphinx_theme",
|
|
45
|
+
]
|
|
46
|
+
data_science = [
|
|
47
|
+
"opencv-python",
|
|
48
|
+
"scikit-image",
|
|
49
|
+
"simpleitk",
|
|
50
|
+
"mlflow",
|
|
51
|
+
"tensorflow",
|
|
52
|
+
"scikit-learn",
|
|
53
|
+
"PyWavelets",
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
[project.urls]
|
|
57
|
+
Homepage = "https://github.com/Stoupy51/stouputils"
|
|
58
|
+
Issues = "https://github.com/Stoupy51/stouputils/issues"
|
|
59
|
+
|
|
60
|
+
[project.scripts]
|
|
61
|
+
stouputils = "stouputils.__main__:main"
|
|
62
|
+
|
|
63
|
+
[tool.pyright]
|
|
64
|
+
typeCheckingMode = "strict"
|
|
65
|
+
|
|
66
|
+
[tool.ruff]
|
|
67
|
+
exclude = [
|
|
68
|
+
".git",
|
|
69
|
+
".ruff_cache",
|
|
70
|
+
".venv",
|
|
71
|
+
".vscode",
|
|
72
|
+
".cursor",
|
|
73
|
+
"build",
|
|
74
|
+
"dist",
|
|
75
|
+
"*.pyi",
|
|
76
|
+
]
|
|
77
|
+
line-length = 200
|
|
78
|
+
|
|
79
|
+
[tool.ruff.lint]
|
|
80
|
+
select = [
|
|
81
|
+
"E",
|
|
82
|
+
"W",
|
|
83
|
+
"F",
|
|
84
|
+
"I",
|
|
85
|
+
"N",
|
|
86
|
+
"UP",
|
|
87
|
+
"B",
|
|
88
|
+
"C4",
|
|
89
|
+
"T20",
|
|
90
|
+
"RUF",
|
|
91
|
+
]
|
|
92
|
+
ignore = [
|
|
93
|
+
"T201",
|
|
94
|
+
"W191",
|
|
95
|
+
"N803",
|
|
96
|
+
"N806",
|
|
97
|
+
"F403",
|
|
98
|
+
"F405",
|
|
99
|
+
]
|
|
100
|
+
|
|
101
|
+
[tool.hatch.build]
|
|
102
|
+
include = [
|
|
103
|
+
"stouputils",
|
|
104
|
+
]
|
|
105
|
+
ignore-vcs = true
|
|
106
|
+
|
|
@@ -29,7 +29,7 @@ if TYPE_CHECKING:
|
|
|
29
29
|
T = TypeVar("T")
|
|
30
30
|
|
|
31
31
|
# Functions
|
|
32
|
-
def unique_list(list_to_clean: Iterable[T], method: Literal["id", "hash", "str"] = "str") -> list[T]:
|
|
32
|
+
def unique_list[T](list_to_clean: Iterable[T], method: Literal["id", "hash", "str"] = "str") -> list[T]:
|
|
33
33
|
""" Remove duplicates from the list while keeping the order using ids (default) or hash or str
|
|
34
34
|
|
|
35
35
|
Args:
|
|
@@ -77,7 +77,7 @@ def unique_list(list_to_clean: Iterable[T], method: Literal["id", "hash", "str"]
|
|
|
77
77
|
# Return the cleaned list
|
|
78
78
|
return result
|
|
79
79
|
|
|
80
|
-
def sort_dict_keys(dictionary: dict[T, Any], order: list[T], reverse: bool = False) -> dict[T, Any]:
|
|
80
|
+
def sort_dict_keys[T](dictionary: dict[T, Any], order: list[T], reverse: bool = False) -> dict[T, Any]:
|
|
81
81
|
""" Sort dictionary keys using a given order list (reverse optional)
|
|
82
82
|
|
|
83
83
|
Args:
|
|
@@ -185,7 +185,10 @@ def array_to_disk(
|
|
|
185
185
|
)
|
|
186
186
|
|
|
187
187
|
# Imports
|
|
188
|
-
|
|
188
|
+
try:
|
|
189
|
+
import zarr # pyright: ignore[reportMissingTypeStubs]
|
|
190
|
+
except ImportError as e:
|
|
191
|
+
raise ImportError("zarr is required for array_to_disk function. Please install it via 'pip install zarr'.") from e
|
|
189
192
|
|
|
190
193
|
# If data is already a zarr.Array and more_data is present, just append and return
|
|
191
194
|
if isinstance(data, zarr.Array) and more_data is not None:
|
|
@@ -6,7 +6,7 @@ from typing import Any, Literal, TypeVar
|
|
|
6
6
|
|
|
7
7
|
T = TypeVar('T')
|
|
8
8
|
|
|
9
|
-
def unique_list(list_to_clean: Iterable[T], method: Literal['id', 'hash', 'str'] = 'str') -> list[T]:
|
|
9
|
+
def unique_list[T](list_to_clean: Iterable[T], method: Literal['id', 'hash', 'str'] = 'str') -> list[T]:
|
|
10
10
|
''' Remove duplicates from the list while keeping the order using ids (default) or hash or str
|
|
11
11
|
|
|
12
12
|
\tArgs:
|
|
@@ -31,7 +31,7 @@ def unique_list(list_to_clean: Iterable[T], method: Literal['id', 'hash', 'str']
|
|
|
31
31
|
\t\t>>> unique_list([s1, s2, s1, s1, s3, s2, s3], method="str")
|
|
32
32
|
\t\t[{1, 2, 3}, {2, 3, 4}]
|
|
33
33
|
\t'''
|
|
34
|
-
def sort_dict_keys(dictionary: dict[T, Any], order: list[T], reverse: bool = False) -> dict[T, Any]:
|
|
34
|
+
def sort_dict_keys[T](dictionary: dict[T, Any], order: list[T], reverse: bool = False) -> dict[T, Any]:
|
|
35
35
|
''' Sort dictionary keys using a given order list (reverse optional)
|
|
36
36
|
|
|
37
37
|
\tArgs:
|
|
@@ -63,9 +63,9 @@ def load_credentials(credentials_path: str) -> dict[str, Any]:
|
|
|
63
63
|
|
|
64
64
|
# Else, load the file if it's a YAML file
|
|
65
65
|
elif credentials_path.endswith((".yml", ".yaml")):
|
|
66
|
-
import yaml
|
|
66
|
+
from msgspec import yaml
|
|
67
67
|
with open(credentials_path) as f:
|
|
68
|
-
return yaml.
|
|
68
|
+
return yaml.decode(f.read())
|
|
69
69
|
|
|
70
70
|
# Else, raise an error
|
|
71
71
|
else:
|
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
""" This module contains utilities for PyPI.
|
|
2
|
-
|
|
3
|
-
- pypi_full_routine: Upload the most recent file(s) to PyPI after updating pip and required packages and building the package
|
|
4
|
-
|
|
5
|
-
.. image:: https://raw.githubusercontent.com/Stoupy51/stouputils/refs/heads/main/assets/continuous_delivery/pypi_module.gif
|
|
6
|
-
:alt: stouputils pypi examples
|
|
7
|
-
"""
|
|
8
|
-
|
|
9
|
-
# Imports
|
|
10
|
-
import os
|
|
11
|
-
import sys
|
|
12
|
-
from collections.abc import Callable
|
|
13
|
-
|
|
14
|
-
from ..decorators import LogLevels, handle_error
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def update_pip_and_required_packages() -> int:
|
|
18
|
-
""" Update pip and required packages.
|
|
19
|
-
|
|
20
|
-
Returns:
|
|
21
|
-
int: Return code of the os.system call.
|
|
22
|
-
"""
|
|
23
|
-
return os.system(f"{sys.executable} -m pip install --upgrade pip setuptools build twine pkginfo packaging")
|
|
24
|
-
|
|
25
|
-
def build_package() -> int:
|
|
26
|
-
""" Build the package.
|
|
27
|
-
|
|
28
|
-
Returns:
|
|
29
|
-
int: Return code of the os.system call.
|
|
30
|
-
"""
|
|
31
|
-
return os.system(f"{sys.executable} -m build")
|
|
32
|
-
|
|
33
|
-
def upload_package(repository: str, filepath: str) -> int:
|
|
34
|
-
""" Upload the package to PyPI.
|
|
35
|
-
|
|
36
|
-
Args:
|
|
37
|
-
repository (str): Repository to upload to.
|
|
38
|
-
filepath (str): Path to the file to upload.
|
|
39
|
-
|
|
40
|
-
Returns:
|
|
41
|
-
int: Return code of the os.system call.
|
|
42
|
-
"""
|
|
43
|
-
return os.system(f"{sys.executable} -m twine upload --verbose -r {repository} {filepath}")
|
|
44
|
-
|
|
45
|
-
@handle_error(message="Error while doing the pypi full routine", error_log=LogLevels.ERROR_TRACEBACK)
|
|
46
|
-
def pypi_full_routine(
|
|
47
|
-
repository: str,
|
|
48
|
-
dist_directory: str,
|
|
49
|
-
last_files: int = 1,
|
|
50
|
-
endswith: str = ".tar.gz",
|
|
51
|
-
|
|
52
|
-
update_all_function: Callable[[], int] = update_pip_and_required_packages,
|
|
53
|
-
build_package_function: Callable[[], int] = build_package,
|
|
54
|
-
upload_package_function: Callable[[str, str], int] = upload_package,
|
|
55
|
-
) -> None:
|
|
56
|
-
""" Upload the most recent file(s) to PyPI after updating pip and required packages and building the package.
|
|
57
|
-
|
|
58
|
-
Args:
|
|
59
|
-
repository (str): Repository to upload to.
|
|
60
|
-
dist_directory (str): Directory to upload from.
|
|
61
|
-
last_files (int): Number of most recent files to upload. Defaults to 1.
|
|
62
|
-
endswith (str): End of the file name to upload. Defaults to ".tar.gz".
|
|
63
|
-
update_all_function (Callable[[], int]): Function to update pip and required packages.
|
|
64
|
-
Defaults to :func:`update_pip_and_required_packages`.
|
|
65
|
-
build_package_function (Callable[[], int]): Function to build the package.
|
|
66
|
-
Defaults to :func:`build_package`.
|
|
67
|
-
upload_package_function (Callable[[str, str], int]): Function to upload the package.
|
|
68
|
-
Defaults to :func:`upload_package`.
|
|
69
|
-
|
|
70
|
-
Returns:
|
|
71
|
-
int: Return code of the command.
|
|
72
|
-
"""
|
|
73
|
-
if update_all_function() != 0:
|
|
74
|
-
raise Exception("Error while updating pip and required packages")
|
|
75
|
-
|
|
76
|
-
if build_package_function() != 0:
|
|
77
|
-
raise Exception("Error while building the package")
|
|
78
|
-
|
|
79
|
-
# Get list of tar.gz files in dist directory sorted by modification time
|
|
80
|
-
files: list[str] = sorted(
|
|
81
|
-
[x for x in os.listdir(dist_directory) if x.endswith(endswith)], # Get list of tar.gz files in dist directory
|
|
82
|
-
key=lambda x: os.path.getmtime(f"{dist_directory}/{x}"), # Sort by modification time
|
|
83
|
-
reverse=True # Sort in reverse order
|
|
84
|
-
)
|
|
85
|
-
|
|
86
|
-
# Upload the most recent file(s)
|
|
87
|
-
for file in files[:last_files]:
|
|
88
|
-
upload_package_function(repository, f"{dist_directory}/{file}")
|
|
89
|
-
|
|
90
|
-
|
|
1
|
+
""" This module contains utilities for PyPI.
|
|
2
|
+
|
|
3
|
+
- pypi_full_routine: Upload the most recent file(s) to PyPI after updating pip and required packages and building the package
|
|
4
|
+
|
|
5
|
+
.. image:: https://raw.githubusercontent.com/Stoupy51/stouputils/refs/heads/main/assets/continuous_delivery/pypi_module.gif
|
|
6
|
+
:alt: stouputils pypi examples
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
# Imports
|
|
10
|
+
import os
|
|
11
|
+
import sys
|
|
12
|
+
from collections.abc import Callable
|
|
13
|
+
|
|
14
|
+
from ..decorators import LogLevels, handle_error
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def update_pip_and_required_packages() -> int:
|
|
18
|
+
""" Update pip and required packages.
|
|
19
|
+
|
|
20
|
+
Returns:
|
|
21
|
+
int: Return code of the os.system call.
|
|
22
|
+
"""
|
|
23
|
+
return os.system(f"{sys.executable} -m pip install --upgrade pip setuptools build twine pkginfo packaging")
|
|
24
|
+
|
|
25
|
+
def build_package() -> int:
|
|
26
|
+
""" Build the package.
|
|
27
|
+
|
|
28
|
+
Returns:
|
|
29
|
+
int: Return code of the os.system call.
|
|
30
|
+
"""
|
|
31
|
+
return os.system(f"{sys.executable} -m build")
|
|
32
|
+
|
|
33
|
+
def upload_package(repository: str, filepath: str) -> int:
|
|
34
|
+
""" Upload the package to PyPI.
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
repository (str): Repository to upload to.
|
|
38
|
+
filepath (str): Path to the file to upload.
|
|
39
|
+
|
|
40
|
+
Returns:
|
|
41
|
+
int: Return code of the os.system call.
|
|
42
|
+
"""
|
|
43
|
+
return os.system(f"{sys.executable} -m twine upload --verbose -r {repository} {filepath}")
|
|
44
|
+
|
|
45
|
+
@handle_error(message="Error while doing the pypi full routine", error_log=LogLevels.ERROR_TRACEBACK)
|
|
46
|
+
def pypi_full_routine(
|
|
47
|
+
repository: str,
|
|
48
|
+
dist_directory: str,
|
|
49
|
+
last_files: int = 1,
|
|
50
|
+
endswith: str = ".tar.gz",
|
|
51
|
+
|
|
52
|
+
update_all_function: Callable[[], int] = update_pip_and_required_packages,
|
|
53
|
+
build_package_function: Callable[[], int] = build_package,
|
|
54
|
+
upload_package_function: Callable[[str, str], int] = upload_package,
|
|
55
|
+
) -> None:
|
|
56
|
+
""" Upload the most recent file(s) to PyPI after updating pip and required packages and building the package.
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
repository (str): Repository to upload to.
|
|
60
|
+
dist_directory (str): Directory to upload from.
|
|
61
|
+
last_files (int): Number of most recent files to upload. Defaults to 1.
|
|
62
|
+
endswith (str): End of the file name to upload. Defaults to ".tar.gz".
|
|
63
|
+
update_all_function (Callable[[], int]): Function to update pip and required packages.
|
|
64
|
+
Defaults to :func:`update_pip_and_required_packages`.
|
|
65
|
+
build_package_function (Callable[[], int]): Function to build the package.
|
|
66
|
+
Defaults to :func:`build_package`.
|
|
67
|
+
upload_package_function (Callable[[str, str], int]): Function to upload the package.
|
|
68
|
+
Defaults to :func:`upload_package`.
|
|
69
|
+
|
|
70
|
+
Returns:
|
|
71
|
+
int: Return code of the command.
|
|
72
|
+
"""
|
|
73
|
+
if update_all_function() != 0:
|
|
74
|
+
raise Exception("Error while updating pip and required packages")
|
|
75
|
+
|
|
76
|
+
if build_package_function() != 0:
|
|
77
|
+
raise Exception("Error while building the package")
|
|
78
|
+
|
|
79
|
+
# Get list of tar.gz files in dist directory sorted by modification time
|
|
80
|
+
files: list[str] = sorted(
|
|
81
|
+
[x for x in os.listdir(dist_directory) if x.endswith(endswith)], # Get list of tar.gz files in dist directory
|
|
82
|
+
key=lambda x: os.path.getmtime(f"{dist_directory}/{x}"), # Sort by modification time
|
|
83
|
+
reverse=True # Sort in reverse order
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
# Upload the most recent file(s)
|
|
87
|
+
for file in files[:last_files]:
|
|
88
|
+
upload_package_function(repository, f"{dist_directory}/{file}")
|
|
89
|
+
|
|
90
|
+
|
|
@@ -25,12 +25,17 @@ def read_pyproject(pyproject_path: str) -> dict[str, Any]:
|
|
|
25
25
|
|
|
26
26
|
Args:
|
|
27
27
|
pyproject_path: Path to the pyproject.toml file.
|
|
28
|
-
|
|
29
28
|
Returns:
|
|
30
29
|
dict[str, Any]: The content of the pyproject.toml file.
|
|
30
|
+
Example:
|
|
31
|
+
>>> content = read_pyproject("pyproject.toml")
|
|
32
|
+
>>> "." in content["project"]["version"]
|
|
33
|
+
True
|
|
31
34
|
"""
|
|
32
|
-
import toml
|
|
33
|
-
|
|
35
|
+
from msgspec import toml
|
|
36
|
+
with open(pyproject_path) as file:
|
|
37
|
+
content = file.read()
|
|
38
|
+
return toml.decode(content)
|
|
34
39
|
|
|
35
40
|
|
|
36
41
|
def format_toml_lists(content: str) -> str:
|
|
@@ -38,9 +43,18 @@ def format_toml_lists(content: str) -> str:
|
|
|
38
43
|
|
|
39
44
|
Args:
|
|
40
45
|
content (str): The content of the pyproject.toml file.
|
|
41
|
-
|
|
42
46
|
Returns:
|
|
43
47
|
str: The formatted content with properly indented lists.
|
|
48
|
+
Example:
|
|
49
|
+
>>> toml_content = '''[project]
|
|
50
|
+
... dependencies = [ "tqdm>=4.0.0", "requests>=2.20.0", "pyyaml>=6.0.0", ]'''
|
|
51
|
+
>>> format_toml_lists(toml_content).replace("\\t", " ") == '''[project]
|
|
52
|
+
... dependencies = [
|
|
53
|
+
... "tqdm>=4.0.0",
|
|
54
|
+
... "requests>=2.20.0",
|
|
55
|
+
... "pyyaml>=6.0.0",
|
|
56
|
+
... ]'''
|
|
57
|
+
True
|
|
44
58
|
"""
|
|
45
59
|
# Split the content into individual lines for processing
|
|
46
60
|
lines: list[str] = content.split("\n")
|
|
@@ -78,14 +92,20 @@ def format_toml_lists(content: str) -> str:
|
|
|
78
92
|
return "\n".join(formatted_lines)
|
|
79
93
|
|
|
80
94
|
|
|
81
|
-
def write_pyproject(
|
|
82
|
-
""" Write to the pyproject.toml file with properly indented lists.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
95
|
+
def write_pyproject(path: str, content: dict[str, Any]) -> None:
|
|
96
|
+
""" Write to the pyproject.toml file with properly indented lists.
|
|
97
|
+
|
|
98
|
+
Args:
|
|
99
|
+
path: Path to the pyproject.toml file.
|
|
100
|
+
content: Content to write to the pyproject.toml file.
|
|
101
|
+
"""
|
|
102
|
+
from msgspec.toml import _import_tomli_w # pyright: ignore[reportPrivateUsage]
|
|
103
|
+
toml = _import_tomli_w()
|
|
104
|
+
string: str = "\n" + toml.dumps(content) + "\n"
|
|
105
|
+
string = format_toml_lists(string) # Apply formatting
|
|
86
106
|
|
|
87
|
-
with super_open(
|
|
88
|
-
file.write(
|
|
107
|
+
with super_open(path, "w") as file:
|
|
108
|
+
file.write(string)
|
|
89
109
|
|
|
90
110
|
|
|
91
111
|
def increment_version_from_input(version: str) -> str:
|
|
@@ -93,32 +113,35 @@ def increment_version_from_input(version: str) -> str:
|
|
|
93
113
|
|
|
94
114
|
Args:
|
|
95
115
|
version: The version to increment. (ex: "0.1.0")
|
|
96
|
-
|
|
97
116
|
Returns:
|
|
98
117
|
str: The incremented version. (ex: "0.1.1")
|
|
118
|
+
Example:
|
|
119
|
+
>>> increment_version_from_input("0.1.0")
|
|
120
|
+
'0.1.1'
|
|
121
|
+
>>> increment_version_from_input("1.2.9")
|
|
122
|
+
'1.2.10'
|
|
99
123
|
"""
|
|
100
124
|
version_parts: list[str] = version.split(".")
|
|
101
125
|
version_parts[-1] = str(int(version_parts[-1]) + 1)
|
|
102
126
|
return ".".join(version_parts)
|
|
103
127
|
|
|
104
|
-
def increment_version_from_pyproject(
|
|
128
|
+
def increment_version_from_pyproject(path: str) -> None:
|
|
105
129
|
""" Increment the version in the pyproject.toml file.
|
|
106
130
|
|
|
107
131
|
Args:
|
|
108
|
-
|
|
132
|
+
path: Path to the pyproject.toml file.
|
|
109
133
|
"""
|
|
110
|
-
pyproject_content: dict[str, Any] = read_pyproject(
|
|
134
|
+
pyproject_content: dict[str, Any] = read_pyproject(path)
|
|
111
135
|
pyproject_content["project"]["version"] = increment_version_from_input(pyproject_content["project"]["version"])
|
|
112
|
-
write_pyproject(
|
|
136
|
+
write_pyproject(path, pyproject_content)
|
|
113
137
|
|
|
114
|
-
def get_version_from_pyproject(
|
|
138
|
+
def get_version_from_pyproject(path: str) -> str:
|
|
115
139
|
""" Get the version from the pyproject.toml file.
|
|
116
140
|
|
|
117
141
|
Args:
|
|
118
|
-
|
|
119
|
-
|
|
142
|
+
path: Path to the pyproject.toml file.
|
|
120
143
|
Returns:
|
|
121
144
|
str: The version. (ex: "0.1.0")
|
|
122
145
|
"""
|
|
123
|
-
return read_pyproject(
|
|
146
|
+
return read_pyproject(path)["project"]["version"]
|
|
124
147
|
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
from ..io import super_open as super_open
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
def read_pyproject(pyproject_path: str) -> dict[str, Any]:
|
|
5
|
+
''' Read the pyproject.toml file.
|
|
6
|
+
|
|
7
|
+
\tArgs:
|
|
8
|
+
\t\tpyproject_path: Path to the pyproject.toml file.
|
|
9
|
+
\tReturns:
|
|
10
|
+
\t\tdict[str, Any]: The content of the pyproject.toml file.
|
|
11
|
+
\tExample:
|
|
12
|
+
\t\t>>> content = read_pyproject("pyproject.toml")
|
|
13
|
+
\t\t>>> "." in content["project"]["version"]
|
|
14
|
+
\t\tTrue
|
|
15
|
+
\t'''
|
|
16
|
+
def format_toml_lists(content: str) -> str:
|
|
17
|
+
''' Format TOML lists with indentation.
|
|
18
|
+
|
|
19
|
+
\tArgs:
|
|
20
|
+
\t\tcontent (str): The content of the pyproject.toml file.
|
|
21
|
+
\tReturns:
|
|
22
|
+
\t\tstr: The formatted content with properly indented lists.
|
|
23
|
+
\tExample:
|
|
24
|
+
\t\t>>> toml_content = \'\'\'[project]
|
|
25
|
+
\t\t... dependencies = [ "tqdm>=4.0.0", "requests>=2.20.0", "pyyaml>=6.0.0", ]\'\'\'
|
|
26
|
+
\t\t>>> format_toml_lists(toml_content).replace("\\t", " ") == \'\'\'[project]
|
|
27
|
+
\t\t... dependencies = [
|
|
28
|
+
\t\t... "tqdm>=4.0.0",
|
|
29
|
+
\t\t... "requests>=2.20.0",
|
|
30
|
+
\t\t... "pyyaml>=6.0.0",
|
|
31
|
+
\t\t... ]\'\'\'
|
|
32
|
+
\t\tTrue
|
|
33
|
+
\t'''
|
|
34
|
+
def write_pyproject(path: str, content: dict[str, Any]) -> None:
|
|
35
|
+
""" Write to the pyproject.toml file with properly indented lists.
|
|
36
|
+
|
|
37
|
+
\tArgs:
|
|
38
|
+
\t\tpath: Path to the pyproject.toml file.
|
|
39
|
+
\t\tcontent: Content to write to the pyproject.toml file.
|
|
40
|
+
\t"""
|
|
41
|
+
def increment_version_from_input(version: str) -> str:
|
|
42
|
+
''' Increment the version.
|
|
43
|
+
|
|
44
|
+
\tArgs:
|
|
45
|
+
\t\tversion: The version to increment. (ex: "0.1.0")
|
|
46
|
+
\tReturns:
|
|
47
|
+
\t\tstr: The incremented version. (ex: "0.1.1")
|
|
48
|
+
\tExample:
|
|
49
|
+
\t\t>>> increment_version_from_input("0.1.0")
|
|
50
|
+
\t\t\'0.1.1\'
|
|
51
|
+
\t\t>>> increment_version_from_input("1.2.9")
|
|
52
|
+
\t\t\'1.2.10\'
|
|
53
|
+
\t'''
|
|
54
|
+
def increment_version_from_pyproject(path: str) -> None:
|
|
55
|
+
""" Increment the version in the pyproject.toml file.
|
|
56
|
+
|
|
57
|
+
\tArgs:
|
|
58
|
+
\t\tpath: Path to the pyproject.toml file.
|
|
59
|
+
\t"""
|
|
60
|
+
def get_version_from_pyproject(path: str) -> str:
|
|
61
|
+
''' Get the version from the pyproject.toml file.
|
|
62
|
+
|
|
63
|
+
\tArgs:
|
|
64
|
+
\t\tpath: Path to the pyproject.toml file.
|
|
65
|
+
\tReturns:
|
|
66
|
+
\t\tstr: The version. (ex: "0.1.0")
|
|
67
|
+
\t'''
|
|
@@ -26,7 +26,10 @@ def generate_stubs(
|
|
|
26
26
|
Returns:
|
|
27
27
|
int: Return code of the os.system call.
|
|
28
28
|
"""
|
|
29
|
-
|
|
29
|
+
try:
|
|
30
|
+
from mypy.stubgen import main as stubgen_main
|
|
31
|
+
except ImportError as e:
|
|
32
|
+
raise ImportError("mypy is required for array_to_disk function. Please install it via 'pip install mypy'.") from e
|
|
30
33
|
try:
|
|
31
34
|
stubgen_main(["-p", package_name, *extra_args.split()])
|
|
32
35
|
return 0
|