Skip to content

Commit e9142c8

Browse files
committed
Merge branch 'main' of https://github.com/hardbyte/python-can into main
2 parents 94adca3 + 3f54cca commit e9142c8

File tree

150 files changed

+5172
-2654
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+5172
-2654
lines changed

.github/dependabot.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "pip"
9+
# Enable version updates for development dependencies
10+
directory: "/"
11+
schedule:
12+
interval: "monthly"
13+
versioning-strategy: "increase-if-necessary"
14+
groups:
15+
dev-deps:
16+
patterns:
17+
- "*"
18+
19+
- package-ecosystem: "github-actions"
20+
# Enable version updates for GitHub Actions
21+
directory: "/"
22+
schedule:
23+
interval: "monthly"
24+
groups:
25+
github-actions:
26+
patterns:
27+
- "*"

.github/pull_request_template.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!--
2+
Thank you for contributing to python-can!
3+
Please fill out the following template to help us review your pull request.
4+
-->
5+
6+
## Summary of Changes
7+
8+
<!-- Briefly describe what your pull request does. -->
9+
10+
-
11+
12+
## Related Issues / Pull Requests
13+
14+
<!-- List any related issues, pull requests, or discussions. -->
15+
16+
- Closes #
17+
- Related to #
18+
19+
## Type of Change
20+
21+
- [ ] Bug fix
22+
- [ ] New feature
23+
- [ ] Documentation update
24+
- [ ] Refactoring
25+
- [ ] Other (please describe):
26+
27+
## Checklist
28+
29+
- [ ] I have followed the [contribution guide](https://python-can.readthedocs.io/en/main/development.html).
30+
- [ ] I have added or updated tests as appropriate.
31+
- [ ] I have added or updated documentation as appropriate.
32+
- [ ] I have added a [news fragment](doc/changelog.d/) for towncrier.
33+
- [ ] All checks and tests pass (`tox`).
34+
35+
## Additional Notes
36+
37+
<!-- Add any other information or context you want to share. -->

.github/workflows/ci.yml

Lines changed: 69 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -5,174 +5,126 @@ on:
55
types: [ published ]
66
pull_request:
77
push:
8+
branches-ignore:
9+
- 'dependabot/**'
810

911
env:
1012
PY_COLORS: "1"
1113

14+
permissions:
15+
contents: read
16+
1217
jobs:
1318
test:
1419
runs-on: ${{ matrix.os }}
15-
continue-on-error: ${{ matrix.experimental }} # See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idcontinue-on-error
1620
strategy:
1721
matrix:
1822
os: [ubuntu-latest, macos-latest, windows-latest]
19-
experimental: [false]
20-
python-version: [
21-
"3.8",
22-
"3.9",
23-
"3.10",
24-
"3.11",
25-
"3.12",
26-
"pypy-3.8",
27-
"pypy-3.9",
23+
env: [
24+
"py310",
25+
"py311",
26+
"py312",
27+
"py313",
28+
"py314",
29+
# "py313t",
30+
# "py314t",
31+
"pypy310",
32+
"pypy311",
2833
]
29-
# Python 3.9 is on macos-13 but not macos-latest (macos-14-arm64)
30-
# https://github.com/actions/setup-python/issues/696#issuecomment-1637587760
31-
exclude:
32-
- { python-version: "3.8", os: "macos-latest", experimental: false }
33-
- { python-version: "3.9", os: "macos-latest", experimental: false }
34-
include:
35-
- { python-version: "3.8", os: "macos-13", experimental: false }
36-
- { python-version: "3.9", os: "macos-13", experimental: false }
37-
# uncomment when python 3.13.0 alpha is available
38-
#include:
39-
# # Only test on a single configuration while there are just pre-releases
40-
# - os: ubuntu-latest
41-
# experimental: true
42-
# python-version: "3.13.0-alpha - 3.13.0"
4334
fail-fast: false
4435
steps:
45-
- uses: actions/checkout@v4
46-
- name: Set up Python ${{ matrix.python-version }}
47-
uses: actions/setup-python@v5
36+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
4837
with:
49-
python-version: ${{ matrix.python-version }}
50-
- name: Install dependencies
51-
run: |
52-
python -m pip install --upgrade pip
53-
pip install tox
38+
fetch-depth: 0
39+
persist-credentials: false
40+
- name: Install uv
41+
uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # 7.1.2
42+
- name: Install tox
43+
run: uv tool install tox --with tox-uv
5444
- name: Setup SocketCAN
5545
if: ${{ matrix.os == 'ubuntu-latest' }}
5646
run: |
47+
sudo apt-get update
5748
sudo apt-get -y install linux-modules-extra-$(uname -r)
5849
sudo ./test/open_vcan.sh
5950
- name: Test with pytest via tox
6051
run: |
61-
tox -e gh
52+
tox -e ${{ matrix.env }}
6253
env:
6354
# SocketCAN tests currently fail with PyPy because it does not support raw CAN sockets
64-
# See: https://foss.heptapod.net/pypy/pypy/-/issues/3809
65-
TEST_SOCKETCAN: "${{ matrix.os == 'ubuntu-latest' && ! startsWith(matrix.python-version, 'pypy' ) }}"
55+
# See: https://github.com/pypy/pypy/issues/3808
56+
TEST_SOCKETCAN: "${{ matrix.os == 'ubuntu-latest' && ! startsWith(matrix.env, 'pypy' ) }}"
6657
- name: Coveralls Parallel
67-
uses: coverallsapp/github-action@v2
58+
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # 2.3.6
6859
with:
6960
github-token: ${{ secrets.github_token }}
70-
flag-name: Unittests-${{ matrix.os }}-${{ matrix.python-version }}
61+
flag-name: Unittests-${{ matrix.os }}-${{ matrix.env }}
7162
parallel: true
7263
path-to-lcov: ./coverage.lcov
7364

7465
coveralls:
7566
needs: test
7667
runs-on: ubuntu-latest
7768
steps:
69+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
70+
with:
71+
fetch-depth: 0
72+
persist-credentials: false
7873
- name: Coveralls Finished
79-
uses: coverallsapp/github-action@v2
74+
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # 2.3.6
8075
with:
8176
github-token: ${{ secrets.github_token }}
8277
parallel-finished: true
8378

8479
static-code-analysis:
8580
runs-on: ubuntu-latest
8681
steps:
87-
- uses: actions/checkout@v4
88-
- name: Set up Python
89-
uses: actions/setup-python@v5
90-
with:
91-
python-version: "3.10"
92-
- name: Install dependencies
93-
run: |
94-
python -m pip install --upgrade pip
95-
pip install -e .[lint]
96-
- name: mypy 3.8
97-
run: |
98-
mypy --python-version 3.8 .
99-
- name: mypy 3.9
100-
run: |
101-
mypy --python-version 3.9 .
102-
- name: mypy 3.10
103-
run: |
104-
mypy --python-version 3.10 .
105-
- name: mypy 3.11
106-
run: |
107-
mypy --python-version 3.11 .
108-
- name: mypy 3.12
109-
run: |
110-
mypy --python-version 3.12 .
111-
- name: ruff
112-
run: |
113-
ruff check can
114-
- name: pylint
115-
run: |
116-
pylint \
117-
can/**.py \
118-
can/io \
119-
doc/conf.py \
120-
examples/**.py \
121-
can/interfaces/socketcan
122-
123-
format:
124-
runs-on: ubuntu-latest
125-
steps:
126-
- uses: actions/checkout@v4
127-
- name: Set up Python
128-
uses: actions/setup-python@v5
82+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
12983
with:
130-
python-version: "3.10"
131-
- name: Install dependencies
132-
run: |
133-
python -m pip install --upgrade pip
134-
pip install -e .[lint]
135-
- name: Code Format Check with Black
136-
run: |
137-
black --check --verbose .
84+
fetch-depth: 0
85+
persist-credentials: false
86+
- name: Install uv
87+
uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # 7.1.2
88+
- name: Install tox
89+
run: uv tool install tox --with tox-uv
90+
- name: Run linters
91+
run: |
92+
tox -e lint
93+
- name: Run type checker
94+
run: |
95+
tox -e type
13896
13997
docs:
14098
runs-on: ubuntu-latest
14199
steps:
142-
- uses: actions/checkout@v4
143-
- name: Set up Python
144-
uses: actions/setup-python@v5
100+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
145101
with:
146-
python-version: "3.10"
147-
- name: Install dependencies
148-
run: |
149-
python -m pip install --upgrade pip
150-
pip install -e .[canalystii,gs_usb,mf4]
151-
pip install -r doc/doc-requirements.txt
102+
fetch-depth: 0
103+
persist-credentials: false
104+
- name: Install uv
105+
uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # 7.1.2
106+
- name: Install tox
107+
run: uv tool install tox --with tox-uv
152108
- name: Build documentation
153109
run: |
154-
python -m sphinx -Wan --keep-going doc build
155-
- name: Run doctest
156-
run: |
157-
python -m sphinx -b doctest -W --keep-going doc build
110+
tox -e docs
158111
159112
build:
160113
name: Packaging
161114
runs-on: ubuntu-latest
162115
steps:
163-
- uses: actions/checkout@v4
164-
with:
165-
fetch-depth: 0 # fetch tags for setuptools-scm
166-
- name: Set up Python
167-
uses: actions/setup-python@v5
116+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
168117
with:
169-
python-version: "3.10"
118+
fetch-depth: 0
119+
persist-credentials: false
120+
- name: Install uv
121+
uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # 7.1.2
170122
- name: Build wheel and sdist
171-
run: pipx run build
123+
run: uv build
172124
- name: Check build artifacts
173-
run: pipx run twine check --strict dist/*
125+
run: uvx twine check --strict dist/*
174126
- name: Save artifacts
175-
uses: actions/upload-artifact@v4
127+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # 5.0.0
176128
with:
177129
name: release
178130
path: ./dist
@@ -188,10 +140,15 @@ jobs:
188140
# upload to PyPI only on release
189141
if: github.event.release && github.event.action == 'published'
190142
steps:
191-
- uses: actions/download-artifact@v4
143+
- uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # 6.0.0
192144
with:
193145
path: dist
194146
merge-multiple: true
195147

148+
- name: Generate artifact attestation
149+
uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # 3.0.0
150+
with:
151+
subject-path: 'dist/*'
152+
196153
- name: Publish release distributions to PyPI
197-
uses: pypa/gh-action-pypi-publish@release/v1
154+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # 1.13.0

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ __pycache__/
1818
# Distribution / packaging
1919
.Python
2020
env/
21-
venv/
21+
.venv*/
22+
venv*/
2223
build/
2324
develop-eggs/
2425
dist/

.readthedocs.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ version: 2
99
build:
1010
os: ubuntu-22.04
1111
tools:
12-
python: "3.10"
12+
python: "3.13"
13+
jobs:
14+
post_install:
15+
- pip install --group docs
1316

1417
# Build documentation in the docs/ directory with Sphinx
1518
sphinx:
@@ -23,10 +26,8 @@ formats:
2326
# Optionally declare the Python requirements required to build your docs
2427
python:
2528
install:
26-
- requirements: doc/doc-requirements.txt
2729
- method: pip
2830
path: .
2931
extra_requirements:
3032
- canalystii
31-
- gs_usb
32-
- mf4
33+
- gs-usb

0 commit comments

Comments
 (0)