Skip to content

Commit 17668aa

Browse files
committed
ci: update definition
1 parent cabe902 commit 17668aa

10 files changed

Lines changed: 146 additions & 94 deletions

File tree

.commitlintrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: ["@commitlint/config-conventional"],
3+
};

.github/workflows/ci.yml

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,31 @@ on:
77
branches: [main]
88

99
jobs:
10+
pre-commit:
11+
runs-on: ubuntu-latest
12+
env:
13+
UV_PYTHON: "3.12"
14+
steps:
15+
- uses: actions/checkout@v6
16+
- name: Install uv
17+
uses: astral-sh/setup-uv@v6
18+
with:
19+
version: "0.8.12"
20+
enable-cache: true
21+
- name: Install the project
22+
run: uv sync --all-extras --dev
23+
24+
# Install and run pre-commit
25+
- run: |
26+
uv run pre-commit install
27+
uv run pre-commit install --hook-type commit-msg
28+
uv run pre-commit run --all-files
29+
1030
test:
31+
needs: [pre-commit]
1132
runs-on: ubuntu-latest
1233
strategy:
34+
fail-fast: false
1335
matrix:
1436
python-version: ["3.10", "3.11", "3.12", "3.13"]
1537
steps:
@@ -26,11 +48,35 @@ jobs:
2648
- name: Install dependencies
2749
run: uv pip install -e ".[dev]" --system
2850

29-
- name: Lint
30-
run: uv run ruff check .
31-
32-
- name: Format check
33-
run: uv run ruff format --check .
34-
3551
- name: Test
3652
run: uv run pytest tests/ -v
53+
54+
release:
55+
needs: [pre-commit, test]
56+
runs-on: ubuntu-latest
57+
environment: release
58+
permissions:
59+
id-token: write # IMPORTANT: mandatory for trusted publishing
60+
contents: write # IMPORTANT: mandatory for making GitHub Releases
61+
62+
steps:
63+
- name: Checkout
64+
uses: actions/checkout@v6
65+
with:
66+
fetch-depth: 0
67+
68+
- name: Python Semantic Release
69+
id: release
70+
uses: python-semantic-release/python-semantic-release@v10.5.3
71+
with:
72+
github_token: ${{ secrets.GITHUB_TOKEN }}
73+
74+
- name: Generate artifact attestation for sdist and wheel
75+
if: steps.release.outputs.released == 'true'
76+
uses: actions/attest-build-provenance@v4.1.0
77+
with:
78+
subject-path: "dist/*"
79+
80+
# https://docs.pypi.org/trusted-publishers/using-a-publisher/
81+
- uses: pypa/gh-action-pypi-publish@release/v1
82+
if: steps.release.outputs.released == 'true'

.github/workflows/publish.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ build/
77
*.egg
88
.ruff_cache/
99
uv.lock
10+
.DS_Store

.pre-commit-config.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,16 @@ repos:
4040
- id: codespell
4141

4242
- repo: https://github.com/abravalheri/validate-pyproject
43-
rev: "v0.23"
43+
rev: "v0.25"
4444
hooks:
4545
- id: validate-pyproject
46-
additional_dependencies: ["validate-pyproject-schema-store[all]"]
46+
additional_dependencies:
47+
- validate-pyproject[all]
48+
- validate-pyproject-schema-store
49+
50+
- repo: https://github.com/python-jsonschema/check-jsonschema
51+
rev: "0.31.0"
52+
hooks:
53+
- id: check-dependabot
54+
- id: check-github-workflows
55+
- id: check-readthedocs

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CHANGELOG.md

CONTRIBUTING.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
===============================
2+
Contributing to trame-colormaps
3+
===============================
4+
5+
#. Clone the repository using ``git clone``
6+
#. Install pre-commit via ``pip install pre-commit``
7+
#. Run ``pre-commit install`` to set up pre-commit hooks
8+
#. Run ``pre-commit install --hook-type commit-msg`` to register commit-msg hook
9+
#. Make changes to the code, and commit your changes to a separate branch
10+
#. Create a fork of the repository on GitHub
11+
#. Push your branch to your fork, and open a pull request
12+
13+
Tips
14+
####
15+
16+
#. When first creating a new project, it is helpful to run ``pre-commit run --all-files`` to ensure all files pass the pre-commit checks.
17+
#. A quick way to fix ``ruff`` issues is by installing ruff (``pip install ".[dev]"``) and running the ``ruff check --fix`` command at the root of your repository.
18+
#. A quick way to fix ``codespell`` issues is by installing codespell (``pip install codespell``) and running the ``codespell -w`` command at the root of your directory.
19+
#. The `.codespellrc file <https://github.com/codespell-project/codespell#using-a-config-file>`_ can be used fix any other codespell issues, such as ignoring certain files, directories, words, or regular expressions.

