calkit-python 0.3.1__tar.gz → 0.3.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. {calkit_python-0.3.1 → calkit_python-0.3.3}/PKG-INFO +13 -3
  2. {calkit_python-0.3.1 → calkit_python-0.3.3}/README.md +12 -1
  3. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/__init__.py +1 -1
  4. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/cli/main.py +4 -2
  5. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/cli/office.py +7 -5
  6. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/office.py +11 -10
  7. calkit_python-0.3.1/examples/cfd-study/README.md +0 -3
  8. calkit_python-0.3.1/examples/cfd-study/calkit.yaml +0 -9
  9. calkit_python-0.3.1/examples/cfd-study/config/simulations/runs.csv +0 -2
  10. calkit_python-0.3.1/examples/cfd-study/notebook.ipynb +0 -37
  11. calkit_python-0.3.1/examples/ms-office/.gitignore +0 -6
  12. calkit_python-0.3.1/examples/ms-office/README.md +0 -11
  13. calkit_python-0.3.1/examples/ms-office/calkit.yaml +0 -2
  14. {calkit_python-0.3.1 → calkit_python-0.3.3}/.github/FUNDING.yml +0 -0
  15. {calkit_python-0.3.1 → calkit_python-0.3.3}/.github/workflows/publish-test.yml +0 -0
  16. {calkit_python-0.3.1 → calkit_python-0.3.3}/.github/workflows/publish.yml +0 -0
  17. {calkit_python-0.3.1 → calkit_python-0.3.3}/.gitignore +0 -0
  18. {calkit_python-0.3.1 → calkit_python-0.3.3}/LICENSE +0 -0
  19. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/cli/__init__.py +0 -0
  20. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/cli/config.py +0 -0
  21. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/cli/core.py +0 -0
  22. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/cli/import_.py +0 -0
  23. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/cli/list.py +0 -0
  24. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/cli/new.py +0 -0
  25. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/cli/notebooks.py +0 -0
  26. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/cloud.py +0 -0
  27. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/config.py +0 -0
  28. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/core.py +0 -0
  29. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/data.py +0 -0
  30. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/docker.py +0 -0
  31. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/dvc.py +0 -0
  32. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/git.py +0 -0
  33. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/gui.py +0 -0
  34. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/jupyter.py +0 -0
  35. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/models.py +0 -0
  36. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/server.py +0 -0
  37. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/tests/__init__.py +0 -0
  38. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/tests/cli/__init__.py +0 -0
  39. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/tests/cli/test_list.py +0 -0
  40. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/tests/cli/test_main.py +0 -0
  41. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/tests/cli/test_new.py +0 -0
  42. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/tests/test_core.py +0 -0
  43. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/tests/test_dvc.py +0 -0
  44. {calkit_python-0.3.1 → calkit_python-0.3.3}/calkit/tests/test_jupyter.py +0 -0
  45. {calkit_python-0.3.1 → calkit_python-0.3.3}/pyproject.toml +0 -0
@@ -1,11 +1,10 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: calkit-python
3
- Version: 0.3.1
3
+ Version: 0.3.3
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
@@ -75,7 +74,18 @@ forcing them to work at that lower level of abstraction.
75
74
 
76
75
  ## Installation
77
76
 
