Skip to content

Commit 39f0935

Browse files
Initial commit
0 parents  commit 39f0935

38 files changed

+1808
-0
lines changed

.coveragerc

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Configuration for python coverage package
2+
[run]
3+
branch = True
4+
omit =
5+
*/tests/*,
6+
.venv/*,
7+
.idea/*,
8+
setup*,
9+
.eggs/*
10+
.tox/*,
11+
build/*,
12+
dist/*,
13+
be_upy_blink/version.py
14+
15+
[report]
16+
# include = src/*
17+
include = be_upy_blink/*
18+
# Regexes for lines to exclude from consideration
19+
20+
ignore_errors = True
21+
22+
[html]
23+
directory = reports/coverage/html
24+
skip_empty = True
25+
26+
[xml]
27+
output = reports/coverage/coverage.xml
28+
29+
[json]
30+
output = reports/coverage/coverage.json
31+
pretty_print = True
32+
show_contexts = True

.editorconfig

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
charset = utf-8
9+
end_of_line = lf
10+
indent_style = space
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
# 4 space indentation
15+
[*.py]
16+
indent_size = 4
17+
18+
[*.json]
19+
indent_size = 4
20+
21+
# 2 space indentation
22+
[*.yml]
23+
indent_size = 2
24+
25+
[*.{md,rst}]
26+
indent_size = 4
27+
trim_trailing_whitespace = false

.flake8

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# Configuration for flake8 analysis
2+
[flake8]
3+
# Set the maximum length that any line (with some exceptions) may be.
4+
# max-line-length = 120
5+
6+
# Set the maximum length that a comment or docstring line may be.
7+
# max-doc-length = 120
8+
9+
# Set the maximum allowed McCabe complexity value for a block of code.
10+
# max-complexity = 15
11+
12+
# Specify a list of codes to ignore.
13+
# D107: Missing docstring in __init__
14+
# D400: First line should end with a period
15+
# W504: line break after binary operator -> Cannot break line with a long pathlib Path
16+
# D204: 1 blank line required after class docstring
17+
ignore = D107, D400, W504, D204
18+
19+
# Specify a list of mappings of files and the codes that should be ignored for the entirety of the file.
20+
per-file-ignores =
21+
tests/*:D101,D102,D104
22+
23+
# Provide a comma-separated list of glob patterns to exclude from checks.
24+
exclude =
25+
# No need to traverse our git directory
26+
.git,
27+
# Python virtual environments
28+
.venv,
29+
# tox virtual environments
30+
.tox,
31+
# There's no value in checking cache directories
32+
__pycache__,
33+
# The conf file is mostly autogenerated, ignore it
34+
docs/conf.py,
35+
# This contains our built documentation
36+
build,
37+
# This contains builds that we don't want to check
38+
dist,
39+
# We don't use __init__.py for scripts
40+
__init__.py
41+
# example testing folder before going live
42+
thinking
43+
.idea
44+
# custom scripts, not being part of the distribution
45+
libs_external
46+
sdist_upip.py
47+
setup.py
48+
49+
# Provide a comma-separated list of glob patterns to add to the list of excluded ones.
50+
# extend-exclude =
51+
# legacy/,
52+
# vendor/
53+
54+
# Provide a comma-separate list of glob patterns to include for checks.
55+
# filename =
56+
# example.py,
57+
# another-example*.py
58+
59+
# Enable PyFlakes syntax checking of doctests in docstrings.
60+
doctests = False
61+
62+
# Specify which files are checked by PyFlakes for doctest syntax.
63+
# include-in-doctest =
64+
# dir/subdir/file.py,
65+
# dir/other/file.py
66+
67+
# Specify which files are not to be checked by PyFlakes for doctest syntax.
68+
# exclude-from-doctest =
69+
# tests/*
70+
71+
# Enable off-by-default extensions.
72+
# enable-extensions =
73+
# H111,
74+
# G123
75+
76+
# If True, report all errors, even if it is on the same line as a # NOQA comment.
77+
disable-noqa = False
78+
79+
# Specify the number of subprocesses that Flake8 will use to run checks in parallel.
80+
jobs = auto
81+
82+
# Also print output to stdout if output-file has been configured.
83+
tee = True
84+
85+
# Count the number of occurrences of each error/warning code and print a report.
86+
statistics = True
87+
88+
# Print the total number of errors.
89+
count = True
90+
91+
# Print the source code generating the error/warning in question.
92+
show-source = True
93+
94+
# Decrease the verbosity of Flake8’s output. Each time you specify it, it will print less and less information.
95+
quiet = 0
96+
97+
# Select the formatter used to display errors to the user.
98+
format = pylint
99+
100+
[pydocstyle]
101+
# choose the basic list of checked errors by specifying an existing convention. Possible conventions: pep257, numpy, google.
102+
convention = pep257
103+
104+
# check only files that exactly match <pattern> regular expression
105+
# match = (?!test_).*\.py
106+
107+
# search only dirs that exactly match <pattern> regular expression
108+
# match_dir = [^\.].*
109+
110+
# ignore any functions or methods that are decorated by a function with a name fitting the <decorators> regular expression.
111+
# ignore_decorators =

.github/workflows/release.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
3+
# this file is *not* meant to cover or endorse the use of GitHub Actions, but
4+
# rather to help make automated releases for this project
5+
6+
name: Upload Python Package
7+
8+
on:
9+
push:
10+
branches:
11+
- main
12+
13+
permissions:
14+
contents: write
15+
16+
jobs:
17+
deploy:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v3
22+
- name: Set up Python
23+
uses: actions/setup-python@v3
24+
with:
25+
python-version: '3.9'
26+
- name: Install build dependencies
27+
run: |
28+
if [ -f requirements-deploy.txt ]; then pip install -r requirements-deploy.txt; fi
29+
- name: Build package
30+
run: |
31+
changelog2version \
32+
--changelog_file changelog.md \
33+
--version_file be_upy_blink/version.py \
34+
--version_file_type py \
35+
--debug
36+
python setup.py sdist
37+
rm dist/*.orig
38+
# sdist call create non conform twine files *.orig, remove them
39+
- name: Publish package
40+
uses: pypa/gh-action-pypi-publish@release/v1.5
41+
with:
42+
password: ${{ secrets.PYPI_API_TOKEN }}
43+
skip_existing: true
44+
verbose: true
45+
print_hash: true
46+
- name: 'Create changelog based release'
47+
uses: brainelectronics/changelog-based-release@v1
48+
with:
49+
# note you'll typically need to create a personal access token
50+
# with permissions to create releases in the other repo
51+
# or you set the "contents" permissions to "write" as in this example
52+
changelog-path: changelog.md
53+
tag-name-prefix: ''
54+
tag-name-extension: ''
55+
release-name-prefix: ''
56+
release-name-extension: ''
57+
draft-release: true
58+
prerelease: false
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
3+
# this file is *not* meant to cover or endorse the use of GitHub Actions, but
4+
# rather to help make automated test releases for this project
5+
6+
name: Upload Python Package to test.pypi.org
7+
8+
on: [pull_request]
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
test-deploy:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v3
19+
- name: Set up Python
20+
uses: actions/setup-python@v3
21+
with:
22+
python-version: '3.9'
23+
- name: Install build dependencies
24+
run: |
25+
if [ -f requirements-deploy.txt ]; then pip install -r requirements-deploy.txt; fi
26+
- name: Build package
27+
run: |
28+
changelog2version \
29+
--changelog_file changelog.md \
30+
--version_file be_upy_blink/version.py \
31+
--version_file_type py \
32+
--additional_version_info="-rc${{ github.run_number }}.dev${{ github.event.number }}" \
33+
--debug
34+
python setup.py sdist
35+
- name: Test built package
36+
# sdist call creates non twine conform "*.orig" files, remove them
37+
run: |
38+
rm dist/*.orig
39+
twine check dist/*.tar.gz
40+
- name: Archive build package artifact
41+
uses: actions/upload-artifact@v3
42+
with:
43+
# https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
44+
# ${{ github.repository }} and ${{ github.ref_name }} can't be used
45+
# for artifact name due to unallowed '/'
46+
name: dist_repo.${{ github.event.repository.name }}_sha.${{ github.sha }}_build.${{ github.run_number }}
47+
path: dist/*.tar.gz
48+
retention-days: 14
49+
- name: Publish package
50+
uses: pypa/gh-action-pypi-publish@release/v1.5
51+
with:
52+
repository_url: https://test.pypi.org/legacy/
53+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
54+
skip_existing: true
55+
verbose: true
56+
print_hash: true
57+
- name: 'Create changelog based prerelease'
58+
uses: brainelectronics/changelog-based-release@v1
59+
with:
60+
# note you'll typically need to create a personal access token
61+
# with permissions to create releases in the other repo
62+
# or you set the "contents" permissions to "write" as in this example
63+
changelog-path: changelog.md
64+
tag-name-prefix: ''
65+
tag-name-extension: '-rc${{ github.run_number }}.dev${{ github.event.number }}'
66+
release-name-prefix: ''
67+
release-name-extension: '-rc${{ github.run_number }}.dev${{ github.event.number }}'
68+
draft-release: true
69+
prerelease: true

.github/workflows/test.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
3+
# This workflow will install Python dependencies, run tests and lint with a
4+
# specific Python version
5+
# For more information see:
6+
# https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
7+
8+
name: Test Python package
9+
10+
on:
11+
push:
12+
# branches: [ $default-branch ]
13+
branches-ignore:
14+
- 'main'
15+
- 'develop'
16+
pull_request:
17+
branches:
18+
- 'main'
19+
- 'develop'
20+
21+
permissions:
22+
contents: read
23+
24+
jobs:
25+
build:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v3
30+
- name: Set up Python
31+
uses: actions/setup-python@v3
32+
with:
33+
python-version: '3.9'
34+
- name: Install test dependencies
35+
run: |
36+
pip install -r requirements-test.txt
37+
- name: Lint with flake8
38+
run: |
39+
flake8 .
40+
- name: Lint with yamllint
41+
run: |
42+
yamllint .
43+
- name: Install deploy dependencies
44+
run: |
45+
python -m pip install --upgrade pip
46+
if [ -f requirements-deploy.txt ]; then pip install -r requirements-deploy.txt; fi
47+
- name: Build package
48+
run: |
49+
changelog2version \
50+
--changelog_file changelog.md \
51+
--version_file be_upy_blink/version.py \
52+
--version_file_type py \
53+
--debug
54+
python setup.py sdist
55+
rm dist/*.orig
56+
- name: Test built package
57+
run: |
58+
twine check dist/*
59+
- name: Validate mip package file
60+
run: |
61+
upy-package \
62+
--setup_file setup.py \
63+
--package_changelog_file changelog.md \
64+
--package_file package.json \
65+
--validate

0 commit comments

Comments
 (0)