Compare commits

...

120 commits

Author SHA1 Message Date
Dan Halbert
d4088fa841
Merge pull request #126 from lesamouraipourpre/patch-1
Minor update to api.rst
2021-04-17 13:31:13 -04:00
James Carr
470c1a9e77
Minor update to api.rst
Minor change to make the tabbed line indented by 4 spaces.
2021-04-17 18:22:59 +01:00
Dan Halbert
1cb42da482
Merge pull request #117 from makermelissa/master
Fix typos and add setup.py.disabled if user chooses no for PyPI release
2021-04-16 19:15:49 -04:00
Scott Shawcroft
a8dbc59a17
Merge pull request #125 from tannewt/help_comment
Hook in help comment and problem matchers
2021-04-14 12:46:12 -07:00
Scott Shawcroft
f59e397db1
Hook in help comment and problem matchers 2021-04-13 15:21:12 -07:00
Dylan Herrada
9dd130226f
Merge pull request #120 from kattni/duplicate-code-threshold
Increase duplicate code check threshold.
2021-03-17 15:16:06 -04:00
Kattni Rembor
3d573e0e56 Increase duplicate code check threshold. 2021-03-17 15:05:59 -04:00
Melissa LeBlanc-Williams
49f347d24d Fix typos and add setup.py.disabled if user chooses no for PyPI release 2021-03-10 10:59:56 -08:00
Kattni
4f2954da48
Merge pull request #116 from adafruit/dhalbert-patch-2
Fix "Adafruit" typo
2021-03-10 13:51:28 -05:00
Dan Halbert
488e7d5f78
Fix "Adafruit" typo 2021-03-10 13:50:07 -05:00
Kattni
febfe27270
Merge pull request #114 from hugodahl/feature/Hugo/Update-pylint-checks-for-tests
Update pylint rules for `./tests/` directory files
2021-03-10 13:33:48 -05:00
Hugo Dahl
30f254d17f
Update pre-commit for new repos
Add the './tests' directory as an exception
Run a separate set of linting rules for
2021-03-09 18:45:13 -06:00
Dylan Herrada
de35efcda8
Merge pull request #112 from adafruit/kattni-2021-03-02
Update duplicate code check to ignore imports.
2021-03-02 16:34:10 -05:00
Kattni
9dbfb8dc8e
Update duplicate code check to ignore imports. 2021-03-02 16:22:04 -05:00
Kattni
1d56382d93
Merge pull request #109 from hugodahl/feature/Update-pre-commit-to-perform-pylint
Remove pylint process from github workflow
2021-02-24 10:47:36 -05:00
Hugo Dahl
8dc826cff3
Remove obsolete check
Per discussion with @kattni in Discord (https://discord.com/channels/327254708534116352/327298996332658690/814157848400887809), the `bad-whitespace` check has been removed from pylint. To avoid future issues where it may be removed, we're pre-emptively removing it from our call.

The check which was performed by this rule is now handled in "black".
2021-02-24 09:36:40 -06:00
Hugo Dahl
6cab76c1d3
Make the pylint hook names similar in style and format 2021-02-23 21:53:17 -06:00
Hugo Dahl
ca04d1cb68
Move library code to use pylint pre-commit hook 2021-02-23 21:49:56 -06:00
Hugo Dahl
0581192e3e
Add calls to pylint from pre-commit
The pre-commit configuration file has had the calls to pylint for both
the library code (./adafruit_*.py) and example code (./examples/*.py)
added. The two calls are independant from one-another, and are named
respectively "pylint-library" and "pylint-examples".

The benefit of two separate calls is that they are easily
distinguishable from one another, their rules are applied specifically
to the correct patterns, and the comparison behaviour can be adjusted
independantly (compare all files together as a batch versus
individually).

Additionally, a shell call was the only way to work
around the pylint issue introduced in 2.7.0 which was causing duplicate
code errors to fail the validation, which should not be an issue for the
"examples/*.py" files, since each example should stand on its own.
2021-02-23 20:30:41 -06:00
Hugo Dahl
6f38798d31
Remove pylint process from github workflow
The installation of pylint within the workflow is still needed, since
the pre-commit execution of pylint is run through a shell call.
Since it isn't being run through the dedicated pre-commit hook, pre-commit
will not install pylint for us.
2021-02-23 20:07:40 -06:00
Scott Shawcroft
421a8aad5c
Merge pull request #110 from askpatrickw/fix-rtd-conditional-section
fix the whitespace removal on RTD badge
2021-02-22 16:50:17 -08:00
Patrick
5474c88073 fix the whitespace removal on RTD badge 2021-02-21 21:40:06 -08:00
Limor "Ladyada" Fried
2aac8c0e67
Merge pull request #107 from askpatrickw/fix-product-url
fix product url format
2021-02-21 15:35:35 -05:00
Patrick
233711efc1 fix product url format 2021-02-21 12:18:49 -08:00
Scott Shawcroft
86a885b0fe
Merge pull request #105 from adafruit/jepler-patch-1
pre-commit: run on all branches & on ubuntu-20.04
2021-02-17 08:50:20 -08:00
Jeff Epler
dc4dd63192
pre-commit: run on all branches & on ubuntu-20.04
I noticed that pre-commit only runs on the 'master' branch.  This will be incorrect if cookiecutter is ever updated to use the 'main' branch designation for primary development.

I also updated the ubuntu version from ubuntu-latest to ubuntu-20.04.  This silences a warning shown in the Actions results pages that the meaning of ubuntu-latest can & will change.
2021-02-16 20:38:15 -06:00
foamyguy
3e583012d7
Merge pull request #84 from sommersoft/bundle_aware
RFC: Allow Options For Different Target Bundles
2021-02-12 19:45:33 -06:00
Patrick
1d8792c533 conditional doc build, pylint files, long line 2021-02-11 20:33:42 -08:00
Patrick
e48e921315 pre-commit 2021-02-10 16:34:14 -08:00
Patrick
bc494c2987 Add default for Company and updarte main repo README 2021-02-10 16:32:57 -08:00
Patrick
3a082d6af9 fixes and enhancements 2021-02-10 16:21:27 -08:00
Patrick
d348b0e6ac Only copy setup.py if pypi_release is yes 2021-02-09 01:02:42 -08:00
Patrick
cd6f788f55 pre-commit 2021-02-09 00:50:38 -08:00
Patrick
f9f7337d0c fix prefix caps for linux 2021-02-09 00:49:46 -08:00
Patrick
fc146189d0 fix tests 2021-02-09 00:39:00 -08:00
Patrick
a9b36308b2 pre-commit run 2021-02-08 22:35:02 -08:00
sommersoft
fe09e65b63 Merge branch 'master' of https://github.com/adafruit/cookiecutter-adafruit-circuitpython into bundle_aware 2021-02-07 07:28:45 -06:00
askpatricw
e887bc6e7e PyPi and Branch prompt and more fixes 2021-02-05 00:17:00 -08:00
askpatricw
d77acb7e9f Improvemens to Community vs. Adafruit 2021-02-04 00:28:12 -08:00
Kattni
f1e4ad5b37
Merge pull request #102 from askpatrickw/fix-99
Pre-Commit requires specific versions be used
2021-02-03 10:58:50 -05:00
askpatricw
8757b7beb1 remove travis 2021-02-03 01:05:24 -08:00
askpatricw
62f07f8c74 Fixes 99 2021-02-01 19:20:48 -08:00
Limor "Ladyada" Fried
fcf67be61f
Merge pull request #98 from adafruit/dherrada-patch-1
Added pointless-string-statement to disabled checks
2021-01-11 11:19:22 -05:00
Dylan Herrada
9e63a9349e
pointless, not useless 2021-01-11 11:17:56 -05:00
Dylan Herrada
bdb00b59a0
Added useless-string-statement to disabled checks 2021-01-11 11:16:50 -05:00
Dan Halbert
07eb288eed
Merge pull request #97 from adafruit/revert-96-add-black
Revert "Add Black formatting check."
2021-01-04 18:14:20 -05:00
Dan Halbert
e52ccd8f10
Revert "Add Black formatting check." 2021-01-04 18:12:19 -05:00
Dan Halbert
2f3fc20d93
Merge pull request #96 from kattni/add-black
Add Black formatting check.
2021-01-04 18:07:48 -05:00
Kattni Rembor
57260ff925 Add Black formatting check. 2021-01-04 17:54:37 -05:00
Limor "Ladyada" Fried
b6fc792d45
Merge pull request #95 from ricardoquesada/blocklist
Replace blacklist with ignore-list
2021-01-04 15:08:30 -05:00
Ricardo Quesada
ee1edbb070 Replace blacklist with ignore-list
...another alternative could be "denylist", or "blocklist". But in this
context I think "ignore-list" is the most descriptive one.
2021-01-04 12:04:51 -08:00
Jeff Epler
58b463af8c
Merge pull request #93 from 2bndy5/master
archive built assets as artifacts in build.yml workflow
2020-12-10 18:10:01 -06:00
59b5b279eb Merge remote-tracking branch 'origin/master' into HEAD 2020-12-10 18:00:58 -06:00
Jeff Epler
ce3b9f805b
Merge pull request #94 from adafruit/safely-set-env
Remove deprecated ::set-env
2020-12-10 17:58:51 -06:00
1b8256a35f try upgrading pip
This is an attempt to address pip's failure to install the expected version of
chardet during "Test cookiecutter Generation (on: pull_request)".
Confusingly, this does not affect "Test cookiecutter Generation (on: push)".
2020-12-10 16:18:15 -06:00
33d5a2ddf6 Remove deprecated ::set-env 2020-12-10 15:53:26 -06:00
Brendan
c875cfcf86
archive built assets as artifacts in build.yml workflow 2020-12-09 12:52:11 -08:00
Scott Shawcroft
afa9bf80d5
Merge pull request #91 from makermelissa/master
Change latest black to stable since latest doesn't appear to exist
2020-11-11 17:34:17 -08:00
Melissa LeBlanc-Williams
6fe467a814 Change latest black to stable since latest doesn''t appear to exist 2020-11-11 11:35:50 -08:00
Jeff Epler
7512be4705
Merge pull request #89 from adafruit/black-latest
Changed pre commit config to use latest black
2020-09-29 14:36:58 -05:00
Dylan Herrada
4991c3c919
Changed pre commit config to use latest black 2020-09-17 17:56:15 -04:00
Scott Shawcroft
ec8274f2ca
Merge pull request #87 from dhalbert/init-docstrings
autoclass_content = both
2020-09-08 12:36:30 -07:00
Dan Halbert
aef1bfef08 autoclass_content = both 2020-09-03 16:35:50 -04:00
sommersoft
66605f2f89 include build status badge based on selected CI service; only include Black codestyle badge for Adafruit repos 2020-08-29 07:35:40 -05:00
sommersoft
a5fca8ce70 add choice for CI service, a post-generation hook to cleanup undesired CI configs, & re-add .travis.yml 2020-08-28 05:33:48 -05:00
sommersoft
e4bc160afe cookiecutter.json: add choice for target bundle (Adafruit or Community) 2020-08-28 05:32:05 -05:00
Kattni
1f67a93685
Merge pull request #81 from garrettheath4/patch-1
Fix Contributor Covenant link in CODE_OF_CONDUCT
2020-08-19 14:12:22 -04:00
Garrett Heath Koller
dbc4161d91
Fix Contributor Covenant link in CODE_OF_CONDUCT
`[Contributor Covenant][homepage]` towards the bottom of the document didn't have a matching `[homepage]: https://...` link definition in the Markdown document, so "Contributor Covenant" was a broken link until now
2020-07-30 14:47:59 -04:00
Scott Shawcroft
5dc8717e4e
Merge pull request #80 from FoamyGuy/master
update discord links
2020-07-30 10:49:13 -07:00
foamyguy
60062dd1ca update discord links in readme 2020-07-30 00:02:53 -04:00
foamyguy
91006df23b
Merge pull request #1 from adafruit/master
merge from adafruit
2020-07-29 22:52:14 -05:00
Melissa LeBlanc-Williams
7a2969b946
Merge pull request #79 from adafruit/render_readme
Now checks for setup.py
2020-07-27 15:39:49 -07:00
dherrada
86952103e7 Now checks for setup.py 2020-07-27 09:46:42 -04:00
Scott Shawcroft
e549be2fe1
Merge pull request #77 from adafruit/render_readme
Added a step that renders the readme
2020-07-03 10:48:56 -07:00
dherrada
031ce24749 Renamed to build python package 2020-07-02 14:19:37 -04:00
dherrada
563f954091 Installing without --user 2020-07-01 17:19:44 -04:00
dherrada
9306a05f0f Put readme test in the right place 2020-07-01 16:57:24 -04:00
dherrada
22ed3e46e4 Added a step that renders the readme 2020-07-01 16:51:14 -04:00
Scott Shawcroft
f2f3dcf1af
Merge pull request #75 from Flameeyes/master
Add pre-commit and follow REUSE recommendations for cookiecutter.
2020-06-01 14:51:34 -07:00
Diego Elio Pettenò
59153179f4 Add pre-commit configuration to the cookiecutter template.
This uses the same configuration from
https://github.com/adafruit/Adafruit_CircuitPython_TestRepo, using
pre-commit instead of black as part of the CI.
2020-05-29 23:07:00 +01:00
Diego Elio Pettenò
d9350149df Add pre-commit configuration and integration for REUSE.software.
pre-commit.com provides a way to configure pre-commit hooks for multiple
tools, including `reuse lint` (configured here), isort, black, and more.

In addition to `reuse lint`, enable basic whitespace management and YAML
checks. Note that `black` is not usable with this repository because it
cannot parse the template `.py` files.

Use the pre-commit provided GitHub action as part of the CI, for ease of
maintenance.
2020-05-21 21:22:16 +01:00
Diego Elio Pettenò
a8162b7b11 Apply SPDX copyright and license headers in compliance with REUSE.
The REUSE specifications[1] are meant to make it explicit and easier to
apply code licensing information for a project. The provided lint tool
makes it easy to ensure all the content (code and not code) is tagged.

Important notes:

 * All the code (and documentation) that otherwise didn't have an explicit
   license headers have been tagged with Scott Shawcroft's copyright as per
   the LICENSE file.
 * The favicon.ico file has been tagged with CC-BY-4.0 license as per
   https://github.com/adafruit/circuitpython/issues/2887#issuecomment-628799122
   and Phillip Torrone's for Adafruit Industries copyright.
 * All configuration files have been tagged with Scott Shawcroft's copyright
   and Unlicense[2]. The current REUSE recommendation is to use CC0-1.0,
   but that has… side effects. There's some discussion in [3] about the
   recommendation for likely-uncopyrightable files (such as configuration
   files).
 * In the templated library structure, I've added a double copyright line
   for Scott Shawcroft _and_ the authoring person/company as per previous
   template in at least some of the files. Please let me know which others
   need to be tagged. There is some space for the _template_ having MIT
   license while the _generated_ file having Unlicense, or them having
   different copyright altogether.
 * Since all three of the licenses are used in both the repository itself
   and the generated repository in the cookiecutter, they are currently
   duplicated.

[1]: https://reuse.software/
[2]: https://unlicense.org/
[3]: https://github.com/fsfe/reuse-docs/issues/62
2020-05-21 21:22:16 +01:00
Diego Elio Pettenò
afaed0e9df Update both Code of Conduct files to match the latest revision from its repository.
See https://github.com/adafruit/Adafruit_Community_Code_of_Conduct for the main copy of it.
2020-05-21 21:22:16 +01:00
Kattni
fddd707555
Merge pull request #72 from adafruit/dhalbert-patch-1
fix my discord username
2020-04-15 13:48:36 -04:00
Dan Halbert
1270bf4bfe
fix my discord username
I had changed my username a while ago without being aware it was in the code of conduct.

Does it make sense to have usernames here? The list will become obsolete sooner or later. Maybe just point to the group name.
2020-04-14 20:05:21 -04:00
Kattni
9c66563d12
Merge pull request #71 from sommersoft/blackify_py_templates
Blackify Python Templates
2020-04-09 09:57:01 -04:00
sommersoft
44b6593f16 python templates: blackify formatting to minimize formatting changes 2020-04-08 12:08:51 -05:00
Kattni
83f81da4e0
Merge pull request #70 from adafruit/move-black-before-pylint
Move black before pylint.
2020-04-07 14:24:18 -04:00
Kattni
e186790fe3
Move black before pylint. 2020-04-07 14:11:04 -04:00
Kattni
78f912e32b
Merge pull request #69 from sommersoft/dont_pylint_192
Don't Pin Pylint Install to 1.9.2
2020-03-19 12:59:22 -04:00
sommersoft
8679feb13a build.yml: don't pin pylint install to 1.9.2; use latest version 2020-03-17 20:22:14 -05:00
Kattni
ea6ab5156d
Merge pull request #68 from sommersoft/update_coc
Update The Code of Conduct
2020-03-16 11:37:09 -04:00
sommersoft
5785e5f63c update the code of conduct 2020-03-15 23:47:23 -05:00
Kattni
df057d643a
Merge pull request #67 from sommersoft/build_yml_local_pip
Move Pip Installs Back To Library build.yml
2020-03-04 20:06:22 -05:00
sommersoft
3b9c403ca6 cookie README: add 'code style black' badge 2020-03-04 18:40:35 -06:00
sommersoft
efc2bfc750 build.yml: move pylint, black, and Sphinx+theme installs to the repo 2020-03-04 17:05:35 -06:00
sommersoft
81888e097d
Merge pull request #64 from adafruit/tannewt-patch-8
Disable pylint check that breaks with black
2020-02-27 21:36:29 -06:00
Scott Shawcroft
380ac1f78a
Disable pylint check that breaks with black
Has to do with line continuations.
2020-02-18 17:02:23 -08:00
siddacious
00ba153d5f
Merge pull request #63 from jreese/black
Check formatting via black
2020-02-11 09:15:24 -08:00
John Reese
fd11fcdbe6 Ignore vscode and pyenv version markers 2020-02-10 11:22:23 -08:00
John Reese
313a108801 Check formatting via black
adafruit/circuitpython#2608
2020-02-10 10:30:32 -08:00
siddacious
4882e9b4f9
Merge pull request #60 from dherrada/master
Update build.yml for projects with example subdirs
2020-01-08 18:56:27 -08:00
dherrada
e5d3a7aab6 Line that lints examples now also looks for .py files more than one level deep 2020-01-08 21:36:10 -05:00
dherrada
fb4757fd85 # This is a combination of 9 commits.
# This is the 1st commit message:

Line that lints examples now also looks for .py files more than one level deep

# This is the commit message #2:

Added build.yml and release.yml

# This is the commit message #3:

Cleaned up pylint command

# This is the commit message #4:

Updated versions of pylint commands

# This is the commit message #5:

Un-deleted test.yml

# This is the commit message #6:

Moved build.yml and release.yml

# This is the commit message #7:

Revert "Moved build.yml and release.yml"

This reverts commit 212257f3e5339bd949449f541663b7ab32caea7c.

# This is the commit message #8:

Moved build.yml and release.yml to correct location

# This is the commit message #9:

Updated line that lints examples to also look for .py files more than one level deep
2020-01-08 21:31:29 -05:00
Kattni
6f7e06b1e0
Merge pull request #59 from sommersoft/needs_tests
Add Tests For Changes To The Template
2020-01-06 20:00:48 -05:00
sommersoft
c82e06c0d5 debug and docstring cleanup. 2020-01-04 13:13:54 -06:00
sommersoft
a65ad3e982 fix filename typo in pip install 2020-01-04 13:01:57 -06:00
sommersoft
84d32d9fb0 pip likes the 'install' command to be explicit; not assumed. :D 2020-01-04 13:00:11 -06:00
sommersoft
52478a8ee0 actions: remove some left over copy pasta 2020-01-04 12:55:53 -06:00
sommersoft
aa863de38c add github action workflow to run tests 2020-01-04 12:54:03 -06:00
sommersoft
083abb2c7f inital tests w/pytest; builds two cookiecutters from the templates, and does some minimal verification. 2020-01-04 11:53:14 -06:00
Scott Shawcroft
c2aa242474
Merge pull request #58 from sommersoft/fix_actions
Copy GitHub Actions Workflows Without Parsing Them
2020-01-03 14:40:07 -08:00
sommersoft
3c9ffaefb7 copy actions workflow files in '.github/' without sending them through the jinja parser. fixes failed rendering of '${{ }}' expressions in the workflow yaml files. 2020-01-03 15:39:46 -06:00
siddacious
1a5a9bd9d6
Merge pull request #57 from tannewt/switch_to_actions
Switch to GitHub Actions
2020-01-02 16:25:03 -08:00
Scott Shawcroft
8c4e156392
Update to latest TestRepo versions. 2020-01-02 14:50:55 -08:00
Scott Shawcroft
90baf5c8f8
Switch to GitHub Actions
Fixes #56
2019-12-18 14:02:22 -08:00
Kattni
6adeafd77c
Merge pull request #55 from adafruit/siddacious-patch-1
to point to circuitpython.org for the bundle
2019-10-31 17:49:14 -04:00
siddacious
b705d46790
to point to circuitpython.org for the bundle 2019-10-31 14:46:32 -07:00
dherrada
982c75bce5
Removed building locally section from README, replaced with documentation section 2019-10-17 20:22:16 -04:00
Limor "Ladyada" Fried
ca2c2bb9cc
Merge pull request #54 from adafruit/add_vscode
Add .vscode to .gitignore
2019-09-07 00:57:23 -04:00
54 changed files with 1637 additions and 324 deletions

23
.github/workflows/pre-commit.yml vendored Normal file
View file

@ -0,0 +1,23 @@
# SPDX-FileCopyrightText: Copyright (c) 2019 Anthony Sottile
#
# SPDX-License-Identifier: MIT
name: pre-commit
on:
pull_request:
push:
jobs:
pre-commit:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
- name: set PY
run: echo >>$GITHUB_ENV "PY=$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')"
- uses: actions/cache@v1
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- uses: pre-commit/action@v1.1.0

34
.github/workflows/test.yml vendored Normal file
View file

@ -0,0 +1,34 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
name: Test cookiecutter Generation
on: [pull_request, push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Set up Python 3.6
uses: actions/setup-python@v1
with:
python-version: 3.6
- name: Versions
run: |
python3 --version
- name: Checkout Current Repo
uses: actions/checkout@v1
with:
submodules: true
- name: Install deps
run: |
pip install --upgrade pip
pip install -r $GITHUB_WORKSPACE/tests_requirements.txt
- name: Run cookiecutter tests
run: |
pytest -v

16
.gitignore vendored Normal file
View file

@ -0,0 +1,16 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
.venv
.env
.python-version
*.pyc
.pytest*
__pycache__
.cookie_test/
.vscode/

15
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,15 @@
# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò
#
# SPDX-License-Identifier: Unlicense
repos:
- repo: https://github.com/fsfe/reuse-tool
rev: v0.12.1
hooks:
- id: reuse
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

View file

@ -1,3 +1,9 @@
<!--
SPDX-FileCopyrightText: 2014 Coraline Ada Ehmke
SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries
SPDX-License-Identifier: CC-BY-4.0
-->
# Adafruit Community Code of Conduct
## Our Pledge
@ -34,6 +40,8 @@ Examples of unacceptable behavior by participants include:
* Excessive or unwelcome helping; answering outside the scope of the question
asked
* Trolling, insulting/derogatory comments, and personal or political attacks
* Promoting or spreading disinformation, lies, or conspiracy theories against
a person, group, organisation, project, or community
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
@ -72,10 +80,10 @@ You may report in the following ways:
In any situation, you may send an email to <support@adafruit.com>.
On the Adafruit Discord, you may send an open message from any channel
to all Community Helpers by tagging @community moderators. You may also send an
open message from any channel, or a direct message to @kattni#1507,
@tannewt#4653, @Dan Halbert#1614, @cater#2442, @sommersoft#0222, or
@Andon#8175.
to all Community Moderators by tagging @community moderators. You may
also send an open message from any channel, or a direct message to
@kattni#1507, @tannewt#4653, @danh#1614, @cater#2442,
@sommersoft#0222, @Mr. Certainly#0472 or @Andon#8175.
Email and direct message reports will be kept confidential.

324
LICENSES/CC-BY-4.0.txt Normal file
View file

@ -0,0 +1,324 @@
Creative Commons Attribution 4.0 International Creative Commons Corporation
("Creative Commons") is not a law firm and does not provide legal services
or legal advice. Distribution of Creative Commons public licenses does not
create a lawyer-client or other relationship. Creative Commons makes its licenses
and related information available on an "as-is" basis. Creative Commons gives
no warranties regarding its licenses, any material licensed under their terms
and conditions, or any related information. Creative Commons disclaims all
liability for damages resulting from their use to the fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and conditions
that creators and other rights holders may use to share original works of
authorship and other material subject to copyright and certain other rights
specified in the public license below. The following considerations are for
informational purposes only, are not exhaustive, and do not form part of our
licenses.
Considerations for licensors: Our public licenses are intended for use by
those authorized to give the public permission to use material in ways otherwise
restricted by copyright and certain other rights. Our licenses are irrevocable.
Licensors should read and understand the terms and conditions of the license
they choose before applying it. Licensors should also secure all rights necessary
before applying our licenses so that the public can reuse the material as
expected. Licensors should clearly mark any material not subject to the license.
This includes other CC-licensed material, or material used under an exception
or limitation to copyright. More considerations for licensors : wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public licenses, a licensor
grants the public permission to use the licensed material under specified
terms and conditions. If the licensor's permission is not necessary for any
reasonfor example, because of any applicable exception or limitation to copyrightthen
that use is not regulated by the license. Our licenses grant only permissions
under copyright and certain other rights that a licensor has authority to
grant. Use of the licensed material may still be restricted for other reasons,
including because others have copyright or other rights in the material. A
licensor may make special requests, such as asking that all changes be marked
or described. Although not required by our licenses, you are encouraged to
respect those requests where reasonable. More considerations for the public
: wiki.creativecommons.org/Considerations_for_licensees Creative Commons Attribution
4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree to
be bound by the terms and conditions of this Creative Commons Attribution
4.0 International Public License ("Public License"). To the extent this Public
License may be interpreted as a contract, You are granted the Licensed Rights
in consideration of Your acceptance of these terms and conditions, and the
Licensor grants You such rights in consideration of benefits the Licensor
receives from making the Licensed Material available under these terms and
conditions.
Section 1 Definitions.
a. Adapted Material means material subject to Copyright and Similar Rights
that is derived from or based upon the Licensed Material and in which the
Licensed Material is translated, altered, arranged, transformed, or otherwise
modified in a manner requiring permission under the Copyright and Similar
Rights held by the Licensor. For purposes of this Public License, where the
Licensed Material is a musical work, performance, or sound recording, Adapted
Material is always produced where the Licensed Material is synched in timed
relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright and Similar
Rights in Your contributions to Adapted Material in accordance with the terms
and conditions of this Public License.
c. Copyright and Similar Rights means copyright and/or similar rights closely
related to copyright including, without limitation, performance, broadcast,
sound recording, and Sui Generis Database Rights, without regard to how the
rights are labeled or categorized. For purposes of this Public License, the
rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
d. Effective Technological Measures means those measures that, in the absence
of proper authority, may not be circumvented under laws fulfilling obligations
under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996,
and/or similar international agreements.
e. Exceptions and Limitations means fair use, fair dealing, and/or any other
exception or limitation to Copyright and Similar Rights that applies to Your
use of the Licensed Material.
f. Licensed Material means the artistic or literary work, database, or other
material to which the Licensor applied this Public License.
g. Licensed Rights means the rights granted to You subject to the terms and
conditions of this Public License, which are limited to all Copyright and
Similar Rights that apply to Your use of the Licensed Material and that the
Licensor has authority to license.
h. Licensor means the individual(s) or entity(ies) granting rights under this
Public License.
i. Share means to provide material to the public by any means or process that
requires permission under the Licensed Rights, such as reproduction, public
display, public performance, distribution, dissemination, communication, or
importation, and to make material available to the public including in ways
that members of the public may access the material from a place and at a time
individually chosen by them.
j. Sui Generis Database Rights means rights other than copyright resulting
from Directive 96/9/EC of the European Parliament and of the Council of 11
March 1996 on the legal protection of databases, as amended and/or succeeded,
as well as other essentially equivalent rights anywhere in the world.
k. You means the individual or entity exercising the Licensed Rights under
this Public License. Your has a corresponding meaning.
Section 2 Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License, the Licensor
hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive,
irrevocable license to exercise the Licensed Rights in the Licensed Material
to:
A. reproduce and Share the Licensed Material, in whole or in part; and
B. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions
and Limitations apply to Your use, this Public License does not apply, and
You do not need to comply with its terms and conditions.
3. Term. The term of this Public License is specified in Section 6(a).
4. Media and formats; technical modifications allowed. The Licensor authorizes
You to exercise the Licensed Rights in all media and formats whether now known
or hereafter created, and to make technical modifications necessary to do
so. The Licensor waives and/or agrees not to assert any right or authority
to forbid You from making technical modifications necessary to exercise the
Licensed Rights, including technical modifications necessary to circumvent
Effective Technological Measures. For purposes of this Public License, simply
making modifications authorized by this Section 2(a)(4) never produces Adapted
Material.
5. Downstream recipients.
A. Offer from the Licensor Licensed Material. Every recipient of the Licensed
Material automatically receives an offer from the Licensor to exercise the
Licensed Rights under the terms and conditions of this Public License.
B. No downstream restrictions. You may not offer or impose any additional
or different terms or conditions on, or apply any Effective Technological
Measures to, the Licensed Material if doing so restricts exercise of the Licensed
Rights by any recipient of the Licensed Material.
6. No endorsement. Nothing in this Public License constitutes or may be construed
as permission to assert or imply that You are, or that Your use of the Licensed
Material is, connected with, or sponsored, endorsed, or granted official status
by, the Licensor or others designated to receive attribution as provided in
Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not licensed under this
Public License, nor are publicity, privacy, and/or other similar personality
rights; however, to the extent possible, the Licensor waives and/or agrees
not to assert any such rights held by the Licensor to the limited extent necessary
to allow You to exercise the Licensed Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this Public License.
3. To the extent possible, the Licensor waives any right to collect royalties
from You for the exercise of the Licensed Rights, whether directly or through
a collecting society under any voluntary or waivable statutory or compulsory
licensing scheme. In all other cases the Licensor expressly reserves any right
to collect such royalties.
Section 3 License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the following
conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified form), You must:
A. retain the following if it is supplied by the Licensor with the Licensed
Material:
i. identification of the creator(s) of the Licensed Material and any others
designated to receive attribution, in any reasonable manner requested by the
Licensor (including by pseudonym if designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of warranties;
v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
B. indicate if You modified the Licensed Material and retain an indication
of any previous modifications; and
C. indicate the Licensed Material is licensed under this Public License, and
include the text of, or the URI or hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner
based on the medium, means, and context in which You Share the Licensed Material.
For example, it may be reasonable to satisfy the conditions by providing a
URI or hyperlink to a resource that includes the required information.
3. If requested by the Licensor, You must remove any of the information required
by Section 3(a)(1)(A) to the extent reasonably practicable.
4. If You Share Adapted Material You produce, the Adapter's License You apply
must not prevent recipients of the Adapted Material from complying with this
Public License.
Section 4 Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that apply to
Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract,
reuse, reproduce, and Share all or a substantial portion of the contents of
the database;
b. if You include all or a substantial portion of the database contents in
a database in which You have Sui Generis Database Rights, then the database
in which You have Sui Generis Database Rights (but not its individual contents)
is Adapted Material; and
c. You must comply with the conditions in Section 3(a) if You Share all or
a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not replace
Your obligations under this Public License where the Licensed Rights include
other Copyright and Similar Rights.
Section 5 Disclaimer of Warranties and Limitation of Liability.
a. Unless otherwise separately undertaken by the Licensor, to the extent possible,
the Licensor offers the Licensed Material as-is and as-available, and makes
no representations or warranties of any kind concerning the Licensed Material,
whether express, implied, statutory, or other. This includes, without limitation,
warranties of title, merchantability, fitness for a particular purpose, non-infringement,
absence of latent or other defects, accuracy, or the presence or absence of
errors, whether or not known or discoverable. Where disclaimers of warranties
are not allowed in full or in part, this disclaimer may not apply to You.
b. To the extent possible, in no event will the Licensor be liable to You
on any legal theory (including, without limitation, negligence) or otherwise
for any direct, special, indirect, incidental, consequential, punitive, exemplary,
or other losses, costs, expenses, or damages arising out of this Public License
or use of the Licensed Material, even if the Licensor has been advised of
the possibility of such losses, costs, expenses, or damages. Where a limitation
of liability is not allowed in full or in part, this limitation may not apply
to You.
c. The disclaimer of warranties and limitation of liability provided above
shall be interpreted in a manner that, to the extent possible, most closely
approximates an absolute disclaimer and waiver of all liability.
Section 6 Term and Termination.
a. This Public License applies for the term of the Copyright and Similar Rights
licensed here. However, if You fail to comply with this Public License, then
Your rights under this Public License terminate automatically.
b. Where Your right to use the Licensed Material has terminated under Section
6(a), it reinstates:
1. automatically as of the date the violation is cured, provided it is cured
within 30 days of Your discovery of the violation; or
2. upon express reinstatement by the Licensor.
c. For the avoidance of doubt, this Section 6(b) does not affect any right
the Licensor may have to seek remedies for Your violations of this Public
License.
d. For the avoidance of doubt, the Licensor may also offer the Licensed Material
under separate terms or conditions or stop distributing the Licensed Material
at any time; however, doing so will not terminate this Public License.
e. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
Section 7 Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different terms or
conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the Licensed
Material not stated herein are separate from and independent of the terms
and conditions of this Public License.
Section 8 Interpretation.
a. For the avoidance of doubt, this Public License does not, and shall not
be interpreted to, reduce, limit, restrict, or impose conditions on any use
of the Licensed Material that could lawfully be made without permission under
this Public License.
b. To the extent possible, if any provision of this Public License is deemed
unenforceable, it shall be automatically reformed to the minimum extent necessary
to make it enforceable. If the provision cannot be reformed, it shall be severed
from this Public License without affecting the enforceability of the remaining
terms and conditions.
c. No term or condition of this Public License will be waived and no failure
to comply consented to unless expressly agreed to by the Licensor.
d. Nothing in this Public License constitutes or may be interpreted as a limitation
upon, or waiver of, any privileges and immunities that apply to the Licensor
or You, including from the legal processes of any jurisdiction or authority.
Creative Commons is not a party to its public licenses. Notwithstanding, Creative
Commons may elect to apply one of its public licenses to material it publishes
and in those instances will be considered the "Licensor." The text of the
Creative Commons public licenses is dedicated to the public domain under the
CC0 Public Domain Dedication. Except for the limited purpose of indicating
that material is shared under a Creative Commons public license or as otherwise
permitted by the Creative Commons policies published at creativecommons.org/policies,
Creative Commons does not authorize the use of the trademark "Creative Commons"
or any other trademark or logo of Creative Commons without its prior written
consent including, without limitation, in connection with any unauthorized
modifications to any of its public licenses or any other arrangements, understandings,
or agreements concerning use of licensed material. For the avoidance of doubt,
this paragraph does not form part of the public licenses.
Creative Commons may be contacted at creativecommons.org.

19
LICENSES/MIT.txt Normal file
View file

@ -0,0 +1,19 @@
MIT License Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

20
LICENSES/Unlicense.txt Normal file
View file

@ -0,0 +1,20 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute
this software, either in source code form or as a compiled binary, for any
purpose, commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this
software dedicate any and all copyright interest in the software to the public
domain. We make this dedication for the benefit of the public at large and
to the detriment of our heirs and successors. We intend this dedication to
be an overt act of relinquishment in perpetuity of all present and future
rights to this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information,
please refer to <https://unlicense.org/>

View file

@ -2,7 +2,7 @@ Introduction
============
.. image :: https://img.shields.io/discord/327254708534116352.svg
:target: https://discord.gg/nBQh6qu
:target: https://adafru.it/discord
:alt: Discord
This cookiecutter creates a project structure for a Adafruit CircuitPython
@ -29,19 +29,25 @@ Then, fill in the prompts and accomplish some post generation cleanup:
Prompts
--------
* ``target_bundle`` - Adafruit bundle or Community library bundle
* ``github_user`` - GitHub user or organization which will host this repo. For example, Adafruit funded libraries should say "adafruit" here.
* ``author_name`` - Who you are! Sets the copyright to you.
* ``company`` - Used to give Copyright credit to the company funding the library. For example, Adafruit funded libraries should say "Adafruit Industries" here.
* ``library_name`` - Shortest name for the library. Usually a chip name such as LIS3DH.
* ``library_prefix`` - Used to prefix the code to the organization creating the library. For example, Adafruit supported libraries should say "adafruit" here. Do not add a - or _.
* ``library_description`` - Write a sentence describing the purpose of this library (e.g. ``CircuitPython helper library for the DC & Stepper Motor FeatherWing, Shield and Pi Hat kits.``).
* ``library_keywords`` - Used to populate keywords for PyPi. Enter a string of keywords (e.g ``dht temp humidity``) NOTE: The following are included by default: ``adafruit``, ``blinka``, ``circuitpython``, ``micropython``, and the ``library_name`` you enter.
* ``author`` - Who you are! Sets the copyright to you.
* ``github_user`` - GitHub user or organization which will host this repo. For example, Adafruit funded libraries should say "adafruit" here.
* ``company`` - Used to give Copyright credit to the company funding the library. For example, Adafruit funded libraries should say "Adafruit Industries" here.
* ``library_prefix`` - Used to prefix the code to the organization creating the library. For example, Adafruit supported libraries should say "adafruit" here. Do not add a - or _.
* ``adafruit_pid`` - The product ID for the Adafruit product includes a link to the product in the README. Only applies to Adafruit Bundle.
* ``requires_bus_device`` - Determines whether to add comments about a dependency on `BusDevice <https://github.com/adafruit/Adafruit_CircuitPython_BusDevice>`_.
If the library uses BusDevice, enter ``y`` or ``yes`` to include. If the library doesn't use BusDevice, all other entries including empty, will not include BusDevice.
* ``requires_register`` - Determines whether to add comments about a dependency on `Register <https://github.com/adafruit/Adafruit_CircuitPython_Register>`_.
If the library uses Register, enter ``y`` or ``yes`` to include. If the library doesn't use Register, all other entries including empty, will not include Register.
* ``other_requirements`` - Adds any other module dependencies for PyPi. Enter a comma separated string of modules
(e.g. ``adafruit-circuitpython-pca9685, adafruit-circuitpython-motor``). NOTE: ``Adafruit-Blinka`` is always included, so no need to include it here.
* ``pypi_release`` - Will this library be releaased on PyPI? If so, enter ``y`` or ``yes`` to include the setup.py. For Adafruit libraries this defaults to Yes.
* ``sphinx_docs`` - Should the Sphinx based documentation be included in your repo? If so, enter ``y`` or ``yes`` to include the setup.py. For Adafruit libraries this defaults to Yes.
* ``default_branch`` - What is the default branch used in your Githiub repos? Choice of Master or Main. For Adafruit libraries this defaults to Master.
Post Generation Cleanup
------------------------

3
README.rst.license Normal file
View file

@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
SPDX-License-Identifier: MIT

View file

@ -1,5 +1,9 @@
# -*- coding: utf-8 -*-
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
# Adafruit MCP9808 Library documentation build configuration file, created by
# sphinx-quickstart on Fri Nov 11 07:42:21 2016.
#

View file

@ -1,13 +1,22 @@
{
"target_bundle": [
"Adafruit",
"Community"
],
"github_user": "{%- if cookiecutter.target_bundle == 'Adafruit' -%} adafruit {%- endif -%}",
"author_name": null,
"company": "{%- if cookiecutter.target_bundle == 'Adafruit' -%} Adafruit Industries {%- endif -%}",
"library_name": null,
"library_prefix": "",
"library_description": "",
"library_keywords": "",
"author": null,
"github_user": "adafruit",
"company": "",
"library_prefix": "{%- if cookiecutter.target_bundle == 'Adafruit' -%} adafruit {%- endif -%}",
"adafruit_pid": "",
"requires_bus_device": "",
"requires_register": "",
"other_requirements": "",
"_extensions": ["jinja2.ext.do"]
"pypi_release": "{%- if cookiecutter.target_bundle == 'Adafruit' -%} yes {%- else -%} no {%- endif -%}",
"sphinx_docs": "{%- if cookiecutter.target_bundle == 'Adafruit' -%} yes {%- else -%} no {%- endif -%}",
"default_branch": ["master", "main"],
"_extensions": ["jinja2.ext.do"],
"_copy_without_render": ["*.github/*"]
}

View file

@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
SPDX-License-Identifier: Unlicense

24
hooks/post_gen_project.py Normal file
View file

@ -0,0 +1,24 @@
# SPDX-FileCopyrightText: 2021 Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
Hooks that run before the template is rendered.
"""
import pathlib
import shutil
import sys
base_folder = pathlib.PosixPath().resolve()
docs_dir = base_folder / "docs"
sphinx_docs = "{{cookiecutter.sphinx_docs}}"
if sphinx_docs.lower() in ["n", "no"]:
"""
Remove the Docs folder if the user doesn't want docs.
"""
try:
shutil.rmtree(docs_dir)
except OSError as e:
print("Error: %s : %s" % (docs_dir, e.strerror))

16
hooks/pre_gen_project.py Normal file
View file

@ -0,0 +1,16 @@
# SPDX-FileCopyrightText: 2021 Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
Hooks that run before the template is rendered.
"""
import sys
github_user = '{{cookiecutter.github_user}}'
if github_user in ["", None]:
print("ERROR: github_user is a required field.")
# exits with status 1 to indicate failure
sys.exit(1)

8
pytest.ini Normal file
View file

@ -0,0 +1,8 @@
; SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
;
; SPDX-License-Identifier: Unlicense
[pytest]
filterwarnings =
error
ignore::DeprecationWarning

View file

@ -1,2 +1,5 @@
requirements_file: requirements.txt
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
requirements_file: requirements.txt

137
tests/test_make_cookies.py Normal file
View file

@ -0,0 +1,137 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import json
import pathlib
import shutil
import sys
from cookiecutter.main import cookiecutter
# only verified on linux and MacOS
if not (sys.platform.startswith('linux') or sys.platform.startswith('darwin')):
raise RuntimeError('These tests are only verified to run on Linux and MacOS systems.')
working_dir = pathlib.Path()
output_dir = working_dir / '.cookie_test'
cookie_json_path = working_dir / 'cookiecutter.json'
if not cookie_json_path.exists():
raise RuntimeError('Please run pytest from the top-most directory.')
cookie_json = None
with open(cookie_json_path.resolve(), 'r') as cookie_file:
cookie_json = json.load(cookie_file)
def overwrite_workaround():
""" cookiecutter's `overwrite_if_exists=True` is currently broken.
There is an accepted PR slated for release 1.8.0, but until
it is released, we'll need to work around it.
"""
if output_dir.exists():
shutil.rmtree(str(output_dir.resolve()))
def compare_template_dirs(*, library_name='test', library_prefix=None):
""" Helper function to compare the results of generated files,
to the available files in the template.
:param: str library_name: Name used for the template's `library_name`
prompt. Default: 'test'
:param: None,str library_prefix: The value used for the template's
`library_prefix` prompt. Default: None
"""
cookie_template_path = working_dir / '{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }}_{% endif %}CircuitPython_{{ cookiecutter.library_name}}'
if library_prefix:
generated_folder_name = "{}_CircuitPython_{}".format(library_prefix, library_name)
else:
generated_folder_name = "CircuitPython_{}".format(library_name)
generated_path = output_dir / generated_folder_name
assert generated_path.exists()
generated_files = [file.name for file in generated_path.iterdir()]
template_files = set()
for file in cookie_template_path.iterdir():
if '{' in file.name:
if not library_prefix:
base_name = file.with_name('CircuitPython_{}'.format(library_name))
template_files.add(
base_name.with_suffix(file.suffix).name
)
else:
base_name = file.with_name('{}_CircuitPython_{}'.format(
library_prefix,
library_name
))
template_files.add(
base_name.with_suffix(file.suffix).name
)
else:
template_files.add(file.name)
return 0 <= len(template_files.difference(set(generated_files)))
def test_new_cookiecutter_only_required_entries():
""" Basic test of running cookiecutter, supplying info only to the
required fields (cookiecutter.json values of 'null').
"""
# delete testing output directory if exists
overwrite_workaround()
test_context = {}
for key, value in cookie_json.items():
if value == None:
test_context[key] = 'test'
if key.startswith('_'):
test_context[key] = value
new_cookie = cookiecutter(
str(working_dir.resolve()),
no_input=True,
output_dir=str(output_dir.resolve()),
overwrite_if_exists=True,
extra_context=test_context
)
assert new_cookie == '{}/Adafruit_CircuitPython_test'.format(output_dir.resolve())
assert compare_template_dirs(library_prefix="Adafruit")
def test_new_cookiecutter_all_entries():
""" Basic test of running cookiecutter, supplying info for all fields.
All fields will have 'test' except where specific values are required, so this is only a
minimal & cursory test.
"""
# delete testing output directory if exists
overwrite_workaround()
test_context = {}
for key, value in cookie_json.items():
if not key.startswith('_'):
if key == "target_bundle":
test_context[key] = 'community'
if key == "pypi_release":
test_context[key] = 'yes'
if key == "default_branch":
test_context[key] = 'master'
else:
test_context[key] = 'test'
else:
test_context[key] = value
new_cookie = cookiecutter(
str(working_dir.resolve()),
no_input=True,
output_dir=str(output_dir.resolve()),
overwrite_if_exists=True,
extra_context=test_context
)
assert new_cookie == '{}/Test_CircuitPython_test'.format(output_dir.resolve())
assert compare_template_dirs(library_prefix='Test')

6
tests_requirements.txt Normal file
View file

@ -0,0 +1,6 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
cookiecutter
pytest

View file

@ -0,0 +1,80 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
name: Build CI
on: [pull_request, push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Translate Repo Name For Build Tools filename_prefix
id: repo-name
run: |
echo ::set-output name=repo-name::$(
echo ${{ github.repository }} |
awk -F '\/' '{ print tolower($2) }' |
tr '_' '-'
)
- name: Set up Python 3.6
uses: actions/setup-python@v1
with:
python-version: 3.6
- name: Versions
run: |
python3 --version
- name: Checkout Current Repo
uses: actions/checkout@v1
with:
submodules: true
- name: Checkout tools repo
uses: actions/checkout@v2
with:
repository: adafruit/actions-ci-circuitpython-libs
path: actions-ci
- name: Install dependencies
# (e.g. - apt-get: gettext, etc; pip: circuitpython-build-tools, requirements.txt; etc.)
run: |
source actions-ci/install.sh
- name: Pip install pylint, Sphinx, pre-commit
run: |
pip install --force-reinstall pylint Sphinx sphinx-rtd-theme pre-commit
- name: Library version
run: git describe --dirty --always --tags
- name: Setup problem matchers
uses: adafruit/circuitpython-action-library-ci-problem-matchers@v1
- name: Pre-commit hooks
run: |
pre-commit run --all-files
- name: Build assets
run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location .
- name: Archive bundles
uses: actions/upload-artifact@v2
with:
name: bundles
path: ${{ github.workspace }}/bundles/
- name: Check For docs folder
id: need-docs
run: |
echo ::set-output name=docs::$( find . -wholename './docs' )
- name: Build docs
if: contains(steps.need-docs.outputs.docs, 'docs')
working-directory: docs
run: sphinx-build -E -W -b html . _build/html
- name: Check For setup.py
id: need-pypi
run: |
echo ::set-output name=setup-py::$( find . -wholename './setup.py' )
- name: Build Python package
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
run: |
pip install --upgrade setuptools wheel twine readme_renderer testresources
python setup.py sdist
python setup.py bdist_wheel --universal
twine check dist/*

View file

@ -0,0 +1,19 @@
# SPDX-FileCopyrightText: 2021 Scott Shawcroft for Adafruit Industries
#
# SPDX-License-Identifier: MIT
name: Failure help text
on:
workflow_run:
workflows: ["Build CI"]
types:
- completed
jobs:
post-help:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.event == 'pull_request' }}
steps:
- name: Post comment to help
uses: adafruit/circuitpython-action-library-ci-failed@v1

View file

@ -0,0 +1,85 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
name: Release Actions
on:
release:
types: [published]
jobs:
upload-release-assets:
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Translate Repo Name For Build Tools filename_prefix
id: repo-name
run: |
echo ::set-output name=repo-name::$(
echo ${{ github.repository }} |
awk -F '\/' '{ print tolower($2) }' |
tr '_' '-'
)
- name: Set up Python 3.6
uses: actions/setup-python@v1
with:
python-version: 3.6
- name: Versions
run: |
python3 --version
- name: Checkout Current Repo
uses: actions/checkout@v1
with:
submodules: true
- name: Checkout tools repo
uses: actions/checkout@v2
with:
repository: adafruit/actions-ci-circuitpython-libs
path: actions-ci
- name: Install deps
run: |
source actions-ci/install.sh
- name: Build assets
run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location .
- name: Upload Release Assets
# the 'official' actions version does not yet support dynamically
# supplying asset names to upload. @csexton's version chosen based on
# discussion in the issue below, as its the simplest to implement and
# allows for selecting files with a pattern.
# https://github.com/actions/upload-release-asset/issues/4
#uses: actions/upload-release-asset@v1.0.1
uses: csexton/release-asset-action@master
with:
pattern: "bundles/*"
github-token: ${{ secrets.GITHUB_TOKEN }}
upload-pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Check For setup.py
id: need-pypi
run: |
echo ::set-output name=setup-py::$( find . -wholename './setup.py' )
- name: Set up Python
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install dependencies
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
env:
TWINE_USERNAME: ${{ secrets.pypi_username }}
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: |
python setup.py sdist
twine upload dist/*

View file

@ -0,0 +1,18 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
*.mpy
.idea
__pycache__
_build
*.pyc
.env
.python-version
build*/
bundles
*.DS_Store
.eggs
dist
**/*.egg-info
.vscode

View file

@ -0,0 +1,40 @@
# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò
#
# SPDX-License-Identifier: Unlicense
repos:
- repo: https://github.com/python/black
rev: 20.8b1
hooks:
- id: black
- repo: https://github.com/fsfe/reuse-tool
rev: v0.12.1
hooks:
- id: reuse
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pycqa/pylint
rev: pylint-2.7.1
hooks:
- id: pylint
name: pylint (library code)
types: [python]
exclude: "^(docs/|examples/|tests/|setup.py$)"
- repo: local
hooks:
- id: pylint_examples
name: pylint (examples code)
description: Run pylint rules on "examples/*.py" files
entry: /usr/bin/env bash -c
args: ['([[ ! -d "examples" ]] || for example in $(find . -path "./examples/*.py"); do pylint --disable=missing-docstring,invalid-name $example; done)']
language: system
- id: pylint_tests
name: pylint (tests code)
description: Run pylint rules on "tests/*.py" files
entry: /usr/bin/env bash -c
args: ['([[ ! -d "tests" ]] || for test in $(find . -path "./tests/*.py"); do pylint --disable=missing-docstring $test; done)']
language: system

View file

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
[MASTER]
# A comma-separated list of package or module names from where C extensions may
@ -5,11 +9,11 @@
# run arbitrary code
extension-pkg-whitelist=
# Add files or directories to the blacklist. They should be base names, not
# Add files or directories to the ignore-list. They should be base names, not
# paths.
ignore=CVS
# Add files or directories matching the regex patterns to the blacklist. The
# Add files or directories matching the regex patterns to the ignore-list. The
# regex matches against base names, not paths.
ignore-patterns=
@ -18,8 +22,7 @@ ignore-patterns=
#init-hook=
# Use multiple processes to speed up Pylint.
# jobs=1
jobs=2
jobs=1
# List of plugins (as comma separated values of python modules names) to load,
# usually to register additional checkers.
@ -52,7 +55,7 @@ confidence=
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
# disable=import-error,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call
disable=print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error
disable=print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error,bad-continuation,pointless-string-statement
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
@ -246,10 +249,10 @@ ignore-comments=yes
ignore-docstrings=yes
# Ignore imports when computing similarities.
ignore-imports=no
ignore-imports=yes
# Minimum lines number of a similarity.
min-similarity-lines=4
min-similarity-lines=12
[BASIC]

View file

@ -1,3 +1,9 @@
<!--
SPDX-FileCopyrightText: 2014 Coraline Ada Ehmke
SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries
SPDX-License-Identifier: CC-BY-4.0
-->
# Adafruit Community Code of Conduct
## Our Pledge
@ -34,6 +40,8 @@ Examples of unacceptable behavior by participants include:
* Excessive or unwelcome helping; answering outside the scope of the question
asked
* Trolling, insulting/derogatory comments, and personal or political attacks
* Promoting or spreading disinformation, lies, or conspiracy theories against
a person, group, organisation, project, or community
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
@ -72,10 +80,10 @@ You may report in the following ways:
In any situation, you may send an email to <support@adafruit.com>.
On the Adafruit Discord, you may send an open message from any channel
to all Community Helpers by tagging @community moderators. You may also send an
open message from any channel, or a direct message to @kattni#1507,
@tannewt#4653, @Dan Halbert#1614, @cater#2442, @sommersoft#0222, or
@Andon#8175.
to all Community Moderators by tagging @community moderators. You may
also send an open message from any channel, or a direct message to
@kattni#1507, @tannewt#4653, @danh#1614, @cater#2442,
@sommersoft#0222, @Mr. Certainly#0472 or @Andon#8175.
Email and direct message reports will be kept confidential.
@ -115,7 +123,7 @@ accordingly.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
This Code of Conduct is adapted from the [Contributor Covenant],
version 1.4, available at
<https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>,
and the [Rust Code of Conduct](https://www.rust-lang.org/en-US/conduct.html).
@ -125,3 +133,5 @@ Conduct, please contact the maintainers of those projects for enforcement.
If you wish to use this code of conduct for your own project, consider
explicitly mentioning your moderation policy or making a copy with your
own moderation policy so as to avoid confusion.
[Contributor Covenant]: https://www.contributor-covenant.org

View file

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) {% now 'utc', '%Y' %} {{ cookiecutter.author }}{% if cookiecutter.company %} for {{ cookiecutter.company }}{% endif %}
Copyright (c) {% now 'utc', '%Y' %} {{ cookiecutter.author_name }}{% if cookiecutter.company %} for {{ cookiecutter.company }}{% endif %}
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -0,0 +1,324 @@
Creative Commons Attribution 4.0 International Creative Commons Corporation
("Creative Commons") is not a law firm and does not provide legal services
or legal advice. Distribution of Creative Commons public licenses does not
create a lawyer-client or other relationship. Creative Commons makes its licenses
and related information available on an "as-is" basis. Creative Commons gives
no warranties regarding its licenses, any material licensed under their terms
and conditions, or any related information. Creative Commons disclaims all
liability for damages resulting from their use to the fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and conditions
that creators and other rights holders may use to share original works of
authorship and other material subject to copyright and certain other rights
specified in the public license below. The following considerations are for
informational purposes only, are not exhaustive, and do not form part of our
licenses.
Considerations for licensors: Our public licenses are intended for use by
those authorized to give the public permission to use material in ways otherwise
restricted by copyright and certain other rights. Our licenses are irrevocable.
Licensors should read and understand the terms and conditions of the license
they choose before applying it. Licensors should also secure all rights necessary
before applying our licenses so that the public can reuse the material as
expected. Licensors should clearly mark any material not subject to the license.
This includes other CC-licensed material, or material used under an exception
or limitation to copyright. More considerations for licensors : wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public licenses, a licensor
grants the public permission to use the licensed material under specified
terms and conditions. If the licensor's permission is not necessary for any
reasonfor example, because of any applicable exception or limitation to copyrightthen
that use is not regulated by the license. Our licenses grant only permissions
under copyright and certain other rights that a licensor has authority to
grant. Use of the licensed material may still be restricted for other reasons,
including because others have copyright or other rights in the material. A
licensor may make special requests, such as asking that all changes be marked
or described. Although not required by our licenses, you are encouraged to
respect those requests where reasonable. More considerations for the public
: wiki.creativecommons.org/Considerations_for_licensees Creative Commons Attribution
4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree to
be bound by the terms and conditions of this Creative Commons Attribution
4.0 International Public License ("Public License"). To the extent this Public
License may be interpreted as a contract, You are granted the Licensed Rights
in consideration of Your acceptance of these terms and conditions, and the
Licensor grants You such rights in consideration of benefits the Licensor
receives from making the Licensed Material available under these terms and
conditions.
Section 1 Definitions.
a. Adapted Material means material subject to Copyright and Similar Rights
that is derived from or based upon the Licensed Material and in which the
Licensed Material is translated, altered, arranged, transformed, or otherwise
modified in a manner requiring permission under the Copyright and Similar
Rights held by the Licensor. For purposes of this Public License, where the
Licensed Material is a musical work, performance, or sound recording, Adapted
Material is always produced where the Licensed Material is synched in timed
relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright and Similar
Rights in Your contributions to Adapted Material in accordance with the terms
and conditions of this Public License.
c. Copyright and Similar Rights means copyright and/or similar rights closely
related to copyright including, without limitation, performance, broadcast,
sound recording, and Sui Generis Database Rights, without regard to how the
rights are labeled or categorized. For purposes of this Public License, the
rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
d. Effective Technological Measures means those measures that, in the absence
of proper authority, may not be circumvented under laws fulfilling obligations
under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996,
and/or similar international agreements.
e. Exceptions and Limitations means fair use, fair dealing, and/or any other
exception or limitation to Copyright and Similar Rights that applies to Your
use of the Licensed Material.
f. Licensed Material means the artistic or literary work, database, or other
material to which the Licensor applied this Public License.
g. Licensed Rights means the rights granted to You subject to the terms and
conditions of this Public License, which are limited to all Copyright and
Similar Rights that apply to Your use of the Licensed Material and that the
Licensor has authority to license.
h. Licensor means the individual(s) or entity(ies) granting rights under this
Public License.
i. Share means to provide material to the public by any means or process that
requires permission under the Licensed Rights, such as reproduction, public
display, public performance, distribution, dissemination, communication, or
importation, and to make material available to the public including in ways
that members of the public may access the material from a place and at a time
individually chosen by them.
j. Sui Generis Database Rights means rights other than copyright resulting
from Directive 96/9/EC of the European Parliament and of the Council of 11
March 1996 on the legal protection of databases, as amended and/or succeeded,
as well as other essentially equivalent rights anywhere in the world.
k. You means the individual or entity exercising the Licensed Rights under
this Public License. Your has a corresponding meaning.
Section 2 Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License, the Licensor
hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive,
irrevocable license to exercise the Licensed Rights in the Licensed Material
to:
A. reproduce and Share the Licensed Material, in whole or in part; and
B. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions
and Limitations apply to Your use, this Public License does not apply, and
You do not need to comply with its terms and conditions.
3. Term. The term of this Public License is specified in Section 6(a).
4. Media and formats; technical modifications allowed. The Licensor authorizes
You to exercise the Licensed Rights in all media and formats whether now known
or hereafter created, and to make technical modifications necessary to do
so. The Licensor waives and/or agrees not to assert any right or authority
to forbid You from making technical modifications necessary to exercise the
Licensed Rights, including technical modifications necessary to circumvent
Effective Technological Measures. For purposes of this Public License, simply
making modifications authorized by this Section 2(a)(4) never produces Adapted
Material.
5. Downstream recipients.
A. Offer from the Licensor Licensed Material. Every recipient of the Licensed
Material automatically receives an offer from the Licensor to exercise the
Licensed Rights under the terms and conditions of this Public License.
B. No downstream restrictions. You may not offer or impose any additional
or different terms or conditions on, or apply any Effective Technological
Measures to, the Licensed Material if doing so restricts exercise of the Licensed
Rights by any recipient of the Licensed Material.
6. No endorsement. Nothing in this Public License constitutes or may be construed
as permission to assert or imply that You are, or that Your use of the Licensed
Material is, connected with, or sponsored, endorsed, or granted official status
by, the Licensor or others designated to receive attribution as provided in
Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not licensed under this
Public License, nor are publicity, privacy, and/or other similar personality
rights; however, to the extent possible, the Licensor waives and/or agrees
not to assert any such rights held by the Licensor to the limited extent necessary
to allow You to exercise the Licensed Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this Public License.
3. To the extent possible, the Licensor waives any right to collect royalties
from You for the exercise of the Licensed Rights, whether directly or through
a collecting society under any voluntary or waivable statutory or compulsory
licensing scheme. In all other cases the Licensor expressly reserves any right
to collect such royalties.
Section 3 License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the following
conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified form), You must:
A. retain the following if it is supplied by the Licensor with the Licensed
Material:
i. identification of the creator(s) of the Licensed Material and any others
designated to receive attribution, in any reasonable manner requested by the
Licensor (including by pseudonym if designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of warranties;
v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
B. indicate if You modified the Licensed Material and retain an indication
of any previous modifications; and
C. indicate the Licensed Material is licensed under this Public License, and
include the text of, or the URI or hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner
based on the medium, means, and context in which You Share the Licensed Material.
For example, it may be reasonable to satisfy the conditions by providing a
URI or hyperlink to a resource that includes the required information.
3. If requested by the Licensor, You must remove any of the information required
by Section 3(a)(1)(A) to the extent reasonably practicable.
4. If You Share Adapted Material You produce, the Adapter's License You apply
must not prevent recipients of the Adapted Material from complying with this
Public License.
Section 4 Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that apply to
Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract,
reuse, reproduce, and Share all or a substantial portion of the contents of
the database;
b. if You include all or a substantial portion of the database contents in
a database in which You have Sui Generis Database Rights, then the database
in which You have Sui Generis Database Rights (but not its individual contents)
is Adapted Material; and
c. You must comply with the conditions in Section 3(a) if You Share all or
a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not replace
Your obligations under this Public License where the Licensed Rights include
other Copyright and Similar Rights.
Section 5 Disclaimer of Warranties and Limitation of Liability.
a. Unless otherwise separately undertaken by the Licensor, to the extent possible,
the Licensor offers the Licensed Material as-is and as-available, and makes
no representations or warranties of any kind concerning the Licensed Material,
whether express, implied, statutory, or other. This includes, without limitation,
warranties of title, merchantability, fitness for a particular purpose, non-infringement,
absence of latent or other defects, accuracy, or the presence or absence of
errors, whether or not known or discoverable. Where disclaimers of warranties
are not allowed in full or in part, this disclaimer may not apply to You.
b. To the extent possible, in no event will the Licensor be liable to You
on any legal theory (including, without limitation, negligence) or otherwise
for any direct, special, indirect, incidental, consequential, punitive, exemplary,
or other losses, costs, expenses, or damages arising out of this Public License
or use of the Licensed Material, even if the Licensor has been advised of
the possibility of such losses, costs, expenses, or damages. Where a limitation
of liability is not allowed in full or in part, this limitation may not apply
to You.
c. The disclaimer of warranties and limitation of liability provided above
shall be interpreted in a manner that, to the extent possible, most closely
approximates an absolute disclaimer and waiver of all liability.
Section 6 Term and Termination.
a. This Public License applies for the term of the Copyright and Similar Rights
licensed here. However, if You fail to comply with this Public License, then
Your rights under this Public License terminate automatically.
b. Where Your right to use the Licensed Material has terminated under Section
6(a), it reinstates:
1. automatically as of the date the violation is cured, provided it is cured
within 30 days of Your discovery of the violation; or
2. upon express reinstatement by the Licensor.
c. For the avoidance of doubt, this Section 6(b) does not affect any right
the Licensor may have to seek remedies for Your violations of this Public
License.
d. For the avoidance of doubt, the Licensor may also offer the Licensed Material
under separate terms or conditions or stop distributing the Licensed Material
at any time; however, doing so will not terminate this Public License.
e. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
Section 7 Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different terms or
conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the Licensed
Material not stated herein are separate from and independent of the terms
and conditions of this Public License.
Section 8 Interpretation.
a. For the avoidance of doubt, this Public License does not, and shall not
be interpreted to, reduce, limit, restrict, or impose conditions on any use
of the Licensed Material that could lawfully be made without permission under
this Public License.
b. To the extent possible, if any provision of this Public License is deemed
unenforceable, it shall be automatically reformed to the minimum extent necessary
to make it enforceable. If the provision cannot be reformed, it shall be severed
from this Public License without affecting the enforceability of the remaining
terms and conditions.
c. No term or condition of this Public License will be waived and no failure
to comply consented to unless expressly agreed to by the Licensor.
d. Nothing in this Public License constitutes or may be interpreted as a limitation
upon, or waiver of, any privileges and immunities that apply to the Licensor
or You, including from the legal processes of any jurisdiction or authority.
Creative Commons is not a party to its public licenses. Notwithstanding, Creative
Commons may elect to apply one of its public licenses to material it publishes
and in those instances will be considered the "Licensor." The text of the
Creative Commons public licenses is dedicated to the public domain under the
CC0 Public Domain Dedication. Except for the limited purpose of indicating
that material is shared under a Creative Commons public license or as otherwise
permitted by the Creative Commons policies published at creativecommons.org/policies,
Creative Commons does not authorize the use of the trademark "Creative Commons"
or any other trademark or logo of Creative Commons without its prior written
consent including, without limitation, in connection with any unauthorized
modifications to any of its public licenses or any other arrangements, understandings,
or agreements concerning use of licensed material. For the avoidance of doubt,
this paragraph does not form part of the public licenses.
Creative Commons may be contacted at creativecommons.org.

View file

@ -0,0 +1,19 @@
MIT License Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -0,0 +1,20 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute
this software, either in source code form or as a compiled binary, for any
purpose, commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this
software dedicate any and all copyright interest in the software to the public
domain. We make this dedication for the benefit of the public at large and
to the detriment of our heirs and successors. We intend this dedication to
be an overt act of relinquishment in perpetuity of all present and future
rights to this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information,
please refer to <https://unlicense.org/>

View file

@ -9,22 +9,30 @@
Introduction
============
{% if cookiecutter.sphinx_docs | lower in ["yes", "y"] %}
.. image:: https://readthedocs.org/projects/{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | lower | replace("_", "-")}}-{% endif %}circuitpython-{{ cookiecutter.library_name | lower }}/badge/?version=latest
{%- if cookiecutter.library_prefix %}
{%- if cookiecutter.target_bundle == 'Adafruit' %}
:target: https://circuitpython.readthedocs.io/projects/{{ cookiecutter.library_name | lower }}/en/latest/
{%- else %}
:target: https://circuitpython-{{ cookiecutter.library_name | lower }}.readthedocs.io/
{%- endif %}
:alt: Documentation Status
{% endif %}
.. image:: https://img.shields.io/discord/327254708534116352.svg
:target: https://discord.gg/nBQh6qu
:target: https://adafru.it/discord
:alt: Discord
.. image:: https://travis-ci.com/{{ full_repo_name }}.svg?branch=master
:target: https://travis-ci.com/{{ full_repo_name }}
.. image:: https://github.com/{{ full_repo_name }}/workflows/Build%20CI/badge.svg
:target: https://github.com/{{ full_repo_name }}/actions
:alt: Build Status
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
:alt: Code Style: Black
{% if cookiecutter.library_description != "" %}
{{- cookiecutter.library_description }}
{% else %}
@ -45,7 +53,21 @@ This driver depends on:
Please ensure all dependencies are available on the CircuitPython filesystem.
This is easily achieved by downloading
`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.
`the Adafruit library and driver bundle <https://circuitpython.org/libraries>`_
or individual libraries can be installed using
`circup <https://github.com/adafruit/circup>`_.
{%- if cookiecutter.target_bundle == 'Adafruit' %}
.. todo:: Describe the Adafruit product this library works with. For PCBs, you can also add the
image from the assets folder in the PCB's GitHub repo.
`Purchase one from the Adafruit shop <http://www.adafruit.com/products/{{cookiecutter.adafruit_pid}}>`_
{% endif -%}
{%- if cookiecutter.pypi_release in ["y", "yes"] -%}
Installing from PyPI
=====================
@ -53,10 +75,10 @@ Installing from PyPI
as a standard element. Stay tuned for PyPI availability!
.. todo:: Remove the above note if PyPI version is/will be available at time of release.
If the library is not planned for PyPI, remove the entire 'Installing from PyPI' section.
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
PyPI <https://pypi.org/project/adafruit-circuitpython-{{ cookiecutter.library_name|lower }}/>`_. To install for current user:
PyPI <https://pypi.org/project/adafruit-circuitpython-{{ cookiecutter.library_name|lower }}/>`_.
To install for current user:
.. code-block:: shell
@ -77,37 +99,23 @@ To install in a virtual environment in your current project:
source .env/bin/activate
pip3 install adafruit-circuitpython-{{ pypi_name }}
{% endif %}
Usage Example
=============
.. todo:: Add a quick, simple example. It and other examples should live in the examples folder and be included in docs/examples.rst.
.. todo:: Add a quick, simple example. It and other examples should live in the
examples folder and be included in docs/examples.rst.
Contributing
============
Contributions are welcome! Please read our `Code of Conduct
<https://github.com/{{ full_repo_name }}/blob/master/CODE_OF_CONDUCT.md>`_
<https://github.com/{{ full_repo_name }}/blob/{{cookiecutter.default_branch}}/CODE_OF_CONDUCT.md>`_
before contributing to help this project stay welcoming.
Sphinx documentation
-----------------------
Documentation
=============
Sphinx is used to build the documentation based on rST files and comments in the code. First,
install dependencies (feel free to reuse the virtual environment from above):
.. code-block:: shell
python3 -m venv .env
source .env/bin/activate
pip install Sphinx sphinx-rtd-theme
Now, once you have the virtual environment activated:
.. code-block:: shell
cd docs
sphinx-build -E -W -b html . _build/html
This will output the documentation to ``docs/_build/html``. Open the index.html in your browser to
view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to
locally verify it will pass.
For information on building library documentation, please check out
`this guide <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1>`_.

View file

@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
SPDX-FileCopyrightText: Copyright (c) {% now 'utc', '%Y' %} {{ cookiecutter.author_name }}{% if cookiecutter.company %} for {{ cookiecutter.company }}{% endif %}
SPDX-License-Identifier: MIT

View file

@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries
SPDX-License-Identifier: CC-BY-4.0

View file

@ -0,0 +1,4 @@
SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
SPDX-FileCopyrightText: Copyright (c) {% now 'utc', '%Y' %} {{ cookiecutter.author_name }}{% if cookiecutter.company %} for {{ cookiecutter.company }}{% endif %}
SPDX-License-Identifier: MIT

View file

@ -1,8 +1,13 @@
# -*- coding: utf-8 -*-
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath(".."))
# -- General configuration ------------------------------------------------
@ -10,10 +15,10 @@ sys.path.insert(0, os.path.abspath('..'))
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.napoleon',
'sphinx.ext.todo',
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.napoleon",
"sphinx.ext.todo",
]
# TODO: Please Read!
@ -23,36 +28,41 @@ extensions = [
# autodoc_mock_imports = ["digitalio", "busio"]
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),
intersphinx_mapping = {
"python": ("https://docs.python.org/3.4", None),
{%- if cookiecutter.requires_bus_device in ["y", "yes"] -%}
'BusDevice': ('https://circuitpython.readthedocs.io/projects/busdevice/en/latest/', None),
{%- endif -%}
"BusDevice": ("https://circuitpython.readthedocs.io/projects/busdevice/en/latest/", None),
{% endif %}
{%- if cookiecutter.requires_register in ["y", "yes"] -%}
'Register': ('https://circuitpython.readthedocs.io/projects/register/en/latest/', None),
{%- endif -%}
'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}
"Register": ("https://circuitpython.readthedocs.io/projects/register/en/latest/", None),
{%- endif %}
"CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None),
}
# Show the docstring from both the class and its __init__() method.
autoclass_content = "both"
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]
source_suffix = '.rst'
source_suffix = ".rst"
# The master toctree document.
master_doc = 'index'
master_doc = "index"
# General information about the project.
project = u'{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }} {% endif %}{{ cookiecutter.library_name }} Library'
copyright = u'{% now 'utc', '%Y' %} {{ cookiecutter.author }}'
author = u'{{ cookiecutter.author }}'
project = "{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }} {% endif %} CircuitPython {{ cookiecutter.library_name }} Library"
copyright = "{% now 'utc', '%Y' %} {{ cookiecutter.author_name }}"
author = "{{ cookiecutter.author_name }}"
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = u'1.0'
version = "1.0"
# The full version, including alpha/beta/rc tags.
release = u'1.0'
release = "1.0"
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@ -64,7 +74,13 @@ language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.env', 'CODE_OF_CONDUCT.md']
exclude_patterns = [
"_build",
"Thumbs.db",
".DS_Store",
".env",
"CODE_OF_CONDUCT.md",
]
# The reST default role (used for this markup: `text`) to use for all
# documents.
@ -76,7 +92,7 @@ default_role = "any"
add_function_parentheses = True
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
@ -91,50 +107,44 @@ napoleon_numpy_docstring = False
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
if not on_rtd: # only import and set the theme if we're building docs locally
try:
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.']
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."]
except:
html_theme = 'default'
html_theme_path = ['.']
html_theme = "default"
html_theme_path = ["."]
else:
html_theme_path = ['.']
html_theme_path = ["."]
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]
# The name of an image file (relative to this directory) to use as a favicon of
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#
html_favicon = '_static/favicon.ico'
html_favicon = "_static/favicon.ico"
# Output file base name for HTML help builder.
htmlhelp_basename = '{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }}{% endif %}{{ cookiecutter.library_name | capitalize }}Librarydoc'
htmlhelp_basename = "{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }}_{% endif %}CircuitPython_{{ cookiecutter.library_name | capitalize }}Librarydoc"
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
@ -142,8 +152,13 @@ latex_elements = {
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, '{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }}{% endif %}{{ cookiecutter.library_name }}Library.tex', u'{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }}{% endif %}{{ cookiecutter.library_name }} Library Documentation',
author, 'manual'),
(
master_doc,
"{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }}_{% endif %}CircuitPython_{{ cookiecutter.library_name }}Library.tex",
"{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }} {% endif %}CircuitPython {{ cookiecutter.library_name }} Library Documentation",
author,
"manual",
),
]
# -- Options for manual page output ---------------------------------------
@ -151,8 +166,13 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, '{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }}{% endif %}{{ cookiecutter.library_name }}library', u'{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }} {% endif %}{{ cookiecutter.library_name }} Library Documentation',
[author], 1)
(
master_doc,
"{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }}_{% endif %}CircuitPython_{{ cookiecutter.library_name }}Library",
"{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }} {% endif %}CircuitPython {{ cookiecutter.library_name }} Library Documentation",
[author],
1,
),
]
# -- Options for Texinfo output -------------------------------------------
@ -161,7 +181,13 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, '{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }}{% endif %}{{ cookiecutter.library_name }}Library', u'{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }}{% endif %} {{ cookiecutter.library_name }} Library Documentation',
author, '{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }}{% endif %}{{ cookiecutter.library_name }}Library', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
"{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }}_{% endif %}CircuitPython_{{ cookiecutter.library_name }}Library",
"{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }} {% endif %}CircuitPython {{ cookiecutter.library_name }} Library Documentation",
author,
"{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }}_{% endif %}CircuitPython_{{ cookiecutter.library_name }}Library",
"One line description of project.",
"Miscellaneous",
),
]

View file

@ -0,0 +1,4 @@
SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
SPDX-FileCopyrightText: Copyright (c) {% now 'utc', '%Y' %} {{ cookiecutter.author_name }}{% if cookiecutter.company %} for {{ cookiecutter.company }}{% endif %}
SPDX-License-Identifier: MIT

View file

@ -1,10 +1,3 @@
{% if cookiecutter.library_prefix -%}
{% set prefix = cookiecutter.library_prefix + "_" -%}
{% else -%}
{% set prefix = '' -%}
{% endif -%}
{% set repo_name = prefix + "CircuitPython_" + cookiecutter.library_name -%}
{% set full_repo_name = cookiecutter.github_user + "/" + repo_name -%}
.. include:: ../README.rst
@ -43,7 +36,7 @@ Table of Contents
.. toctree::
:caption: Other Links
Download <https://github.com/{{ full_repo_name }}/releases/latest>
Download <https://github.com/{{ cookiecutter.github_user }}/{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize}}_{% endif %}CircuitPython_{{ cookiecutter.library_name }}/releases/latest>
CircuitPython Reference Documentation <https://circuitpython.readthedocs.io>
CircuitPython Support Forum <https://forums.adafruit.com/viewforum.php?f=60>
Discord Chat <https://adafru.it/discord>

View file

@ -0,0 +1,4 @@
SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
SPDX-FileCopyrightText: Copyright (c) {% now 'utc', '%Y' %} {{ cookiecutter.author_name }}{% if cookiecutter.company %} for {{ cookiecutter.company }}{% endif %}
SPDX-License-Identifier: MIT

View file

@ -0,0 +1,4 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
# SPDX-FileCopyrightText: Copyright (c) {% now 'utc', '%Y' %} {{ cookiecutter.author_name }}{% if cookiecutter.company %} for {{ cookiecutter.company }}{% endif %}
#
# SPDX-License-Identifier: Unlicense

View file

@ -0,0 +1,6 @@
# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò
#
# SPDX-License-Identifier: Unlicense
[tool.black]
target-version = ['py35']

View file

@ -1,3 +1,8 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
# SPDX-FileCopyrightText: Copyright (c) {% now 'utc', '%Y' %} {{ cookiecutter.author_name }}{% if cookiecutter.company %} for {{ cookiecutter.company }}{% endif %}
#
# SPDX-License-Identifier: MIT
{% set req_list = namespace(items=["Adafruit-Blinka"]) %}
{%- if cookiecutter.requires_bus_device in ["y", "yes"] -%}
{%- do req_list.items.append("adafruit-circuitpython-busdevice") -%}
@ -9,4 +14,4 @@
{%- set tests = cookiecutter.other_requirements -%}
{%- do req_list.items.extend(tests.replace(" ", "").split(",")) -%}
{%- endif -%}
{{ req_list.items|unique|join("\n") }}
{{ req_list.items|sort|unique|join("\n") }}

View file

@ -0,0 +1,40 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
# SPDX-FileCopyrightText: Copyright (c) {% now 'utc', '%Y' %} {{ cookiecutter.author_name }}{% if cookiecutter.company %} for {{ cookiecutter.company }}{% endif %}
#
# SPDX-License-Identifier: MIT
"""
`{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | lower }}_{% endif %}{{ cookiecutter.library_name | lower }}`
================================================================================
{% if cookiecutter.library_description != "" %}
{{- cookiecutter.library_description }}
{% else %}
.. todo:: Describe what the library does.
{% endif %}
* Author(s): {{ cookiecutter.author_name }}
Implementation Notes
--------------------
**Hardware:**
.. todo:: Add links to any specific hardware product page(s), or category page(s).
Use unordered list & hyperlink rST inline format: "* `Link Text <url>`_"
**Software and Dependencies:**
* Adafruit CircuitPython firmware for the supported boards:
https://github.com/adafruit/circuitpython/releases
.. todo:: Uncomment or remove the Bus Device and/or the Register library dependencies
based on the library's use of either.
# * Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
# * Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
"""
# imports
__version__ = "0.0.0-auto.0"
__repo__ = "https://github.com/{{ cookiecutter.github_user }}/{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize}}_{% endif %}CircuitPython_{{ cookiecutter.library_name }}.git"

View file

@ -0,0 +1,9 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
# SPDX-FileCopyrightText: Copyright (c) {% now 'utc', '%Y' %} {{ cookiecutter.author_name }}{% if cookiecutter.company %} for {{ cookiecutter.company }}{% endif %}
#
# SPDX-License-Identifier: MIT
"""
This library is not deployed to PyPI. It is either a board-specific helper library, or
does not make sense for use on or is incompatible with single board computers and Linux.
"""

View file

@ -0,0 +1,103 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
# SPDX-FileCopyrightText: Copyright (c) {% now 'utc', '%Y' %} {{ cookiecutter.author_name }}{% if cookiecutter.company %} for {{ cookiecutter.company }}{% endif %}
#
# SPDX-License-Identifier: MIT
{# create list of requirements #}
{%- set req_list = namespace(items=["Adafruit-Blinka"]) -%}
{%- if cookiecutter.requires_bus_device in ["y", "yes"] -%}
{%- do req_list.items.append("adafruit-circuitpython-busdevice") -%}
{%- endif %}
{%- if cookiecutter.requires_register in ["y", "yes"] %}
{%- do req_list.items.append("adafruit-circuitpython-register") -%}
{%- endif %}
{%- if cookiecutter.other_requirements != "" %}
{%- set tests = cookiecutter.other_requirements -%}
{%- do req_list.items.extend(tests.replace(" ", "").split(",")) -%}
{%- endif -%}
{# put keywords into an iterable list, based on word wrapping #}
{%- set kw_list = namespace(kw_list=[], default=["adafruit", "blinka", "circuitpython", "micropython"]) -%}
{%- do kw_list.default.append(cookiecutter.library_name|lower) -%}
{%- do kw_list.default.extend(cookiecutter.library_keywords.split(" ")) -%}
{%- set wrapped = kw_list.default|unique|join(" ")|wordwrap(break_long_words=False) -%}
{%- do kw_list.kw_list.extend(wrapped.split("\n")) -%}
{# create repo and pypi names #}
{%- if cookiecutter.library_prefix -%}
{%- set repo_name = (cookiecutter.library_prefix | capitalize) -%}
{%- set repo_name = repo_name + '_CircuitPython_' -%}
{%- set repo_name = repo_name + cookiecutter.library_name -%}
{%- else -%}
{%- set repo_name = 'CircuitPython_' + cookiecutter.library_name -%}
{%- endif -%}
{%- set pypi_name = repo_name|lower|replace("_", "-") -%}
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, "README.rst"), encoding="utf-8") as f:
long_description = f.read()
setup(
{% if cookiecutter.target_bundle == 'Adafruit' -%}
# Adafruit Bundle Information
name="{{ pypi_name }}",
use_scm_version=True,
setup_requires=["setuptools_scm"],
description="{{ cookiecutter.library_description }}",
long_description=long_description,
long_description_content_type="text/x-rst",
# The project's main homepage.
url="https://github.com/{{ cookiecutter.github_user }}/{{ repo_name }}.git",
# Author details
author="Adafruit Industries",
author_email="circuitpython@adafruit.com",
{%- else -%}
# Community Bundle Information
name="{{ pypi_name }}",
use_scm_version=True,
setup_requires=["setuptools_scm"],
description="{{ cookiecutter.library_description }}",
long_description=long_description,
long_description_content_type="text/x-rst",
# The project's main homepage.
url="https://github.com/{{ cookiecutter.github_user }}/{{ repo_name }}.git",
# Author details
author="{{ cookiecutter.author_name }}",
author_email="",
{%- endif %}
install_requires=[
"{{ req_list.items|sort|unique|join('",\n"')|indent(width=8) }}",
],
# Choose your license
license="MIT",
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries",
"Topic :: System :: Hardware",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
],
# What does your project relate to?
keywords="{{ kw_list.kw_list|sort|unique|join(' "\n"')|indent(width=13) }}",
# You can just specify the packages manually here if your project is
# simple. Or you can use find_packages().
# TODO: IF LIBRARY FILES ARE A PACKAGE FOLDER,
# CHANGE `py_modules=['...']` TO `packages=['...']`
py_modules=["{%- if cookiecutter.library_prefix != '' -%}{{ cookiecutter.library_prefix|lower }}_{%- endif -%}{{- cookiecutter.library_name|lower -}}"],
)

View file

@ -0,0 +1,7 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
python:
version: 3
requirements_file: requirements.txt

View file

@ -1,13 +0,0 @@
*.mpy
.idea
__pycache__
_build
*.pyc
.env
build*
bundles
*.DS_Store
.eggs
dist
**/*.egg-info
.vscode

View file

@ -1,3 +0,0 @@
python:
version: 3
requirements_file: requirements.txt

View file

@ -1,48 +0,0 @@
# This is a common .travis.yml for generating library release zip files for
# CircuitPython library releases using circuitpython-build-tools.
# See https://github.com/adafruit/circuitpython-build-tools for detailed setup
# instructions.
dist: xenial
language: python
python:
- "3.6"
cache:
pip: true
# TODO: if deployment to PyPi is desired, change 'DEPLOY_PYPI' to "true",
# or remove the env block entirely and remove the condition in the
# deploy block.
env:
- DEPLOY_PYPI="false"
deploy:
- provider: releases
api_key: "$GITHUB_TOKEN"
file_glob: true
file: "$TRAVIS_BUILD_DIR/bundles/*"
skip_cleanup: true
overwrite: true
on:
tags: true
# TODO: Use 'travis encrypt --com -r adafruit/<repo slug>' to generate
# the encrypted password for adafruit-travis. Paste result below.
- provider: pypi
user: adafruit-travis
password:
secure: #-- PASTE ENCRYPTED PASSWORD HERE --#
on:
tags: true
condition: $DEPLOY_PYPI = "true"
install:
- pip install -r requirements.txt
- pip install circuitpython-build-tools Sphinx sphinx-rtd-theme
- pip install --force-reinstall pylint==1.9.2
script:
- pylint {% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | lower }}_{% endif %}{{ cookiecutter.library_name | lower }}.py
- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,bad-whitespace examples/*.py)
- circuitpython-build-bundles --filename_prefix {% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | lower }}-{% endif %}circuitpython-{{ cookiecutter.library_name | lower }} --library_location .
- cd docs && sphinx-build -E -W -b html . _build/html && cd ..

View file

@ -1,82 +0,0 @@
{# create list of requirements #}
{%- set req_list = namespace(items=["Adafruit-Blinka"]) -%}
{%- if cookiecutter.requires_bus_device in ["y", "yes"] -%}
{%- do req_list.items.append("adafruit-circuitpython-busdevice") -%}
{%- endif %}
{%- if cookiecutter.requires_register in ["y", "yes"] %}
{%- do req_list.items.append("adafruit-circuitpython-register") -%}
{%- endif %}
{%- if cookiecutter.other_requirements != "" %}
{%- set tests = cookiecutter.other_requirements -%}
{%- do req_list.items.extend(tests.replace(" ", "").split(",")) -%}
{%- endif -%}
{# put keywords into an iterable list, based on word wrapping #}
{%- set kw_list = namespace(kw_list=[], default=["adafruit", "blinka", "circuitpython", "micropython"]) -%}
{%- do kw_list.default.append(cookiecutter.library_name|lower) -%}
{%- do kw_list.default.extend(cookiecutter.library_keywords.split(" ")) -%}
{%- set wrapped = kw_list.default|unique|join(" ")|wordwrap(break_long_words=False) -%}
{%- do kw_list.kw_list.extend(wrapped.split("\n")) -%}
{%- set pypi_name = cookiecutter.library_name|lower|replace("_", "-") -%}
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='adafruit-circuitpython-{{ pypi_name }}',
use_scm_version=True,
setup_requires=['setuptools_scm'],
description='{{ cookiecutter.library_description }}',
long_description=long_description,
long_description_content_type='text/x-rst',
# The project's main homepage.
url='https://github.com/adafruit/Adafruit_CircuitPython_{{ cookiecutter.library_name }}',
# Author details
author='Adafruit Industries',
author_email='circuitpython@adafruit.com',
install_requires=[
'{{ req_list.items|unique|join("',\n'")|indent(width=8) }}'
],
# Choose your license
license='MIT',
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Topic :: Software Development :: Libraries',
'Topic :: System :: Hardware',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
],
# What does your project relate to?
keywords='{{ kw_list.kw_list|join(" '\n'")|indent(width=13) }}',
# You can just specify the packages manually here if your project is
# simple. Or you can use find_packages().
# TODO: IF LIBRARY FILES ARE A PACKAGE FOLDER,
# CHANGE `py_modules=['...']` TO `packages=['...']`
py_modules=['{%- if cookiecutter.library_prefix != "" -%}{{ cookiecutter.library_prefix|lower }}_{%- endif -%}{{- cookiecutter.library_name|lower -}}'],
)

View file

@ -1,56 +0,0 @@
# The MIT License (MIT)
#
# Copyright (c) {% now 'utc', '%Y' %} {{ cookiecutter.author }}{% if cookiecutter.company %} for {{ cookiecutter.company }}{% endif %}
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
"""
`{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | lower }}_{% endif %}{{ cookiecutter.library_name | lower }}`
================================================================================
{% if cookiecutter.library_description != "" %}
{{- cookiecutter.library_description }}
{% else %}
.. todo:: Describe what the library does.
{% endif %}
* Author(s): {{ cookiecutter.author }}
Implementation Notes
--------------------
**Hardware:**
.. todo:: Add links to any specific hardware product page(s), or category page(s). Use unordered list & hyperlink rST
inline format: "* `Link Text <url>`_"
**Software and Dependencies:**
* Adafruit CircuitPython firmware for the supported boards:
https://github.com/adafruit/circuitpython/releases
.. todo:: Uncomment or remove the Bus Device and/or the Register library dependencies based on the library's use of either.
# * Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
# * Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
"""
# imports
__version__ = "0.0.0-auto.0"
__repo__ = "https://github.com/{{ cookiecutter.github_user }}/{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize}}_{% endif %}CircuitPython_{{ cookiecutter.library_name }}.git"