78
- Simply run
77
+ To install Calkit, [Git](https://git-scm.com) and Python must be installed.
78
+ If you want to use [Docker](https://docker.com) containers,
79
+ which is typically a good idea,
80
+ that should also be installed.
81
+ For Python, we recommend
82
+ [Mambaforge](https://conda-forge.org/miniforge/).
83
+ If you're a Windows user and decide to install Mambaforge or any other
84
+ Conda-based distribution,
85
+ e.g., Anaconda, you'll probably want to ensure that environment is
86
+ [activated by default in Git Bash](https://discuss.codecademy.com/t/setting-up-conda-in-git-bash/534473).
87
+
88
+ After Python is installed, run
79
89
 
80
90
  ```sh
81
91
  pip install calkit-python
@@ -43,7 +43,18 @@ forcing them to work at that lower level of abstraction.
43
43
 
44
44
  ## Installation
45
45
 
46
- Simply run
46
+ To install Calkit, [Git](https://git-scm.com) and Python must be installed.
47
+ If you want to use [Docker](https://docker.com) containers,
48
+ which is typically a good idea,
49
+ that should also be installed.
50
+ For Python, we recommend
51
+ [Mambaforge](https://conda-forge.org/miniforge/).
52
+ If you're a Windows user and decide to install Mambaforge or any other
53
+ Conda-based distribution,
54
+ e.g., Anaconda, you'll probably want to ensure that environment is
55
+ [activated by default in Git Bash](https://discuss.codecademy.com/t/setting-up-conda-in-git-bash/534473).
56
+
57
+ After Python is installed, run
47
58
 
48
59
  ```sh
49
60
  pip install calkit-python
@@ -1,4 +1,4 @@
1
- __version__ = "0.3.1"
1
+ __version__ = "0.3.3"
2
2
 
3
3
  from .core import *
4
4
  from . import git
@@ -298,8 +298,10 @@ def push():
298
298
  subprocess.call(["dvc", "push"])
299
299
 
300
300
 
301
- @app.command(name="server", help="Run the local server.")
302
- def run_server():
301
+ @app.command(
302
+ name="local-server", help="Run the local server to interact over HTTP."
303
+ )
304
+ def run_local_server():
303
305
  import uvicorn
304
306
 
305
307
  uvicorn.run(
@@ -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-png",
19
- help="Extract a chart from Excel and save to PNG.",
18
+ name="excel-chart-to-image",
19
+ help="Extract a chart from Excel and save to image.",
20
20
  )
21
- def excel_chart_to_png(
21
+ def excel_chart_to_image(
22
22
  input_fpath: Annotated[str, typer.Argument(help="Input Excel file path.")],
23
- output_fpath: Annotated[str, typer.Argument(help="Output PNG file path.")],
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.excel_chart_to_png(
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 excel_chart_to_png(
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 PNG."""
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
- length_x, width_y = image.size
32
- size = int(factor * length_x), int(factor * width_y)
33
- image_resize = image.resize(size)
34
- # Save the image into the existing png file, overwriting if exists
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
- image_resize.save(
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()
@@ -1,3 +0,0 @@
1
- # Calkit CFD study example
2
-
3
- This example is not yet complete!
@@ -1,9 +0,0 @@
1
- questions:
2
- - What is the drag coefficient of this shape?
3
- environments:
4
- - path: sim/Dockerfile
5
- name: cfd
6
- kind: docker
7
- - path: environment.yml
8
- name: processing
9
- kind: conda
@@ -1,2 +0,0 @@
1
- environment,wind_speed,wind_direction
2
- cfd,1.0,270.0
@@ -1,37 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "code",
5
- "execution_count": null,
6
- "metadata": {},
7
- "outputs": [],
8
- "source": [
9
- "import calkit\n",
10
- "\n",
11
- "# Print out the plan of this study\n",
12
- "plan = calkit.get_plan()\n",
13
- "\n",
14
- "# Describe this project\n",
15
- "project = calkit.get_project()\n",
16
- "\n",
17
- "# What are the questions?\n",
18
- "print(project.questions)\n",
19
- "\n",
20
- "# Get the status of the project, i.e., how many more simulations are there\n",
21
- "# left to run\n",
22
- "# is everything post-processed?\n",
23
- "status = calkit.get_status()\n",
24
- "\n",
25
- "# By default this will run any non-finished simulations locally\n",
26
- "calkit.run()"
27
- ]
28
- }
29
- ],
30
- "metadata": {
31
- "language_info": {
32
- "name": "python"
33
- }
34
- },
35
- "nbformat": 4,
36
- "nbformat_minor": 2
37
- }
@@ -1,6 +0,0 @@
1
- # Keep MS office files out of Git, but still version them
2
- # maybe they are synced via Dropbox or something, but we still track if
3
- # they've changed?
4
- *.docx
5
- *.xls
6
- *.xlsx
@@ -1,11 +0,0 @@
1
- # MS Office user
2
-
3
- This example reflects the "non-hacker" researcher who uses Microsoft
4
- Office (or similar) for a lot of their work.
5
- Note that there is nothing wrong with this workflow,
6
- but it is inherently harder for collaboration and reproducibility,
7
- since version control for MS Office files is tougher.
8
-
9
- Our goal with this example is to allow someone who likes Word and Excel
10
- to keep using those tools, but to still help with organization
11
- and reproducibility.
@@ -1,2 +0,0 @@
1
- questions:
2
- - Is it possible to use an office suite in a reproducible way?
File without changes
File without changes