palettize 0.0.1a1__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 (30) hide show
  1. palettize-0.0.1a1/.github/workflows/release.yml +19 -0
  2. palettize-0.0.1a1/.github/workflows/testindex.yml +19 -0
  3. palettize-0.0.1a1/.gitignore +14 -0
  4. palettize-0.0.1a1/CHANGELOG.md +0 -0
  5. palettize-0.0.1a1/LICENSE +7 -0
  6. palettize-0.0.1a1/PKG-INFO +136 -0
  7. palettize-0.0.1a1/README.md +104 -0
  8. palettize-0.0.1a1/pyproject.toml +75 -0
  9. palettize-0.0.1a1/setup.cfg +4 -0
  10. palettize-0.0.1a1/src/palettize/__init__.py +7 -0
  11. palettize-0.0.1a1/src/palettize/cli.py +536 -0
  12. palettize-0.0.1a1/src/palettize/core.py +363 -0
  13. palettize-0.0.1a1/src/palettize/exceptions.py +19 -0
  14. palettize-0.0.1a1/src/palettize/exporters/__init__.py +187 -0
  15. palettize-0.0.1a1/src/palettize/exporters/_base.py +66 -0
  16. palettize-0.0.1a1/src/palettize/exporters/gdal.py +165 -0
  17. palettize-0.0.1a1/src/palettize/exporters/mapgl.py +51 -0
  18. palettize-0.0.1a1/src/palettize/exporters/observable_plot.py +102 -0
  19. palettize-0.0.1a1/src/palettize/exporters/qgis.py +372 -0
  20. palettize-0.0.1a1/src/palettize/exporters/sld.py +421 -0
  21. palettize-0.0.1a1/src/palettize/exporters/titiler.py +162 -0
  22. palettize-0.0.1a1/src/palettize/presets.py +167 -0
  23. palettize-0.0.1a1/src/palettize/py.typed +0 -0
  24. palettize-0.0.1a1/src/palettize/scaling.py +382 -0
  25. palettize-0.0.1a1/src/palettize.egg-info/PKG-INFO +136 -0
  26. palettize-0.0.1a1/src/palettize.egg-info/SOURCES.txt +28 -0
  27. palettize-0.0.1a1/src/palettize.egg-info/dependency_links.txt +1 -0
  28. palettize-0.0.1a1/src/palettize.egg-info/entry_points.txt +2 -0
  29. palettize-0.0.1a1/src/palettize.egg-info/requires.txt +11 -0
  30. palettize-0.0.1a1/src/palettize.egg-info/top_level.txt +1 -0
