icplot 0.0.3__tar.gz → 0.0.4__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.
- {icplot-0.0.3/src/icplot.egg-info → icplot-0.0.4}/PKG-INFO +33 -3
- icplot-0.0.4/README.md +39 -0
- {icplot-0.0.3 → icplot-0.0.4}/pyproject.toml +10 -5
- icplot-0.0.4/src/icplot/image_utils.py +36 -0
- icplot-0.0.4/src/icplot/main_cli.py +71 -0
- icplot-0.0.4/src/icplot/project_elements.py +4 -0
- {icplot-0.0.3 → icplot-0.0.4/src/icplot.egg-info}/PKG-INFO +33 -3
- {icplot-0.0.3 → icplot-0.0.4}/src/icplot.egg-info/SOURCES.txt +3 -0
- icplot-0.0.4/src/icplot.egg-info/entry_points.txt +2 -0
- {icplot-0.0.3 → icplot-0.0.4}/src/icplot.egg-info/requires.txt +2 -2
- {icplot-0.0.3 → icplot-0.0.4}/test/test_gantt_chart.py +3 -1
- icplot-0.0.4/test/test_image_utils.py +21 -0
- icplot-0.0.3/README.md +0 -10
- icplot-0.0.3/src/icplot/image_utils.py +0 -16
- icplot-0.0.3/src/icplot/project_elements.py +0 -47
- {icplot-0.0.3 → icplot-0.0.4}/LICENSE +0 -0
- {icplot-0.0.3 → icplot-0.0.4}/setup.cfg +0 -0
- {icplot-0.0.3 → icplot-0.0.4}/src/icplot/__init__.py +0 -0
- {icplot-0.0.3 → icplot-0.0.4}/src/icplot/cairo_interface.py +0 -0
- {icplot-0.0.3 → icplot-0.0.4}/src/icplot/gantt.py +0 -0
- {icplot-0.0.3 → icplot-0.0.4}/src/icplot/geometry.py +0 -0
- {icplot-0.0.3 → icplot-0.0.4}/src/icplot/tex_interface.py +0 -0
- {icplot-0.0.3 → icplot-0.0.4}/src/icplot.egg-info/dependency_links.txt +0 -0
- {icplot-0.0.3 → icplot-0.0.4}/src/icplot.egg-info/top_level.txt +0 -0
- {icplot-0.0.3 → icplot-0.0.4}/test/test_cairo_interface.py +0 -0
- {icplot-0.0.3 → icplot-0.0.4}/test/test_tex_interface.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: icplot
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
4
4
|
Summary: Utilities for generating plots and graphics for technical reports.
|
|
5
5
|
Author-email: "James Grogan, Irish Centre for High End Computing" <james.grogan@ichec.ie>
|
|
6
6
|
Project-URL: Repository, https://git.ichec.ie/performance/toolshed/icplot
|
|
@@ -15,19 +15,49 @@ Requires-Python: >=3.8
|
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
License-File: LICENSE
|
|
17
17
|
Requires-Dist: wand
|
|
18
|
+
Requires-Dist: pycairo
|
|
19
|
+
Requires-Dist: CairoSVG
|
|
20
|
+
Requires-Dist: iccore==0.0.7
|
|
18
21
|
Provides-Extra: test
|
|
19
22
|
Requires-Dist: pytest; extra == "test"
|
|
20
23
|
Requires-Dist: pytest-cov; extra == "test"
|
|
21
24
|
Requires-Dist: pytest-sugar; extra == "test"
|
|
22
25
|
Requires-Dist: black; extra == "test"
|
|
23
26
|
Requires-Dist: mypy; extra == "test"
|
|
24
|
-
Provides-Extra: cairo
|
|
25
|
-
Requires-Dist: pycairo; extra == "cairo"
|
|
26
27
|
|
|
27
28
|
# icplot
|
|
28
29
|
|
|
29
30
|
This project is a utility library used at ICHEC for generating plots and graphics for use in technical documents.
|
|
30
31
|
|
|
32
|
+
# Installation #
|
|
33
|
+
|
|
34
|
+
The package is available on PyPI. For a minimal installation you can do:
|
|
35
|
+
|
|
36
|
+
``` shell
|
|
37
|
+
pip install icplot
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
For full functionality, particularly for conversion of image formats `imagemagick` and `cairo` are required. On Mac you can install them with:
|
|
41
|
+
|
|
42
|
+
``` shell
|
|
43
|
+
brew install imagemagick cairo
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
# Features #
|
|
47
|
+
|
|
48
|
+
The project has support for:
|
|
49
|
+
|
|
50
|
+
* Coverting image formats between pdf, svg and png
|
|
51
|
+
* Building pdf output from tex files, including tikz.
|
|
52
|
+
|
|
53
|
+
There is a command line interface included, mainly for testing, which may be heplful in getting to know available features.
|
|
54
|
+
|
|
55
|
+
To covert between image formats you can do:
|
|
56
|
+
|
|
57
|
+
``` shell
|
|
58
|
+
icplot convert --source my_image.svg --target my_image.png
|
|
59
|
+
```
|
|
60
|
+
|
|
31
61
|
# Copyright #
|
|
32
62
|
|
|
33
63
|
Copyright 2024 Irish Centre for High End Computing
|
icplot-0.0.4/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# icplot
|
|
2
|
+
|
|
3
|
+
This project is a utility library used at ICHEC for generating plots and graphics for use in technical documents.
|
|
4
|
+
|
|
5
|
+
# Installation #
|
|
6
|
+
|
|
7
|
+
The package is available on PyPI. For a minimal installation you can do:
|
|
8
|
+
|
|
9
|
+
``` shell
|
|
10
|
+
pip install icplot
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
For full functionality, particularly for conversion of image formats `imagemagick` and `cairo` are required. On Mac you can install them with:
|
|
14
|
+
|
|
15
|
+
``` shell
|
|
16
|
+
brew install imagemagick cairo
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
# Features #
|
|
20
|
+
|
|
21
|
+
The project has support for:
|
|
22
|
+
|
|
23
|
+
* Coverting image formats between pdf, svg and png
|
|
24
|
+
* Building pdf output from tex files, including tikz.
|
|
25
|
+
|
|
26
|
+
There is a command line interface included, mainly for testing, which may be heplful in getting to know available features.
|
|
27
|
+
|
|
28
|
+
To covert between image formats you can do:
|
|
29
|
+
|
|
30
|
+
``` shell
|
|
31
|
+
icplot convert --source my_image.svg --target my_image.png
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
# Copyright #
|
|
35
|
+
|
|
36
|
+
Copyright 2024 Irish Centre for High End Computing
|
|
37
|
+
|
|
38
|
+
The software in this repository can be used under the conditions of the GPLv3+ license, which is available for reading in the accompanying LICENSE file.
|
|
39
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "icplot"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.4"
|
|
4
4
|
authors = [
|
|
5
5
|
{ name="James Grogan, Irish Centre for High End Computing", email="james.grogan@ichec.ie" },
|
|
6
6
|
]
|
|
@@ -16,7 +16,10 @@ classifiers = [
|
|
|
16
16
|
]
|
|
17
17
|
keywords = ["Publishing", "Technical Reports", "Graphics"]
|
|
18
18
|
|
|
19
|
-
dependencies = ["wand"
|
|
19
|
+
dependencies = ["wand",
|
|
20
|
+
"pycairo",
|
|
21
|
+
"CairoSVG",
|
|
22
|
+
"iccore==0.0.7"]
|
|
20
23
|
|
|
21
24
|
[project.urls]
|
|
22
25
|
Repository = "https://git.ichec.ie/performance/toolshed/icplot"
|
|
@@ -31,12 +34,13 @@ test = [
|
|
|
31
34
|
"mypy"
|
|
32
35
|
]
|
|
33
36
|
|
|
34
|
-
cairo = ["pycairo"]
|
|
35
|
-
|
|
36
37
|
[build-system]
|
|
37
38
|
requires = ["setuptools>=61.0", "wheel"]
|
|
38
39
|
build-backend = "setuptools.build_meta"
|
|
39
40
|
|
|
41
|
+
[project.scripts]
|
|
42
|
+
icplot = "icplot.main_cli:main_cli"
|
|
43
|
+
|
|
40
44
|
[tool.setuptools.package-data]
|
|
41
45
|
"icplot" = ["py.typed"]
|
|
42
46
|
|
|
@@ -47,6 +51,7 @@ where = ["src"]
|
|
|
47
51
|
testpaths = ["test",]
|
|
48
52
|
log_cli = 1
|
|
49
53
|
log_cli_level = "debug"
|
|
54
|
+
addopts = "--cov=icplot --cov-report term --cov-report xml:coverage.xml --cov-report html"
|
|
50
55
|
|
|
51
56
|
[tool.mypy]
|
|
52
57
|
ignore_missing_imports = true
|
|
@@ -64,7 +69,7 @@ description = run unit tests
|
|
|
64
69
|
deps =
|
|
65
70
|
pytest>=7
|
|
66
71
|
pytest-sugar
|
|
67
|
-
|
|
72
|
+
pytest-cov
|
|
68
73
|
commands =
|
|
69
74
|
pytest {posargs:test}
|
|
70
75
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
from wand.image import Image
|
|
5
|
+
from wand.color import Color
|
|
6
|
+
|
|
7
|
+
import cairosvg
|
|
8
|
+
|
|
9
|
+
logger = logging.getLogger(__name__)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _get_out_filename(source: Path, target: Path | None, extension: str) -> Path:
|
|
13
|
+
if target:
|
|
14
|
+
return target
|
|
15
|
+
else:
|
|
16
|
+
return source.parent / f"{source.stem}.{extension}"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def pdf_to_png(source: Path, target: Path | None = None):
|
|
20
|
+
|
|
21
|
+
outfile = _get_out_filename(source, target, "png")
|
|
22
|
+
with Image(filename=source, resolution=300) as img:
|
|
23
|
+
img.format = "png"
|
|
24
|
+
img.background_color = Color("white")
|
|
25
|
+
img.alpha_channel = "remove"
|
|
26
|
+
img.save(filename=outfile)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def svg_to_png(source: Path, target: Path | None = None):
|
|
30
|
+
outfile = _get_out_filename(source, target, "png")
|
|
31
|
+
cairosvg.svg2png(url=str(source), write_to=str(outfile))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def svg_to_pdf(source: Path, target: Path | None = None):
|
|
35
|
+
outfile = _get_out_filename(source, target, "pdf")
|
|
36
|
+
cairosvg.svg2pdf(url=str(source), write_to=str(outfile))
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
import argparse
|
|
3
|
+
import logging
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
from iccore import logging_utils
|
|
7
|
+
from iccore import runtime
|
|
8
|
+
|
|
9
|
+
from icplot.image_utils import pdf_to_png, svg_to_png, svg_to_pdf
|
|
10
|
+
|
|
11
|
+
logger = logging.getLogger(__name__)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def launch_common(args):
|
|
15
|
+
runtime.ctx.set_is_dry_run(args.dry_run)
|
|
16
|
+
logging_utils.setup_default_logger()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def convert(args):
|
|
20
|
+
launch_common(args)
|
|
21
|
+
|
|
22
|
+
logger.info("Attempting coversion between %s %s", args.source, args.target)
|
|
23
|
+
|
|
24
|
+
if args.target:
|
|
25
|
+
target = Path(args.target).resolve()
|
|
26
|
+
else:
|
|
27
|
+
target = None
|
|
28
|
+
|
|
29
|
+
if args.source.suffix == ".pdf":
|
|
30
|
+
pdf_to_png(args.source.resolve(), target)
|
|
31
|
+
elif args.source.suffix == ".svg":
|
|
32
|
+
if target:
|
|
33
|
+
if target.suffix == ".png":
|
|
34
|
+
svg_to_png(args.source.resolve(), target)
|
|
35
|
+
elif target.suffix == ".pdf":
|
|
36
|
+
svg_to_pdf(args.source.resolve(), target)
|
|
37
|
+
else:
|
|
38
|
+
svg_to_png(args.source)
|
|
39
|
+
logger.info("Finished conversion")
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def main_cli():
|
|
43
|
+
parser = argparse.ArgumentParser()
|
|
44
|
+
parser.add_argument(
|
|
45
|
+
"--dry_run",
|
|
46
|
+
type=int,
|
|
47
|
+
default=0,
|
|
48
|
+
help="Dry run script - 0 can modify, 1 can read, 2 no modify - no read",
|
|
49
|
+
)
|
|
50
|
+
subparsers = parser.add_subparsers(required=True)
|
|
51
|
+
|
|
52
|
+
convert_parser = subparsers.add_parser("convert")
|
|
53
|
+
convert_parser.add_argument(
|
|
54
|
+
"--source",
|
|
55
|
+
type=Path,
|
|
56
|
+
help="Path to file to be converted from",
|
|
57
|
+
)
|
|
58
|
+
convert_parser.add_argument(
|
|
59
|
+
"--target",
|
|
60
|
+
type=str,
|
|
61
|
+
default="",
|
|
62
|
+
help="Path to file to be converted to",
|
|
63
|
+
)
|
|
64
|
+
convert_parser.set_defaults(func=convert)
|
|
65
|
+
|
|
66
|
+
args = parser.parse_args()
|
|
67
|
+
args.func(args)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
if __name__ == "__main__":
|
|
71
|
+
main_cli()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: icplot
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
4
4
|
Summary: Utilities for generating plots and graphics for technical reports.
|
|
5
5
|
Author-email: "James Grogan, Irish Centre for High End Computing" <james.grogan@ichec.ie>
|
|
6
6
|
Project-URL: Repository, https://git.ichec.ie/performance/toolshed/icplot
|
|
@@ -15,19 +15,49 @@ Requires-Python: >=3.8
|
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
License-File: LICENSE
|
|
17
17
|
Requires-Dist: wand
|
|
18
|
+
Requires-Dist: pycairo
|
|
19
|
+
Requires-Dist: CairoSVG
|
|
20
|
+
Requires-Dist: iccore==0.0.7
|
|
18
21
|
Provides-Extra: test
|
|
19
22
|
Requires-Dist: pytest; extra == "test"
|
|
20
23
|
Requires-Dist: pytest-cov; extra == "test"
|
|
21
24
|
Requires-Dist: pytest-sugar; extra == "test"
|
|
22
25
|
Requires-Dist: black; extra == "test"
|
|
23
26
|
Requires-Dist: mypy; extra == "test"
|
|
24
|
-
Provides-Extra: cairo
|
|
25
|
-
Requires-Dist: pycairo; extra == "cairo"
|
|
26
27
|
|
|
27
28
|
# icplot
|
|
28
29
|
|
|
29
30
|
This project is a utility library used at ICHEC for generating plots and graphics for use in technical documents.
|
|
30
31
|
|
|
32
|
+
# Installation #
|
|
33
|
+
|
|
34
|
+
The package is available on PyPI. For a minimal installation you can do:
|
|
35
|
+
|
|
36
|
+
``` shell
|
|
37
|
+
pip install icplot
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
For full functionality, particularly for conversion of image formats `imagemagick` and `cairo` are required. On Mac you can install them with:
|
|
41
|
+
|
|
42
|
+
``` shell
|
|
43
|
+
brew install imagemagick cairo
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
# Features #
|
|
47
|
+
|
|
48
|
+
The project has support for:
|
|
49
|
+
|
|
50
|
+
* Coverting image formats between pdf, svg and png
|
|
51
|
+
* Building pdf output from tex files, including tikz.
|
|
52
|
+
|
|
53
|
+
There is a command line interface included, mainly for testing, which may be heplful in getting to know available features.
|
|
54
|
+
|
|
55
|
+
To covert between image formats you can do:
|
|
56
|
+
|
|
57
|
+
``` shell
|
|
58
|
+
icplot convert --source my_image.svg --target my_image.png
|
|
59
|
+
```
|
|
60
|
+
|
|
31
61
|
# Copyright #
|
|
32
62
|
|
|
33
63
|
Copyright 2024 Irish Centre for High End Computing
|
|
@@ -7,13 +7,16 @@ src/icplot/cairo_interface.py
|
|
|
7
7
|
src/icplot/gantt.py
|
|
8
8
|
src/icplot/geometry.py
|
|
9
9
|
src/icplot/image_utils.py
|
|
10
|
+
src/icplot/main_cli.py
|
|
10
11
|
src/icplot/project_elements.py
|
|
11
12
|
src/icplot/tex_interface.py
|
|
12
13
|
src/icplot.egg-info/PKG-INFO
|
|
13
14
|
src/icplot.egg-info/SOURCES.txt
|
|
14
15
|
src/icplot.egg-info/dependency_links.txt
|
|
16
|
+
src/icplot.egg-info/entry_points.txt
|
|
15
17
|
src/icplot.egg-info/requires.txt
|
|
16
18
|
src/icplot.egg-info/top_level.txt
|
|
17
19
|
test/test_cairo_interface.py
|
|
18
20
|
test/test_gantt_chart.py
|
|
21
|
+
test/test_image_utils.py
|
|
19
22
|
test/test_tex_interface.py
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
from icplot.image_utils import svg_to_png, svg_to_pdf
|
|
5
|
+
|
|
6
|
+
def get_test_data_dir():
|
|
7
|
+
return Path(__file__).parent / "data"
|
|
8
|
+
|
|
9
|
+
def test_convert_svg():
|
|
10
|
+
|
|
11
|
+
source = get_test_data_dir() / "test.svg"
|
|
12
|
+
|
|
13
|
+
png_out = Path(os.getcwd()) / "out.png"
|
|
14
|
+
svg_to_png(source, png_out)
|
|
15
|
+
png_out.unlink()
|
|
16
|
+
|
|
17
|
+
pdf_out = Path(os.getcwd()) / "out.pdf"
|
|
18
|
+
svg_to_pdf(source, pdf_out)
|
|
19
|
+
pdf_out.unlink()
|
|
20
|
+
|
|
21
|
+
|
icplot-0.0.3/README.md
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# icplot
|
|
2
|
-
|
|
3
|
-
This project is a utility library used at ICHEC for generating plots and graphics for use in technical documents.
|
|
4
|
-
|
|
5
|
-
# Copyright #
|
|
6
|
-
|
|
7
|
-
Copyright 2024 Irish Centre for High End Computing
|
|
8
|
-
|
|
9
|
-
The software in this repository can be used under the conditions of the GPLv3+ license, which is available for reading in the accompanying LICENSE file.
|
|
10
|
-
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
|
|
4
|
-
from wand.image import Image
|
|
5
|
-
from wand.color import Color
|
|
6
|
-
|
|
7
|
-
logger = logging.getLogger(__name__)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def pdf_to_png(source_path: Path):
|
|
11
|
-
png_filename = source_path.parent / f"{source_path.stem}.png"
|
|
12
|
-
with Image(filename=source_path, resolution=300) as img:
|
|
13
|
-
img.format = "png"
|
|
14
|
-
img.background_color = Color("white")
|
|
15
|
-
img.alpha_channel = "remove"
|
|
16
|
-
img.save(filename=png_filename)
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import json
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class GitlabUser:
|
|
5
|
-
|
|
6
|
-
def __init__(self):
|
|
7
|
-
self.name = ""
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class Issue:
|
|
11
|
-
|
|
12
|
-
def __init__(self):
|
|
13
|
-
self.title = ""
|
|
14
|
-
self.description = ""
|
|
15
|
-
self.start_date = ""
|
|
16
|
-
self.due_date = ""
|
|
17
|
-
self.assignee = None
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class Milestone:
|
|
21
|
-
|
|
22
|
-
def __init__(self, json_input=None):
|
|
23
|
-
self.title = ""
|
|
24
|
-
self.description = ""
|
|
25
|
-
self.start_date = None
|
|
26
|
-
self.due_date = None
|
|
27
|
-
self.issues = []
|
|
28
|
-
|
|
29
|
-
if json_input:
|
|
30
|
-
self.load(json_input)
|
|
31
|
-
|
|
32
|
-
def load(self, json):
|
|
33
|
-
self.title = json["title"]
|
|
34
|
-
self.description = json["description"]
|
|
35
|
-
self.start_date = json["start_date"]
|
|
36
|
-
self.due_date = json["due_date"]
|
|
37
|
-
|
|
38
|
-
def serialize(self):
|
|
39
|
-
return {
|
|
40
|
-
"title": self.title,
|
|
41
|
-
"description": self.description,
|
|
42
|
-
"start_date": self.start_date,
|
|
43
|
-
"due_date": self.due_date,
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
def __str__(self):
|
|
47
|
-
return json.dumps(self.serialize())
|
|
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
|