Skip to content

Commit a4713c5

Browse files
committed
fix(ci): use pyproject and ruff
1 parent b059be0 commit a4713c5

File tree

11 files changed

+135
-70
lines changed

11 files changed

+135
-70
lines changed

.github/workflows/test_and_release.yml

+28-14
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ jobs:
1010
pre-commit:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v4
1414

15-
- uses: actions/setup-python@v2
15+
- uses: actions/setup-python@v5
1616
with:
1717
python-version: "3.9"
1818

@@ -28,7 +28,7 @@ jobs:
2828
strategy:
2929
fail-fast: false
3030
matrix:
31-
python-version: [3.9]
31+
python-version: ["3.9"]
3232
config:
3333
- {
3434
name: "Linux",
@@ -49,17 +49,22 @@ jobs:
4949

5050
steps:
5151
- name: Checkout
52-
uses: actions/checkout@v2
52+
uses: actions/checkout@v4
5353

5454
- name: Set up Python ${{ matrix.python-version }}
55-
uses: actions/setup-python@v2
55+
uses: actions/setup-python@v5
5656
with:
5757
python-version: ${{ matrix.python-version }}
5858

5959
- name: Install OSMesa for Linux
6060
if: matrix.config.os == 'ubuntu-latest'
6161
run: sudo apt-get install -y libosmesa6-dev
6262

63+
- name: Set Up Node
64+
uses: actions/setup-node@v4
65+
with:
66+
node-version: 18
67+
6368
- name: Build Vue Components
6469
run: |
6570
cd vue-components
@@ -79,12 +84,12 @@ jobs:
7984

8085
steps:
8186
- name: Checkout
82-
uses: actions/checkout@v2
87+
uses: actions/checkout@v4
8388

8489
- name: Set Up Node
85-
uses: actions/setup-node@v3
90+
uses: actions/setup-node@v4
8691
with:
87-
node-version: 14
92+
node-version: 18
8893

8994
- name: Build Vue Components
9095
run: |
@@ -100,17 +105,23 @@ jobs:
100105
]
101106
runs-on: ubuntu-latest
102107
if: github.event_name == 'push'
108+
environment:
109+
name: pypi
110+
url: https://pypi.org/p/trame-rca
111+
permissions:
112+
id-token: write # IMPORTANT: mandatory for trusted publishing
113+
contents: write # IMPORTANT: mandatory for making GitHub Releases
103114

104115
steps:
105116
- name: Checkout
106-
uses: actions/checkout@v2
117+
uses: actions/checkout@v4
107118
with:
108119
fetch-depth: 0
109120

110121
- name: Set Up Node
111-
uses: actions/setup-node@v3
122+
uses: actions/setup-node@v4
112123
with:
113-
node-version: 14
124+
node-version: 18
114125

115126
- name: Build Vue Components
116127
run: |
@@ -119,8 +130,11 @@ jobs:
119130
npm run build
120131
121132
- name: Python Semantic Release
122-
uses: relekang/[email protected]
133+
id: release
134+
uses: relekang/[email protected]
123135
with:
124136
github_token: ${{ secrets.GITHUB_TOKEN }}
125-
repository_username: __token__
126-
repository_password: ${{ secrets.PYPI_API_TOKEN }}
137+
138+
- name: Publish package distributions to PyPI
139+
if: steps.release.outputs.released == 'true'
140+
uses: pypa/gh-action-pypi-publish@release/v1

.pre-commit-config.yaml

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
repos:
2-
- repo: https://github.com/psf/black
3-
rev: 22.3.0
4-
hooks:
5-
- id: black
6-
entry: black --check
7-
82
- repo: https://github.com/codespell-project/codespell
93
rev: v2.1.0
104
hooks:
115
- id: codespell
126

13-
- repo: https://github.com/PyCQA/flake8
14-
rev: 4.0.1
7+
- repo: https://github.com/astral-sh/ruff-pre-commit
8+
rev: v0.8.4
159
hooks:
16-
- id: flake8
10+
- id: ruff
11+
- id: ruff-format

CONTRIBUTING.rst

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
=========================
1+
==========================================
22
Contributing to trame-rca
3-
=========================
3+
==========================================
44

55
#. Clone the repository using ``git clone``
66
#. Install pre-commit via ``pip install pre-commit``
@@ -13,7 +13,6 @@ Tips
1313
####
1414

