calkit-python 0.3.1__tar.gz → 0.3.2__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.
- {calkit_python-0.3.1 → calkit_python-0.3.2}/PKG-INFO +1 -2
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/__init__.py +1 -1
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/cli/office.py +7 -5
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/office.py +11 -10
- {calkit_python-0.3.1 → calkit_python-0.3.2}/.github/FUNDING.yml +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/.github/workflows/publish-test.yml +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/.github/workflows/publish.yml +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/.gitignore +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/LICENSE +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/README.md +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/cli/__init__.py +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/cli/config.py +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/cli/core.py +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/cli/import_.py +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/cli/list.py +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/cli/main.py +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/cli/new.py +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/cli/notebooks.py +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/cloud.py +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/config.py +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/core.py +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/data.py +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/docker.py +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/dvc.py +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/git.py +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/gui.py +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/jupyter.py +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/models.py +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/server.py +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/tests/__init__.py +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/tests/cli/__init__.py +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/tests/cli/test_list.py +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/tests/cli/test_main.py +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/tests/cli/test_new.py +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/tests/test_core.py +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/tests/test_dvc.py +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/calkit/tests/test_jupyter.py +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/examples/cfd-study/README.md +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/examples/cfd-study/calkit.yaml +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/examples/cfd-study/config/simulations/runs.csv +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/examples/cfd-study/notebook.ipynb +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/examples/ms-office/.gitignore +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/examples/ms-office/README.md +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/examples/ms-office/calkit.yaml +0 -0
- {calkit_python-0.3.1 → calkit_python-0.3.2}/pyproject.toml +0 -0
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: calkit-python
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: Reproducibility simplified.
|
|
5
5
|
Project-URL: Homepage, https://github.com/calkit/calkit
|
|
6
6
|
Project-URL: Issues, https://github.com/calkit/calkit/issues
|
|
7
7
|
Author-email: Pete Bachant <petebachant@gmail.com>
|
|
8
|
-
License-File: LICENSE
|
|
9
8
|
Classifier: License :: OSI Approved :: MIT License
|
|
10
9
|
Classifier: Operating System :: OS Independent
|
|
11
10
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -15,12 +15,14 @@ office_app = typer.Typer(no_args_is_help=True)
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
@office_app.command(
|
|
18
|
-
name="excel-chart-to-
|
|
19
|
-
help="Extract a chart from Excel and save to
|
|
18
|
+
name="excel-chart-to-image",
|
|
19
|
+
help="Extract a chart from Excel and save to image.",
|
|
20
20
|
)
|
|
21
|
-
def
|
|
21
|
+
def excel_chart_to_image(
|
|
22
22
|
input_fpath: Annotated[str, typer.Argument(help="Input Excel file path.")],
|
|
23
|
-
output_fpath: Annotated[
|
|
23
|
+
output_fpath: Annotated[
|
|
24
|
+
str, typer.Argument(help="Output image file path.")
|
|
25
|
+
],
|
|
24
26
|
sheet: Annotated[
|
|
25
27
|
int, typer.Option("--sheet", help="Sheet in workbook.")
|
|
26
28
|
] = 1,
|
|
@@ -34,7 +36,7 @@ def excel_chart_to_png(
|
|
|
34
36
|
f"Exporting chart at index {chart_index} from sheet {sheet} "
|
|
35
37
|
f"in {input_fpath} to {output_fpath}"
|
|
36
38
|
)
|
|
37
|
-
calkit.office.
|
|
39
|
+
calkit.office.excel_chart_to_image(
|
|
38
40
|
input_fpath=input_fpath,
|
|
39
41
|
output_fpath=output_fpath,
|
|
40
42
|
sheet=sheet,
|
|
@@ -5,13 +5,13 @@ import os
|
|
|
5
5
|
from PIL import ImageGrab
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def
|
|
8
|
+
def excel_chart_to_image(
|
|
9
9
|
input_fpath: str,
|
|
10
10
|
output_fpath: str,
|
|
11
11
|
sheet: int = 1,
|
|
12
12
|
chart_index: int = 0,
|
|
13
13
|
):
|
|
14
|
-
"""Export a chart from an Excel sheet to
|
|
14
|
+
"""Export a chart from an Excel sheet to image."""
|
|
15
15
|
import win32com.client
|
|
16
16
|
|
|
17
17
|
# Open the excel application using win32com
|
|
@@ -21,22 +21,23 @@ def excel_chart_to_png(
|
|
|
21
21
|
excel.DisplayAlerts = 0
|
|
22
22
|
# Open workbook
|
|
23
23
|
wb = excel.Workbooks.Open(os.path.abspath(input_fpath))
|
|
24
|
-
factor = 1.0
|
|
25
24
|
# Extract sheet
|
|
26
25
|
# TODO: Close workbook if something fails
|
|
27
26
|
sheet = excel.Sheets(sheet)
|
|
28
27
|
shape = sheet.Shapes[chart_index]
|
|
29
28
|
shape.Copy()
|
|
30
29
|
image = ImageGrab.grabclipboard()
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
# Check if we need to change the mode of the image
|
|
31
|
+
_, ext = os.path.splitext(output_fpath)
|
|
32
|
+
if (
|
|
33
|
+
ext in [".jpg", ".eps", ".tiff", ".gif", ".bmp"]
|
|
34
|
+
and image.mode != "RGB"
|
|
35
|
+
):
|
|
36
|
+
image = image.convert("RGB")
|
|
37
|
+
# Save the image, overwriting if exists
|
|
35
38
|
dirname = os.path.dirname(output_fpath)
|
|
36
39
|
if dirname and not os.path.isdir(dirname):
|
|
37
40
|
os.makedirs(dirname)
|
|
38
|
-
|
|
39
|
-
os.path.abspath(output_fpath), "png", quality=95, dpi=(300, 300)
|
|
40
|
-
)
|
|
41
|
+
image.save(os.path.abspath(output_fpath), quality=95, dpi=(300, 300))
|
|
41
42
|
wb.Close(True)
|
|
42
43
|
excel.Quit()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|