Skip to content

Commit e6d2b9a

Browse files
authored
chore: sync templated files to newest template version (#55)
https://github.com/feeph/pypackage-template/releases/tag/v0.2.1
1 parent 8e6d4b2 commit e6d2b9a

16 files changed

+1055
-200
lines changed

.copier/answers_pypackage.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
3+
#
4+
# You can use `pdm run copier update --defaults` to update the template
5+
# files using the answers stored in this file.
6+
# (see https://copier.readthedocs.io/en/stable/updating/ for details)
7+
8+
_commit: v0.2.1
9+
_src_path: https://github.com/feeph/pypackage-template
10+
author_email: [email protected]
11+
author_name: Feeph Aifeimei
12+
default_branch: master
13+
is_typed: true
14+
issuetracker_url: https://github.com/feeph/libi2c-python/issues
15+
max_line_length: 250
16+
package_description: abstraction layer for the I²C bus (incl. simulation for testing)
17+
package_name: i2c
18+
package_namespace: feeph
19+
python_constraint: '>=3.10,<3.13'
20+
repository_name: libi2c-python
21+
repository_url: https://github.com/feeph/libi2c-python

.github/CODEOWNERS

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#
2+
# define code ownership for this repository
3+
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
4+
#
5+
# It's possible to add groups as well but they need to be added to the
6+
# repository and assigned a permission level first. Otherwise they will
7+
# be underlined with red squiggly lines when looking at the file in the
8+
# WebGUI and it won't work.
9+
# (GitHub -> Repository -> Settings -> Collaborators)
10+
#
11+
12+
# define default ownership
13+
* @feeph

.github/dependabot.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
# enable dependabot's scanning but do not allow creation of pull requests
33
# (please use 'scripts/update_dependencies' to update the dependencies)
4-
#
4+
#
55
# - dependabot does not understand PEP-621 repositories (pyproject.toml)
66
# - dependabot expects the filename to end in '<...>requirements.txt' and
77
# ignores requirements-dev.txt ('dev-requirements.txt' would work but

.pre-commit-config.yaml

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,20 @@
33
# documentation can be found at https://pre-commit.com/
44
#
55
# perform once after cloning the repository:
6-
# pipx install pre-commit
7-
# pre-commit install --hook-type pre-commit
8-
# pre-commit install --hook-type commit-msg
6+
# scripts/prepare_repository
97
#
108
# if you want to trigger pre-commit manually:
119
# pre-commit run
10+
# pre-commit run --all-files
1211
#
1312
repos:
1413
- repo: https://github.com/pre-commit/pre-commit-hooks
1514
rev: v2.3.0
1615
hooks:
16+
- id: check-merge-conflict
17+
args: [--assume-in-merge]
18+
- id: check-json
19+
- id: check-toml
1720
- id: check-yaml
1821
- id: end-of-file-fixer
1922
- id: trailing-whitespace
@@ -40,3 +43,31 @@ repos:
4043
rev: 7.0.0
4144
hooks:
4245
- id: flake8
46+
# -----------------------------------------------------------------------
47+
# !! post-commit can't prevent the commit from happening !!
48+
#
49+
# At this point we can only complain that the commit wasn't signed
50+
# properly and provide a warning that something isn't right and remind
51+
# the user to go back and fix this specific commit.
52+
#
53+
# (We rely on the 'pre-push' stage to prevent pushing of unsigned commits.)
54+
- repo: local
55+
hooks:
56+
- id: commit-signed
57+
name: Verify commit is signed
58+
stages:
59+
- post-commit
60+
always_run: true
61+
language: system
62+
entry: git
63+
args: [ "verify-commit", "HEAD" ]
64+
# -----------------------------------------------------------------------
65+
- repo: local
66+
hooks:
67+
- id: signed-commits
68+
name: Verify signature
69+
language: script
70+
entry: scripts/verify_commits-are-signed
71+
args: [ "$PRE_COMMIT_FROM_REF", "$PRE_COMMIT_TO_REF" ]
72+
stages:
73+
- pre-push

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,22 @@
11
# libi2c-python
2+
3+
[![Copier](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-inverted-border-purple.json)](https://github.com/copier-org/copier)
4+
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
5+
[![pdm-managed](https://img.shields.io/endpoint?url=https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2Fpdm-project%2F.github%2Fbadge.json)](https://pdm-project.org)
6+
[![tox](https://img.shields.io/badge/tox-ab79d2)](https://tox.wiki/)
7+
28
abstraction layer for the I²C bus (incl. simulation for testing)
9+
10+
## Purpose
11+
12+
## Usage
13+
14+
## Bugs & Features
15+
16+
Please submit bugs and request features on the [issue tracker](https://github.com/feeph/libi2c-python/issues).
17+
18+
Contributions are always welcome.
19+
20+
## How to contribute
21+
22+
Please refer to the [Contribution guide](docs/CONTRIBUTING.md).

docs/CONTRIBUTING.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Contributing
2+
3+
## quickstart
4+
5+
### one-time setup
6+
7+
__system-wide__
8+
9+
- __install pipx__
10+
- __install build dependencies__ for pyenv
11+
https://github.com/pyenv/pyenv/wiki#suggested-build-environment
12+
13+
__user-specific__
14+
15+
```SHELL
16+
# install dev tools
17+
pipx install pdm pre-commit tox
18+
pipx inject pdm pdm-autoexport
19+
pipx inject tox virtualenv-pyenv
20+
21+
# OS-independent Python versions
22+
curl https://pyenv.run | bash
23+
pyenv install 3.10
24+
pyenv install 3.11
25+
pyenv install 3.12
26+
```
27+
28+
### repository setup
29+
30+
```SHELL
31+
# install pre-commit hooks
32+
for hook_type in pre-commit commit-msg post-commit pre-push ; do
33+
pre-commit install --allow-missing-config --hook-type $hook_type
34+
done
35+
36+
# install package dependencies
37+
pdm install
38+
```
39+
40+
### perform unit tests:
41+
42+
```SHELL
43+
pdm run pytest
44+
```
45+
46+
### perform compatibility tests:
47+
48+
```SHELL
49+
tox
50+
```
51+
52+
### use the demo script
53+
54+
```SHELL
55+
pdm run examples/demonstrator.py
56+
pdm run examples/demonstrator.py -v -i 2
57+
```

feeph/i2c/conversions.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
```
2020
"""
2121

22-
import logging
23-
2422

2523
def convert_uint_to_bytearry(value: int, byte_count: int) -> bytearray:
2624
"""
@@ -34,7 +32,7 @@ def convert_uint_to_bytearry(value: int, byte_count: int) -> bytearray:
3432
```
3533
"""
3634
min_value = 0
37-
max_value = pow(256, byte_count) - 1
35+
max_value = pow(256, byte_count) - 1
3836
if min_value <= value <= max_value:
3937
buf = bytearray(byte_count)
4038
for idx in range(byte_count):

0 commit comments

Comments
 (0)