1515
#. 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.
16-
#. A quick way to fix ``black`` issues is by installing black (``pip install black``) and running the ``black`` command at the root of your repository.
17-
#. Sometimes, ``black`` and ``flake8`` do not agree. Add options to your ``.flake8`` file to fix these things. See the `flake8 configuration docs <https://flake8.pycqa.org/en/latest/user/configuration.html>`_ for more details.
16+
#. A quick way to fix ``ruff`` issues is by installing ruff (``pip install ruff``) and running the ``ruff check --fix .`` or ``ruff format`` command at the root of your repository.
1817
#. 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.
18+
#. 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.

MANIFEST.in

+4
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
graft trame_rca/module/serve
2+
prune examples
3+
prune js-lib
4+
prune tests
5+
prune vue-components

pyproject.toml

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
[project]
2+
name = "trame-rca"
3+
version = "0.7.0"
4+
description = "Remote Controlled Area widget for trame"
5+
authors = [
6+
{name = "Kitware Inc."},
7+
]
8+
dependencies = [
9+
"trame-client>=3.4,<4",
10+
"wslink>=2.1.3",
11+
]
12+
requires-python = ">=3.9"
13+
readme = "README.rst"
14+
license = {text = "Apache License 2.0"}
15+
keywords = ["Python", "Interactive", "Web", "Application", "Framework"]
16+
classifiers = [
17+
"Development Status :: 5 - Production/Stable",
18+
"Environment :: Web Environment",
19+
"License :: OSI Approved :: Apache Software License",
20+
"Natural Language :: English",
21+
"Operating System :: OS Independent",
22+
"Programming Language :: Python :: 3 :: Only",
23+
"Topic :: Software Development :: Libraries :: Application Frameworks",
24+
"Topic :: Software Development :: Libraries :: Python Modules",
25+
]
26+
27+
[project.optional-dependencies]
28+
dev = [
29+
"pre-commit",
30+
"ruff",
31+
"pytest",
32+
]
33+
34+
[build-system]
35+
requires = ['setuptools', 'wheel']
36+
build-backend = 'setuptools.build_meta'
37+
38+
[tool.setuptools.packages.find]
39+
where = ["."]
40+
41+
[tool.setuptools.package-data]
42+
43+
44+
[tool.semantic_release]
45+
version_toml = [
46+
"pyproject.toml:project.version",
47+
]
48+
build_command = """
49+
python -m venv .venv
50+
source .venv/bin/activate
51+
pip install -U pip build
52+
python -m build .
53+
"""
54+
55+
[semantic_release.publish]
56+
dist_glob_patterns = ["dist/*"]
57+
upload_to_vcs_release = true
58+
59+
[tool.ruff]
60+
line-length = 88
61+
indent-width = 4
62+
target-version = "py39"
63+
64+
[tool.ruff.lint]
65+
select = ["E", "W", "F"]
66+
ignore = []
67+
fixable = ["ALL"]
68+
unfixable = []
69+
70+
71+
[tool.ruff.format]
72+
quote-style = "double"
73+
indent-style = "space"
74+
skip-magic-trailing-comma = false
75+
line-ending = "auto"
76+
docstring-code-format = true
77+
78+
# This only has an effect when the `docstring-code-format` setting is
79+
# enabled.
80+
docstring-code-line-length = "dynamic"
81+
82+
[tool.ruff.lint.pycodestyle]
83+
max-line-length = 120
84+
85+
[lint.pydocstyle]
86+
convention = "google"

setup.cfg

-34
This file was deleted.

setup.py

-3
This file was deleted.

trame/modules/rca.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from trame_rca.module import *
1+
from trame_rca.module import * # noqa: F403

trame/widgets/rca.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from trame_rca.widgets.rca import *
1+
from trame_rca.widgets.rca import * # noqa: F403
22

33

44
def initialize(server):

trame_rca/protocol.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ def on_interaction(self, origin, event):
3232
modifier_fn = event.get("fn", 0)
3333
print(f"{origin}::{event_type}: {position}")
3434
print(
35-
f"Modifier: shift({modifier_shift}), ctrl({modifier_ctrl}), alt({modifier_alt}), command({modifier_cmd}), fn({modifier_fn})"
35+
f"Modifier: shift({modifier_shift}), "
36+
f"ctrl({modifier_ctrl}), "
37+
f"alt({modifier_alt}), "
38+
f"command({modifier_cmd}), "
39+
f"fn({modifier_fn})"
3640
)
3741

3842

trame_rca/widgets/rca.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
"""RCA Widgets only support vue2 for now.
2-
"""
1+
"""RCA Widgets only support vue2 for now."""
2+
33
from trame_client.widgets.core import AbstractElement
44
from .. import module
55

0 commit comments

Comments
 (0)