LICENSE

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,15 @@
1-
BSD 3-Clause License
1+
Apache Software License 2.0
22

3-
Copyright (c) 2025, Kitware Inc.
3+
Copyright (c) 2026, Kitware Inc.
44

5-
Redistribution and use in source and binary forms, with or without
6-
modification, are permitted provided that the following conditions are met:
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
78

8-
1. Redistributions of source code must retain the above copyright notice, this
9-
list of conditions and the following disclaimer.
9+
http://www.apache.org/licenses/LICENSE-2.0
1010

11-
2. Redistributions in binary form must reproduce the above copyright notice,
12-
this list of conditions and the following disclaimer in the documentation
13-
and/or other materials provided with the distribution.
14-
15-
3. Neither the name of the copyright holder nor the names of its
16-
contributors may be used to endorse or promote products derived from
17-
this software without specific prior written permission.
18-
19-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,37 @@ uv add trame-colormaps
1818
## Development
1919

2020
```bash
21+
# Get code
2122
git clone https://github.com/Kitware/trame-colormaps.git
2223
cd trame-colormaps
23-
uv pip install -e ".[dev]"
24+
25+
# Create venv and install all dependencies
26+
uv sync --all-extras --dev
27+
28+
# Activate environment
29+
source .venv/bin/activate
30+
31+
# Install commit analysis
2432
pre-commit install
33+
pre-commit install --hook-type commit-msg
2534
```
2635

2736
Run tests:
2837

2938
```bash
30-
uv run pytest
39+
pytest
3140
```
3241

3342
Run the example app:
3443

3544
```bash
36-
uv run python examples/wavelet.py
45+
python ./examples/wavelet.py
3746
```
3847

3948
Lint and format:
4049

4150
```bash
42-
uv run ruff check .
43-
uv run ruff format .
51+
pre-commit run --all-files
4452
```
4553

4654
### Releasing

pyproject.toml

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
[build-system]
2-
requires = ["setuptools>=64", "setuptools-scm>=8"]
3-
build-backend = "setuptools.build_meta"
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
44

55
[project]
66
name = "trame-colormaps"
77
version = "1.0.0"
88
description = "Self-contained colormap module for VTK color transfer functions in Trame apps"
99
readme = "README.md"
10-
license = {text = "BSD-3-Clause"}
10+
license = {text = "Apache Software License"}
1111
requires-python = ">=3.10"
1212
authors = [
1313
{name = "Kitware, Inc.", email = "trame@kitware.com"},
1414
]
1515
keywords = ["trame", "vtk", "colormap", "scientific-visualization"]
1616
classifiers = [
17-
"Development Status :: 4 - Beta",
17+
"Development Status :: 5 - Production/Stable",
1818
"Environment :: Web Environment",
1919
"Intended Audience :: Science/Research",
20-
"License :: OSI Approved :: BSD License",
20+
"License :: OSI Approved :: Apache Software License",
2121
"Operating System :: OS Independent",
2222
"Programming Language :: Python :: 3",
2323
"Programming Language :: Python :: 3.10",
@@ -41,24 +41,30 @@ Issues = "https://github.com/Kitware/trame-colormaps/issues"
4141

4242
[project.optional-dependencies]
4343
dev = [
44-
"build",
4544
"pre-commit",
4645
"pytest",
4746
"ruff",
48-
"twine",
4947
]
5048

5149
[tool.pytest.ini_options]
5250
testpaths = ["tests"]
5351

54-
[tool.setuptools.packages.find]
55-
where = ["src"]
5652

57-
[tool.setuptools.package-data]
58-
trame_colormaps = ["presets/*.json"]
53+
[tool.hatch.build]
54+
include = [
55+
"/src/**/*.py",
56+
"/src/trame_colormaps/**/*.css",
57+
"/src/trame_colormaps/**/*.json",
58+
]
59+
60+
[tool.hatch.build.targets.wheel]
61+
packages = [
62+
"src/trame",
63+
"src/trame_colormaps",
64+
]
5965

6066
[tool.ruff]
61-
line-length = 88
67+
line-length = 96
6268

6369
[tool.ruff.lint]
6470
select = ["E", "F", "I", "W"]
@@ -70,3 +76,20 @@ select = ["E", "F", "I", "W"]
7076

7177
[tool.codespell]
7278
ignore-words-list = "buda,te,nd"
79+
80+
[tool.semantic_release]
81+
version_toml = [
82+
"pyproject.toml:project.version",
83+
]
84+
version_variables = [
85+
"src/trame_colormaps/__init__.py:__version__",
86+
]
87+
88+
build_command = """
89+
python -m pip install uv
90+
uv build
91+
"""
92+
93+
[tool.semantic_release.publish]
94+
dist_glob_patterns = ["dist/*"]
95+
upload_to_vcs_release = true

0 commit comments

Comments
 (0)