@@ -0,0 +1,19 @@
1
+ name: Release to PyPI
2
+ on:
3
+ push:
4
+ tags: ['v*']
5
+ permissions:
6
+ contents: read
7
+ id-token: write
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+ environment: pypi
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+
15
+ - uses: astral-sh/setup-uv@v5
16
+ - run: uv build
17
+
18
+ - name: Publish to PyPI
19
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,19 @@
1
+ name: Test release on TestPyPI
2
+ on:
3
+ push:
4
+ tags: ['test*']
5
+ permissions:
6
+ contents: read
7
+ id-token: write
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+ environment: testpypi
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+
15
+ - uses: astral-sh/setup-uv@v5
16
+ - run: uv build
17
+
18
+ - name: Publish to PyPI
19
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,14 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+ .ruff_cache/
12
+ .cursor
13
+ /project_docs/
14
+ .DS_Store
File without changes
@@ -0,0 +1,7 @@
1
+ Copyright 2025 Alex Kovac
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,136 @@
1
+ Metadata-Version: 2.4
2
+ Name: palettize
3
+ Version: 0.0.1a1
4
+ Summary: A Python CLI tool for creating and exporting colormaps for data visualization and mapping applications.
5
+ Author-email: Alex Kovac <5686693+kovaca@users.noreply.github.com>
6
+ License-Expression: MIT
7
+ Classifier: Development Status :: 2 - Pre-Alpha
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: Intended Audience :: Science/Research
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.9
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Topic :: Multimedia :: Graphics
17
+ Classifier: Topic :: Scientific/Engineering :: Visualization
18
+ Requires-Python: >=3.9
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: coloraide>=0.24
22
+ Requires-Dist: typer>=0.9
23
+ Requires-Dist: rich>=13.0
24
+ Requires-Dist: webcolors>=1.13
25
+ Requires-Dist: cmap>=0.6.0
26
+ Provides-Extra: dev
27
+ Requires-Dist: pytest>=8.3.5; extra == "dev"
28
+ Requires-Dist: pytest-cov>=6.1.1; extra == "dev"
29
+ Requires-Dist: ruff; extra == "dev"
30
+ Requires-Dist: mypy; extra == "dev"
31
+ Dynamic: license-file
32
+
33
+ # Palettize
34
+
35
+ 🎨 A Python utility and CLI tool for generating, previewing, and exporting color maps.
36
+
37
+ Palettize helps you create and manage colormaps for data visualization, GIS, and web mapping. It provides a simple, powerful command-line interface to:
38
+
39
+ - Generate colormaps from a list of colors or from built-in presets.
40
+ - Instantly preview colormaps directly in your terminal.
41
+ - Export colormaps to various formats suitable for different applications.
42
+ - Customize interpolation color space, data scaling, and slicing.
43
+
44
+ ## Installation
45
+
46
+ This project uses `uv` for dependency management. To install from source:
47
+
48
+ ```bash
49
+ git clone https://github.com/your-username/palettize.git # Replace with actual repo URL
50
+ cd palettize
51
+ uv pip install .
52
+ ```
53
+
54
+ For development, install with the `dev` dependencies:
55
+
56
+ ```bash
57
+ uv pip install -e .[dev]
58
+ ```
59
+
60
+ ## Usage
61
+
62
+ Palettize is built on a simple `verb-noun` philosophy. You use a command like `show` or `create` and tell it what to operate on—either a `preset` name or a list of custom `--colors`.
63
+
64
+ ```bash
65
+ palettize --help
66
+ ```
67
+
68
+ ### Key Commands
69
+
70
+ - **`palettize show`**: Render a colormap preview in your terminal.
71
+ - **`palettize create`**: Export a colormap to one or more file formats.
72
+ - **`palettize list`**: List available `presets` or `exporters`.
73
+
74
+ ### Examples
75
+
76
+ 1. **Show a built-in preset colormap:**
77
+ ```bash
78
+ palettize show viridis
79
+ ```
80
+
81
+ 2. **Show a custom gradient made of three colors:**
82
+ ```bash
83
+ palettize show --colors "midnightblue,orange,gold"
84
+ ```
85
+
86
+ 3. **Export the 'spectral' preset to a GDAL color ramp file:**
87
+ The `--domain` flag maps the colormap to your data's range.
88
+ ```bash
89
+ palettize create spectral --format gdal --output spectral_gdal.txt --domain 0,255
90
+ ```
91
+
92
+ 4. **Create a custom colormap and export it to multiple formats:**
93
+ Use `--steps` to define the number of discrete colors in the output.
94
+ ```bash
95
+ palettize create -c "blue,white,red" --format qgis,mapgl \
96
+ --output "output/rwb_{format}.{ext}" --steps 11 --name "RedWhiteBlue"
97
+ ```
98
+ This creates `output/rwb_qgis.xml` and `output/rwb_mapgl.json`.
99
+
100
+ 5. **List all available built-in presets:**
101
+ ```bash
102
+ palettize list presets
103
+ ```
104
+
105
+ 6. **Pass format-specific options during export:**
106
+ Use the `-O` or `--option` flag to pass key-value pairs to an exporter.
107
+ ```bash
108
+ # Tell the 'observable' exporter to create a diverging scale with a pivot
109
+ palettize create RdBu -f observable -o plot.json \
110
+ -O type=diverging -O pivot=0
111
+ ```
112
+
113
+ ## Features
114
+
115
+ - **Flexible Colormap Creation**: Generate colormaps from lists of colors (hex, RGB, named) or use built-in presets.
116
+ - **Advanced Interpolation**: Supports various color spaces for interpolation via the ColorAide library (e.g., Oklch, sRGB, LAB).
117
+ - **Terminal Preview**: Instantly visualize any colormap in your terminal.
118
+ - **Multiple Export Formats**: Supports common formats for GIS (GDAL, QGIS, SLD, Titiler) and web (MapLibre GL, Observable Plot).
119
+ - **Customizable Scaling**: Apply linear, power, sqrt, or log scaling to map your data domain to the colormap.
120
+ - **Plugin System for Exporters**: Easily extendable with new export formats.
121
+ - **CLI with Rich Output**: User-friendly command-line interface with clear help messages and rich formatting.
122
+
123
+ ## Available Presets
124
+
125
+ The incredibly useful `cmap` library is a core dependency used for presets. To see a list of colormap presets, run:
126
+ `palettize list presets`
127
+
128
+
129
+
130
+ ## Available Export Formats
131
+
132
+ To see a list of all currently registered and available export formats, run:
133
+ `palettize list exporters`
134
+
135
+
136
+
@@ -0,0 +1,104 @@
1
+ # Palettize
2
+
3
+ 🎨 A Python utility and CLI tool for generating, previewing, and exporting color maps.
4
+
5
+ Palettize helps you create and manage colormaps for data visualization, GIS, and web mapping. It provides a simple, powerful command-line interface to:
6
+
7
+ - Generate colormaps from a list of colors or from built-in presets.
8
+ - Instantly preview colormaps directly in your terminal.
9
+ - Export colormaps to various formats suitable for different applications.
10
+ - Customize interpolation color space, data scaling, and slicing.
11
+
12
+ ## Installation
13
+
14
+ This project uses `uv` for dependency management. To install from source:
15
+
16
+ ```bash
17
+ git clone https://github.com/your-username/palettize.git # Replace with actual repo URL
18
+ cd palettize
19
+ uv pip install .
20
+ ```
21
+
22
+ For development, install with the `dev` dependencies:
23
+
24
+ ```bash
25
+ uv pip install -e .[dev]
26
+ ```
27
+
28
+ ## Usage
29
+
30
+ Palettize is built on a simple `verb-noun` philosophy. You use a command like `show` or `create` and tell it what to operate on—either a `preset` name or a list of custom `--colors`.
31
+
32
+ ```bash
33
+ palettize --help
34
+ ```
35
+
36
+ ### Key Commands
37
+
38
+ - **`palettize show`**: Render a colormap preview in your terminal.
39
+ - **`palettize create`**: Export a colormap to one or more file formats.
40
+ - **`palettize list`**: List available `presets` or `exporters`.
41
+
42
+ ### Examples
43
+
44
+ 1. **Show a built-in preset colormap:**
45
+ ```bash
46
+ palettize show viridis
47
+ ```
48
+
49
+ 2. **Show a custom gradient made of three colors:**
50
+ ```bash
51
+ palettize show --colors "midnightblue,orange,gold"
52
+ ```
53
+
54
+ 3. **Export the 'spectral' preset to a GDAL color ramp file:**
55
+ The `--domain` flag maps the colormap to your data's range.
56
+ ```bash
57
+ palettize create spectral --format gdal --output spectral_gdal.txt --domain 0,255
58
+ ```
59
+
60
+ 4. **Create a custom colormap and export it to multiple formats:**
61
+ Use `--steps` to define the number of discrete colors in the output.
62
+ ```bash
63
+ palettize create -c "blue,white,red" --format qgis,mapgl \
64
+ --output "output/rwb_{format}.{ext}" --steps 11 --name "RedWhiteBlue"
65
+ ```
66
+ This creates `output/rwb_qgis.xml` and `output/rwb_mapgl.json`.
67
+
68
+ 5. **List all available built-in presets:**
69
+ ```bash
70
+ palettize list presets
71
+ ```
72
+
73
+ 6. **Pass format-specific options during export:**
74
+ Use the `-O` or `--option` flag to pass key-value pairs to an exporter.
75
+ ```bash
76
+ # Tell the 'observable' exporter to create a diverging scale with a pivot
77
+ palettize create RdBu -f observable -o plot.json \
78
+ -O type=diverging -O pivot=0
79
+ ```
80
+
81
+ ## Features
82
+
83
+ - **Flexible Colormap Creation**: Generate colormaps from lists of colors (hex, RGB, named) or use built-in presets.
84
+ - **Advanced Interpolation**: Supports various color spaces for interpolation via the ColorAide library (e.g., Oklch, sRGB, LAB).
85
+ - **Terminal Preview**: Instantly visualize any colormap in your terminal.
86
+ - **Multiple Export Formats**: Supports common formats for GIS (GDAL, QGIS, SLD, Titiler) and web (MapLibre GL, Observable Plot).
87
+ - **Customizable Scaling**: Apply linear, power, sqrt, or log scaling to map your data domain to the colormap.
88
+ - **Plugin System for Exporters**: Easily extendable with new export formats.
89
+ - **CLI with Rich Output**: User-friendly command-line interface with clear help messages and rich formatting.
90
+
91
+ ## Available Presets
92
+
93
+ The incredibly useful `cmap` library is a core dependency used for presets. To see a list of colormap presets, run:
94
+ `palettize list presets`
95
+
96
+
97
+
98
+ ## Available Export Formats
99
+
100
+ To see a list of all currently registered and available export formats, run:
101
+ `palettize list exporters`
102
+
103
+
104
+
@@ -0,0 +1,75 @@
1
+ [project]
2
+ name = "palettize"
3
+ dynamic = ["version"]
4
+ description = "A Python CLI tool for creating and exporting colormaps for data visualization and mapping applications."
5
+ authors = [
6
+ { name = "Alex Kovac", email = "5686693+kovaca@users.noreply.github.com" }
7
+ ]
8
+ license = "MIT"
9
+ readme = {file = "README.md", content-type = "text/markdown"}
10
+ requires-python = ">=3.9"
11
+ classifiers = [
12
+ "Development Status :: 2 - Pre-Alpha",
13
+ "Intended Audience :: Developers",
14
+ "Intended Audience :: Science/Research",
15
+ "Programming Language :: Python :: 3",
16
+ "Programming Language :: Python :: 3.9",
17
+ "Programming Language :: Python :: 3.10",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ "Topic :: Multimedia :: Graphics",
22
+ "Topic :: Scientific/Engineering :: Visualization",
23
+ ]
24
+
25
+ dependencies = [
26
+ "coloraide>=0.24",
27
+ "typer>=0.9",
28
+ "rich>=13.0",
29
+ "webcolors>=1.13",
30
+ "cmap>=0.6.0",
31
+ ]
32
+
33
+ [project.optional-dependencies]
34
+ dev = [
35
+ "pytest>=8.3.5",
36
+ "pytest-cov>=6.1.1",
37
+ "ruff",
38
+ "mypy",
39
+ ]
40
+
41
+ [project.scripts]
42
+ palettize = "palettize.cli:app"
43
+
44
+
45
+ [build-system]
46
+ requires = ["setuptools>=64", "setuptools_scm>=8", "wheel"]
47
+ build-backend = "setuptools.build_meta"
48
+ backend-path = "."
49
+
50
+ [tool.setuptools.packages.find]
51
+ where = ["src"]
52
+
53
+ [tool.setuptools.package-data]
54
+ palettize = ["py.typed"]
55
+
56
+ [tool.setuptools_scm]
57
+ local_scheme = "no-local-version"
58
+
59
+ [tool.pytest.ini_options]
60
+ testpaths = [
61
+ "tests",
62
+ ]
63
+ python_files = "test_*.py tests_*.py *_test.py *_tests.py"
64
+ python_classes = "*Test* *Tests Test*"
65
+ python_functions = "test_* *test"
66
+ addopts = "--cov=src/palettize --cov-report=term-missing --cov-report=xml"
67
+
68
+ # [[tool.uv.index]]
69
+ # name = "testpypi"
70
+ # url = "https://test.pypi.org/simple/"
71
+ # publish-url = "https://test.pypi.org/legacy/"
72
+ # explicit = true
73
+
74
+ [tool.uv]
75
+ cache-keys = [{ file = "pyproject.toml" }, { git = { commit = true, tags = true } }]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,7 @@
1
+ """Palettize: Python utility and CLI tool for generating and exporting color map objects."""
2
+
3
+ __version__ = "0.0.1.dev0" # Initial development version
4
+
5
+
6
+ def hello() -> str:
7
+ return "Hello from palettize!"