Compare commits

...

113 commits

Author SHA1 Message Date
11090de1dd
chardet workaround no longer needed 2022-07-11 10:33:26 -05:00
6d94330763
Merge remote-tracking branch 'origin/main' into ansys-cookiecutter 2022-07-11 10:32:01 -05:00
Alec Delaney
e52ff90e65
Merge pull request #188 from tekktrik/fix/update-cookiecutter
Set language in docs/conf.py to "en"
2022-07-09 16:28:48 -04:00
Alec Delaney
5249bf3fb1 Fix required entry test failure 2022-07-09 11:35:20 -04:00
Alec Delaney
d1d4621a59 Remove overwriting extensions 2022-07-09 11:33:46 -04:00
Alec Delaney
ed5472337b Fix target_bunle argument 2022-07-09 11:31:24 -04:00
Alec Delaney
348b5b22b9 Fix mssing elif 2022-07-09 11:30:55 -04:00
Alec Delaney
e0897a3586 Set language in docs/conf.py to "en" 2022-07-09 11:22:26 -04:00
c9b7899099
for now pin chardet 2022-06-27 11:37:50 -05:00
52badab314
Merge remote-tracking branch 'origin/main' into ansys-cookiecutter 2022-06-27 10:09:22 -05:00
f31e73700a
switch to cookiecutter 2.1.0 for tests 2022-06-27 10:07:25 -05:00
Alec Delaney
6675a7d766
Move problem matchers step back
@kattni, I'm changing this back via patch because I ended up checking out what this step does and the instructions behind it say it should go before the tests (I assume `pre-commit` tests).  I didn't realize it's intended to help visually show where the errors are.  I'll make sure this is contained in the library patch because I think some libraries have it as the last step, which I think means it won't work.
2022-05-16 10:34:05 -04:00
Alec Delaney
ef5e3f71e1
Update .pylintrc
Add disable for unspecified encoding
2022-05-15 17:56:20 -04:00
Alec Delaney
ff3caf6f6c
Update cookiecutter build.yml
Don't pip install pylint, move problem matchers step, correct minor typo
2022-05-15 17:54:16 -04:00
Alec Delaney
9eec9be1b3
Update .pre-commit-config.yaml to align with patch changes 2022-05-15 16:39:45 -04:00
Kattni
4aea673a10
Merge pull request #182 from xsc27/bump-pre-commit
ci(pre-commit): bump pre-commit hooks
2022-05-03 17:12:01 -04:00
Carlos Meza
cf5cd61e9e ci(pre-commit): remove types from "pylint (library code)"
types is already defined by the hook definiton
2022-05-03 15:01:37 -06:00
Carlos Meza
5f47325360 fix(pre-commit): made indentation consistent
proper yaml syntax
2022-05-03 15:01:34 -06:00
Carlos Meza
0978a63d0e ci(pre-commit): bump pre-commit hooks 2022-05-03 15:00:53 -06:00
Eva Herrada
5e20bc3b89
Updated black 2022-04-25 13:59:30 -04:00
foamyguy
f25b525bb5
Merge pull request #181 from kattni/badge-and-ignore
Please test: Update chat badge and .gitignore
2022-04-21 20:01:20 -05:00
Patrick
f046c3af19 Fix whitespace around ifs 2022-04-21 15:48:01 -07:00
Kattni Rembor
7b763601fb Update syntax. 2022-04-21 17:50:55 -04:00
Kattni Rembor
3159041a2b Update chat badge and .gitignore 2022-04-21 12:46:38 -04:00
Kattni
12dfdb9e82
Merge pull request #179 from kattni/gitignore-update
Update generated library .gitignore
2022-04-07 12:55:13 -04:00
Kattni Rembor
100c6d01e6 Further updates. 2022-04-05 15:04:18 -04:00
Kattni Rembor
05daa18c3b Requested updates. 2022-04-04 17:32:08 -04:00
Kattni Rembor
d98e8a75a7 Update generated library .gitignore 2022-04-04 16:41:21 -04:00
cdb5fbb35e
store correct line endings 2022-03-28 10:04:53 -05:00
4631bfc982
document how to install cookiecutter 2.0.2 2022-03-28 10:02:26 -05:00
0cb80a8235
fix license of conditional templated files 2022-03-28 10:00:14 -05:00
9aeef85a9c
fix rest of file generation 2022-03-28 09:44:29 -05:00
b78f6e847c
this hook didn't do what was intended anyway 2022-03-28 09:40:43 -05:00
1552f15001
test on windows and mac, python 3.7 and latest stable 2022-03-28 09:26:36 -05:00
26e3896e2f
Use ansys cookiecutter, fix windows compatibility
Windows can't handle certain characters in filenames, among them
the pipe and double quote characters.

future cookiecutter 2.x will have a way to avoid these: private variables,
calculated within the cookiecutter.json file.

Once cookiecutter 2.x is released, we can switch away from ansys back to
upstream.
2022-03-28 09:18:02 -05:00
ac4b448dd3
Make tests run with cookiecutter2 2022-03-28 09:01:08 -05:00
978f35d316
switch to ansys-cookiecutter 2022-03-28 08:52:56 -05:00
Kattni
871e0a43e5
Merge pull request #176 from adafruit/evaherrada-patch-1
Changed pylint version to v2.11.1
2022-03-24 16:01:27 -04:00
Eva Herrada
9eb05470d3
Changed pylint version to v2.11.1 2022-03-24 15:48:31 -04:00
foamyguy
ee545a64ed
Merge pull request #172 from tekktrik/dev/fix-cookie-cutter
Fix cookiecutter issues
2022-02-11 14:51:57 -06:00
tekktrik
65d445d716
Swap Documentation and Contributing sections of README 2022-02-11 10:46:41 -05:00
tekktrik
876c936b4d
Update link for CircuitPython firmware download 2022-02-11 10:46:00 -05:00
Kattni
c95c074cba
Merge pull request #169 from askpatrickw/rtd-python-ver
correct python version for RTD
2022-01-28 15:23:49 -05:00
Patrick
d3d88ece29 Change to new RTD yaml schema 2022-01-28 11:03:33 -08:00
Kattni
507287ffc7
Merge pull request #167 from FoamyGuy/docs_link_readme
add docs link to documentation section in readme
2022-01-28 12:32:11 -05:00
Patrick
0c2f38ca2f correct python version for RTD 2022-01-27 16:13:04 -08:00
foamyguy
26e2e42cc3 remove extra whitespace 2022-01-27 18:04:13 -06:00
foamyguy
a40308fbc1 add docs link to documentation section in readme 2022-01-27 18:00:08 -06:00
Jeff Epler
46e5e6795f
Merge pull request #165 from kattni/update-documentation-link
Update CP docs links.
2022-01-13 14:33:49 -06:00
Kattni Rembor
483ec38ef9 Update CP docs links. 2022-01-13 15:25:35 -05:00
Kattni
43b12b80a3
Merge pull request #163 from dhalbert/python3
Don't use specific CPython versions
2021-12-21 11:06:33 -05:00
Dan Halbert
35e17dc619 don't use specific CPython versions 2021-12-20 19:30:19 -05:00
foamyguy
3c5481339b
Merge pull request #162 from FoamyGuy/fix_newlines
fix newlines near import comment and version string
2021-11-21 13:57:50 -06:00
foamyguy
b413f72300 fix newlines near import comment and version string 2021-11-21 12:25:27 -06:00
Keith Murray
63e7324b56
Merge pull request #160 from kattni/rtd-config
Update .readthedocs.yml
2021-11-09 11:55:17 -06:00
Kattni Rembor
0d967606bd Add docs requirements.txt 2021-11-09 12:14:38 -05:00
Kattni Rembor
a54bbd2a00 Proper RTD config. 2021-11-08 16:58:41 -05:00
Kattni Rembor
d9db2c122e Update .readthedocs.yml 2021-11-08 15:21:28 -05:00
Kattni
84faf428c8
Merge pull request #159 from kattni/add-cp-org
Add cp.org link
2021-11-03 18:01:25 -04:00
Kattni Rembor
c1716ef43f Add cp.org link 2021-11-03 17:18:34 -04:00
Kattni
202022abd2
Merge pull request #156 from caternuson/disable_consider
Add disable for consider-using-f-string
2021-10-20 18:27:52 -04:00
caternuson
8054491d78 dont consider 2021-10-20 15:21:12 -07:00
Scott Shawcroft
fe0abf2f9b
Merge pull request #155 from FoamyGuy/repo_url
fix repo name inside of py file
2021-10-14 11:52:56 -07:00
foamyguy
f1a402f790 fix repo name inside of py file 2021-10-13 20:07:56 -05:00
Jeff Epler
893ce305ab
Merge pull request #153 from ajs256/pid-to-project-id
Change `pid` prompt to `product_id`
2021-10-04 13:54:35 -05:00
ajs256
c01da412a4
typo fix 🤦 2021-10-03 19:39:54 -07:00
ajs256
23cb8ec52e Change pid prompt to product_id 2021-10-03 19:33:50 -07:00
foamyguy
c8a9cf54de
Merge pull request #146 from lesamouraipourpre/pypi-munging-improved
Improved method of munging in the version.
2021-09-23 19:22:52 -05:00
foamyguy
502247dec0 Merge branch 'main' into pypi-munging-improved
# Conflicts:
#	{{ cookiecutter and 'tmp_repo' }}/{% if cookiecutter.pypi_release in ['y', 'yes'] %}setup.py{% endif %}
2021-09-21 18:31:37 -05:00
foamyguy
feb75dcd7c
Merge pull request #151 from FoamyGuy/circuitpython_org_choice
3rd bundle choice for CircuitPython_Org
2021-09-21 18:19:05 -05:00
foamyguy
d5de7e3fed default value for CircuitPython Org company capitalized 2021-09-18 10:29:44 -05:00
foamyguy
6117569a32 fix conf and setup.py. Fix a few URLs in readme. Removed duplicated lines in setup.py 2021-09-11 12:26:00 -05:00
foamyguy
8c0c34b839 fix tests 2021-09-10 18:27:58 -05:00
foamyguy
00c6af5f64 3rd bundle choice for CircuitPython_Org 2021-09-10 17:29:01 -05:00
Kattni
555d825957
Merge pull request #144 from kattni/community-code-of-conduct
Create CircuitPython Community CoC.
2021-06-22 18:02:52 -04:00
Kattni Rembor
c5f128e35c Further updates per suggestions. 2021-06-22 12:53:21 -04:00
James Carr
1df5c0a5a0
Improved method of munging in the version. 2021-06-08 23:57:09 +01:00
Kattni Rembor
f2ef52fc96 Adding update from Adafruit CoC. 2021-06-08 13:38:28 -04:00
Kattni Rembor
e40236a65d Create CircuitPython Community CoC. 2021-06-07 18:08:22 -04:00
Kattni
6166a5fdd9
Merge pull request #143 from kattni/coc-update
Update CoC.
2021-06-07 16:39:55 -04:00
Kattni Rembor
2630bdd29a Update CoC. 2021-06-07 16:28:51 -04:00
Patrick
53bcfc9633 Fixes #131 2021-06-06 14:43:59 -07:00
jposada202020
82e712cbe9
Merge pull request #142 from lesamouraipourpre/pypi-version-munging
Add __version__ munging to the package uploaded to PyPI.
2021-06-05 08:35:04 -04:00
James Carr
ab3a00b4f0
Merge remote-tracking branch 'upstream/master' into pypi-version-munging 2021-06-03 21:11:15 +01:00
Kattni
12f29c3e58
Merge pull request #140 from FoamyGuy/remove_spaces
Remove spaces in library name
2021-06-02 18:26:34 -04:00
foamyguy
82557e8f38 replace space in readthedocs link in readme 2021-06-02 17:02:49 -05:00
foamyguy
82ea666e85 replace spaces in examples.rst and index.rst 2021-05-27 19:02:19 -05:00
foamyguy
c628d93c61 replace spaces in api.rst, conf.py, readme, and setup.py 2021-05-27 18:23:54 -05:00
James Carr
f796c35552
Add __version__ munging to the package uploaded to PyPI. 2021-05-25 09:00:16 +01:00
foamyguy
23f519c414 replace spaces with underscores inside test script 2021-05-17 19:41:31 -05:00
foamyguy
8c2f5f9b5d replace spaces with underscores or dashes 2021-05-17 19:31:08 -05:00
Kattni
ba0ec42859
Merge pull request #139 from FoamyGuy/add_org_to_setup_py_url
update github URL in setup.py to have Org if no prefix was used.
2021-05-17 11:58:29 -04:00
jposada202020
baa039dc87
Merge pull request #132 from lesamouraipourpre/patch-1
Update README.rst
2021-05-16 10:35:49 -04:00
James Carr
ba293be61c
Merge remote-tracking branch 'upstream/master' into patch-1 2021-05-16 11:43:05 +01:00
foamyguy
0903c4a520 update github URL in setup.py to have Org if no prefix was used. 2021-05-15 12:53:49 -05:00
foamyguy
98c81c549f
Merge pull request #138 from FoamyGuy/remove_extra_dir
move PR template to dir with Org in name
2021-05-15 12:38:01 -05:00
foamyguy
8f5a674be0 move PR template to dir with Org in name 2021-05-15 11:43:38 -05:00
Kattni
5eb23614bd
Merge pull request #136 from kattni/pr-template
Add PR template.
2021-05-12 11:40:28 -04:00
Scott Shawcroft
fcd64a093f
Merge pull request #135 from FoamyGuy/add_org_in_name
Add org in name if prefix is empty
2021-05-11 13:33:11 -07:00
Kattni Rembor
0b88c22b62 License. 2021-05-11 12:16:01 -04:00
Kattni Rembor
af4c229603 Newline. 2021-05-11 12:01:53 -04:00
Kattni Rembor
e0d8cd3367 Add PR template. 2021-05-11 11:24:31 -04:00
foamyguy
dcc915b825 Merge branch 'master' into add_org_in_name 2021-05-10 18:02:39 -05:00
foamyguy
edbe971849 remove org from readthedocs link 2021-05-10 18:01:25 -05:00
Kattni
daecc0fd09
Merge pull request #133 from FoamyGuy/readme_fixes
fix pip install instructions in readme for non-prefixed projects
2021-05-10 17:04:36 -04:00
foamyguy
0312eb9626 fix pip install instructions in readme for non-prefixed projects 2021-05-08 20:43:18 -05:00
foamyguy
8decc4a0aa changes for adding org to name 2021-05-08 12:01:48 -05:00
James Carr
5696cfd036
Update README.rst
The current version if run with *Community* and *PyPI release* produces the following merged together statements
```text
or individual libraries can be installed using
`circup <https://github.com/adafruit/circup>`_.Installing from PyPI
=====================
.. note:: This library is not available on PyPI yet. Install documentation is included
   as a standard element. Stay tuned for PyPI availability!
```
The change has been tested producing Adafruit and Community libraries locally, and the `Installing from PyPI` is correctly on a new line in both cases.
2021-05-08 17:23:27 +01:00
foamyguy
bc3e31e7ba add Org to name of generated project if prefix was empty 2021-05-08 11:18:46 -05:00
Patrick
6fca832f61
Merge pull request #128 from jepler/remove-default-branch 2021-04-26 22:52:36 -07:00
Scott Shawcroft
288894d77b
Merge pull request #129 from adafruit/python37
Bump to Python 3.7
2021-04-26 14:58:55 -07:00
Dylan Herrada
e7ffa3a3f9
Bump to Python 3.7 2021-04-26 14:48:45 -04:00
36cffbb4ff Remove "default_branch"
This was only used to set the URL to view the CODE-OF-CONDUCT,
but it can be viewed on the default branch by using HEAD.
2021-04-24 20:17:22 -05:00
48 changed files with 608 additions and 363 deletions

View file

@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
- uses: actions/setup-python@v2
- 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

View file

@ -8,16 +8,27 @@ on: [pull_request, push]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- '3.7'
- '3.x'
os-version:
- ubuntu-latest
- windows-latest
- macos-latest
runs-on: ${{ matrix.os-version }}
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
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.6
python-version: ${{ matrix.python-version }}
- name: Versions
run: |
python3 --version
@ -28,7 +39,7 @@ jobs:
- name: Install deps
run: |
pip install --upgrade pip
pip install -r $GITHUB_WORKSPACE/tests_requirements.txt
pip install -r tests_requirements.txt
- name: Run cookiecutter tests
run: |
pytest -v

33
.gitignore vendored
View file

@ -1,16 +1,31 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
# SPDX-FileCopyrightText: 2022 Kattni Rembor, written for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
# SPDX-License-Identifier: MIT
.venv
.env
.python-version
# cookiecutter-specific files
.cookie_test/
.pytest*
# CircuitPython-specific files
*.mpy
# Python-specific files
__pycache__
*.pyc
.pytest*
__pycache__
# Sphinx build-specific files
_build
.cookie_test/
# This file results from running `pip -e install .` in a local repository
*.egg-info
.vscode/
# Virtual environment-specific files
.env
# MacOS-specific files
*.DS_Store
# IDE-specific files
.idea
.vscode
*~

View file

@ -4,11 +4,11 @@
repos:
- repo: https://github.com/fsfe/reuse-tool
rev: v0.12.1
rev: v0.14.0
hooks:
- id: reuse
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
rev: v4.2.0
hooks:
- id: check-yaml
- id: end-of-file-fixer

12
.reuse/dep5 Normal file
View file

@ -0,0 +1,12 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: cookiecutter-adafruit-circuitpython
Upstream-Contact: support@adafruit.com
Source: https://github.com/adafruit/cookiecutter-adafruit-circuitpython/
Files: {{ cookiecutter.__dirname }}/docs
Copyright: 2017 Scott Shawcroft, written for Adafruit Industries
License: MIT
Files: {{ cookiecutter.__dirname }}/docs/_static
Copyright: 2018 Phillip Torrone for Adafruit Industries
License: MIT

View file

@ -82,8 +82,7 @@ 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 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.
any Community Moderator.
Email and direct message reports will be kept confidential.

View file

@ -5,8 +5,7 @@ Introduction
:target: https://adafru.it/discord
:alt: Discord
This cookiecutter creates a project structure for a Adafruit CircuitPython
library.
This cookiecutter creates a project structure for an Adafruit CircuitPython library.
See this Adafruit Learn Guide for an explanation of creating a CircuitPython library: `Creating and sharing a CircuitPython library <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/overview>`_ The section for using cookiecutter is `here <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/creating-a-library#cookie-cutter>`_.
@ -20,7 +19,7 @@ Cookiecutter Usage
.. code-block:: bash
# The first time
pip install cookiecutter
pip install cookiecutter@https://github.com/cookiecutter/cookiecutter/archive/2.0.2.zip
cookiecutter gh:adafruit/cookiecutter-adafruit-circuitpython
@ -37,7 +36,7 @@ Prompts
* ``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.
* ``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.
* ``adafruit_product_id`` - 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>`_.
@ -46,7 +45,6 @@ Prompts
(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

View file

@ -356,5 +356,5 @@ texinfo_documents = [
#
# texinfo_no_detailmenu = False
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),
'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}
intersphinx_mapping = {'python': ('https://docs.python.org/3', None),
'CircuitPython': ('https://docs.circuitpython.org/en/latest/', None)}

View file

@ -1,22 +1,26 @@
{
"target_bundle": [
"Adafruit",
"Community"
"Community",
"CircuitPython Org",
"test"
],
"github_user": "{%- if cookiecutter.target_bundle == 'Adafruit' -%} adafruit {%- endif -%}",
"github_user": "{%- if cookiecutter.target_bundle == 'Adafruit' -%} adafruit {%- elif cookiecutter.target_bundle == 'CircuitPython Org' -%} circuitpython {%- endif -%}",
"author_name": null,
"company": "{%- if cookiecutter.target_bundle == 'Adafruit' -%} Adafruit Industries {%- endif -%}",
"company": "{%- if cookiecutter.target_bundle == 'Adafruit' -%} Adafruit Industries {%- elif cookiecutter.target_bundle == 'CircuitPython Org' -%} CircuitPython Organization{%- endif -%}",
"library_name": null,
"library_description": "",
"library_keywords": "",
"library_prefix": "{%- if cookiecutter.target_bundle == 'Adafruit' -%} adafruit {%- endif -%}",
"adafruit_pid": "",
"adafruit_product_id": "",
"requires_bus_device": "",
"requires_register": "",
"other_requirements": "",
"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"],
"pypi_release": "{%- if cookiecutter.target_bundle == 'Adafruit' or cookiecutter.target_bundle == 'CircuitPython Org' -%} yes {%- else -%} no {%- endif -%}",
"sphinx_docs": "{%- if cookiecutter.target_bundle == 'Adafruit' or cookiecutter.target_bundle == 'CircuitPython Org' -%} yes {%- else -%} no {%- endif -%}",
"_extensions": ["jinja2.ext.do"],
"_copy_without_render": ["*.github/*"]
"_copy_without_render": ["*.github/*"],
"__dirname": "{% if cookiecutter.target_bundle != 'CircuitPython Org' %}{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }}_CircuitPython{% else %}CircuitPython{% endif %}_{{ cookiecutter.library_name|replace(' ', '_')}}{% else %}CircuitPython_Org_{{ cookiecutter.library_name|replace(' ', '_')}}{% endif %}",
"__libname": "{{ cookiecutter.library_name | lower | replace(' ', '_') }}",
"__libprefix": "{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | lower | replace(' ', '_') }}_{% endif %}"
}

View file

@ -1,24 +0,0 @@
# 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))

View file

@ -1,16 +0,0 @@
# 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)

View file

@ -3,6 +3,7 @@
# SPDX-License-Identifier: MIT
import json
import os
import pathlib
import shutil
import sys
@ -10,10 +11,6 @@ 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'
@ -44,7 +41,7 @@ def compare_template_dirs(*, library_name='test', library_prefix=None):
`library_prefix` prompt. Default: None
"""
cookie_template_path = working_dir / '{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }}_{% endif %}CircuitPython_{{ cookiecutter.library_name}}'
cookie_template_path = working_dir / "{{ cookiecutter.__dirname }}"
if library_prefix:
generated_folder_name = "{}_CircuitPython_{}".format(library_prefix, library_name)
else:
@ -86,10 +83,9 @@ def test_new_cookiecutter_only_required_entries():
test_context = {}
for key, value in cookie_json.items():
if not key.startswith('_'):
if value == None:
test_context[key] = 'test'
if key.startswith('_'):
test_context[key] = value
new_cookie = cookiecutter(
str(working_dir.resolve()),
@ -99,7 +95,7 @@ def test_new_cookiecutter_only_required_entries():
extra_context=test_context
)
assert new_cookie == '{}/Adafruit_CircuitPython_test'.format(output_dir.resolve())
assert os.listdir(output_dir)[0] == 'Adafruit_CircuitPython_test'
assert compare_template_dirs(library_prefix="Adafruit")
def test_new_cookiecutter_all_entries():
@ -115,15 +111,11 @@ def test_new_cookiecutter_all_entries():
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] = 'Community'
elif 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()),
@ -133,5 +125,5 @@ def test_new_cookiecutter_all_entries():
extra_context=test_context
)
assert new_cookie == '{}/Test_CircuitPython_test'.format(output_dir.resolve())
assert os.listdir(output_dir)[0] == 'Test_CircuitPython_test'
assert compare_template_dirs(library_prefix='Test')

View file

@ -2,5 +2,5 @@
#
# SPDX-License-Identifier: Unlicense
cookiecutter
cookiecutter >= 2.1.0
pytest

View file

@ -1,18 +0,0 @@
# 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

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

View file

@ -0,0 +1,13 @@
# SPDX-FileCopyrightText: 2021 Adafruit Industries
#
# SPDX-License-Identifier: MIT
Thank you for contributing! Before you submit a pull request, please read the following.
Make sure any changes you're submitting are in line with the CircuitPython Design Guide, available here: https://docs.circuitpython.org/en/latest/docs/design_guide.html
If your changes are to documentation, please verify that the documentation builds locally by following the steps found here: https://adafru.it/build-docs
Before submitting the pull request, make sure you've run Pylint and Black locally on your code. You can do this manually or using pre-commit. Instructions are available here: https://adafru.it/check-your-code
Please remove all of this text before submitting. Include an explanation or list of changes included in your PR, as well as, if applicable, a link to any related issues.

View file

@ -22,10 +22,10 @@ jobs:
awk -F '\/' '{ print tolower($2) }' |
tr '_' '-'
)
- name: Set up Python 3.6
uses: actions/setup-python@v1
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: 3.6
python-version: "3.x"
- name: Versions
run: |
python3 --version
@ -42,9 +42,9 @@ jobs:
# (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
- name: Pip install Sphinx, pre-commit
run: |
pip install --force-reinstall pylint Sphinx sphinx-rtd-theme pre-commit
pip install --force-reinstall Sphinx sphinx-rtd-theme pre-commit
- name: Library version
run: git describe --dirty --always --tags
- name: Setup problem matchers
@ -59,7 +59,7 @@ jobs:
with:
name: bundles
path: ${{ github.workspace }}/bundles/
- name: Check For docs folder
- name: Check for docs folder
id: need-docs
run: |
echo ::set-output name=docs::$( find . -wholename './docs' )

View file

@ -24,10 +24,10 @@ jobs:
awk -F '\/' '{ print tolower($2) }' |
tr '_' '-'
)
- name: Set up Python 3.6
uses: actions/setup-python@v1
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: 3.6
python-version: "3.x"
- name: Versions
run: |
python3 --version
@ -67,7 +67,7 @@ jobs:
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
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
@ -81,5 +81,8 @@ jobs:
TWINE_USERNAME: ${{ secrets.pypi_username }}
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: |
for file in $(find -not -path "./.*" -not -path "./docs*" -name "*.py"); do
sed -i -e "s/0.0.0-auto.0/${{github.event.release.tag_name}}/" $file;
done;
python setup.py sdist
twine upload dist/*

47
{{ cookiecutter.__dirname }}/.gitignore vendored Normal file
View file

@ -0,0 +1,47 @@
# SPDX-FileCopyrightText: 2022 Kattni Rembor, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
# Do not include files and directories created by your personal work environment, such as the IDE
# you use, except for those already listed here. Pull requests including changes to this file will
# not be accepted.
# This .gitignore file contains rules for files generated by working with CircuitPython libraries,
# including building Sphinx, testing with pip, and creating a virual environment, as well as the
# MacOS and IDE-specific files generated by using MacOS in general, or the PyCharm or VSCode IDEs.
# If you find that there are files being generated on your machine that should not be included in
# your git commit, you should create a .gitignore_global file on your computer to include the
# files created by your personal setup. To do so, follow the two steps below.
# First, create a file called .gitignore_global somewhere convenient for you, and add rules for
# the files you want to exclude from git commits.
# Second, configure Git to use the exclude file for all Git repositories by running the
# following via commandline, replacing "path/to/your/" with the actual path to your newly created
# .gitignore_global file:
# git config --global core.excludesfile path/to/your/.gitignore_global
# CircuitPython-specific files
*.mpy
# Python-specific files
__pycache__
*.pyc
# Sphinx build-specific files
_build
# This file results from running `pip -e install .` in a local repository
*.egg-info
# Virtual environment-specific files
.env
# MacOS-specific files
*.DS_Store
# IDE-specific files
.idea
.vscode
*~

View file

@ -0,0 +1,42 @@
# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò
#
# SPDX-License-Identifier: Unlicense
repos:
- repo: https://github.com/python/black
rev: 22.3.0
hooks:
- id: black
- repo: https://github.com/fsfe/reuse-tool
rev: v0.14.0
hooks:
- id: reuse
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pycqa/pylint
rev: v2.11.1
hooks:
- id: pylint
name: pylint (library code)
types: [python]
args:
- --disable=consider-using-f-string,duplicate-code
exclude: "^(docs/|examples/|tests/|setup.py$)"
- id: pylint
name: pylint (example code)
description: Run pylint rules on "examples/*.py" files
types: [python]
files: "^examples/"
args:
- --disable=missing-docstring,invalid-name,consider-using-f-string,duplicate-code
- id: pylint
name: pylint (test code)
description: Run pylint rules on "tests/*.py" files
types: [python]
files: "^tests/"
args:
- --disable=missing-docstring,consider-using-f-string,duplicate-code

View file

@ -55,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,bad-continuation,pointless-string-statement
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,unspecified-encoding
# 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

View file

@ -1,25 +1,39 @@
{% if cookiecutter.library_prefix -%}
{% set prefix = cookiecutter.library_prefix | capitalize + "_" -%}
{% else -%}
{% set prefix = '' -%}
{% endif -%}
{% set repo_name = prefix + "CircuitPython_" + cookiecutter.library_name -%}
{% set full_repo_name = cookiecutter.github_user + "/" + repo_name -%}
{%- set pypi_name = cookiecutter.library_name|lower|replace("_", "-") -%}
{%- if cookiecutter.target_bundle != 'CircuitPython Org' -%}
{%- if cookiecutter.library_prefix -%}
{%- set repo_name = (cookiecutter.library_prefix | capitalize) -%}
{%- set repo_name = repo_name + '_CircuitPython_' -%}
{%- else -%}
{%- set repo_name = 'CircuitPython_' -%}
{%- endif -%}
{%- set repo_name = repo_name + cookiecutter.library_name | replace(" ", "_") -%}
{%- else -%}
{%- set repo_name = 'CircuitPython_Org_' + cookiecutter.library_name | replace(" ", "_") -%}
{%- endif -%}
{%- set full_repo_name = cookiecutter.github_user + "/" + repo_name -%}
{%- set pypi_name = cookiecutter.library_name|lower|replace("_", "-")|replace(" ", "-") -%}
{%- if cookiecutter.target_bundle == 'Adafruit' -%}
{%- set docs_url = 'https://docs.circuitpython.org/projects/' + cookiecutter.library_name | lower | replace(" ", "-") + '/en/latest/' -%}
{%- else -%}
{%- set docs_url = 'https://circuitpython-' + cookiecutter.library_name | lower | replace(" ", "-") | replace("_", "-") + '.readthedocs.io/' -%}
{%- endif -%}
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
.. image:: https://readthedocs.org/projects/{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | lower | replace("_", "-")}}-{% endif %}circuitpython-{{ cookiecutter.library_name | lower | replace(" ", "-") | replace("_", "-") }}/badge/?version=latest
{%- if cookiecutter.target_bundle == 'Adafruit' %}
:target: https://circuitpython.readthedocs.io/projects/{{ cookiecutter.library_name | lower }}/en/latest/
:target: {{ docs_url }}
{%- else %}
:target: https://circuitpython-{{ cookiecutter.library_name | lower }}.readthedocs.io/
:target: {{ docs_url }}
{%- endif %}
:alt: Documentation Status
{% endif %}
{% if cookiecutter.target_bundle == 'Adafruit' -%}
.. image:: https://github.com/adafruit/Adafruit_CircuitPython_Bundle/blob/main/badges/adafruit_discord.svg
{%- else %}
.. image:: https://img.shields.io/discord/327254708534116352.svg
{%- endif %}
:target: https://adafru.it/discord
:alt: Discord
@ -62,12 +76,10 @@ or individual libraries can be installed using
.. 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}}>`_
`Purchase one from the Adafruit shop <http://www.adafruit.com/products/{{cookiecutter.adafruit_product_id}}>`_
{% endif -%}
{%- if cookiecutter.pypi_release in ["y", "yes"] -%}
{%- if cookiecutter.pypi_release in ["y", "yes"] %}
Installing from PyPI
=====================
@ -77,18 +89,18 @@ Installing from PyPI
.. todo:: Remove the above note if PyPI version is/will be available at time of release.
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 }}/>`_.
PyPI <https://pypi.org/project/{%- if cookiecutter.library_prefix -%}{{ cookiecutter.library_prefix }}-{%- endif -%}circuitpython-{{ pypi_name }}/>`_.
To install for current user:
.. code-block:: shell
pip3 install adafruit-circuitpython-{{ pypi_name }}
pip3 install {% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix }}-{% endif %}circuitpython-{{ pypi_name }}
To install system-wide (this may be required in some cases):
.. code-block:: shell
sudo pip3 install adafruit-circuitpython-{{ pypi_name }}
sudo pip3 install {% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix }}-{% endif %}circuitpython-{{ pypi_name }}
To install in a virtual environment in your current project:
@ -97,25 +109,49 @@ To install in a virtual environment in your current project:
mkdir project-name && cd project-name
python3 -m venv .env
source .env/bin/activate
pip3 install adafruit-circuitpython-{{ pypi_name }}
pip3 install {% if cookiecutter.library_prefix -%}{{ cookiecutter.library_prefix }}-{% endif -%}circuitpython-{{ pypi_name }}
{% endif %}
Installing to a Connected CircuitPython Device with Circup
==========================================================
Make sure that you have ``circup`` installed in your Python environment.
Install it with the following command if necessary:
.. code-block:: shell
pip3 install circup
With ``circup`` installed and your CircuitPython device connected use the
following command to install:
.. code-block:: shell
circup install {{ cookiecutter.library_name | lower | replace(" ", "-") }}
Or the following command to update an existing version:
.. code-block:: shell
circup update
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.
Documentation
=============
API documentation for this library can be found on `Read the Docs <{{ docs_url }}>`_.
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>`_.
Contributing
============
Contributions are welcome! Please read our `Code of Conduct
<https://github.com/{{ full_repo_name }}/blob/{{cookiecutter.default_branch}}/CODE_OF_CONDUCT.md>`_
<https://github.com/{{ full_repo_name }}/blob/HEAD/CODE_OF_CONDUCT.md>`_
before contributing to help this project stay welcoming.
Documentation
=============
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

@ -4,5 +4,5 @@
.. If your library file(s) are nested in a directory (e.g. /adafruit_foo/foo.py)
.. use this format as the module name: "adafruit_foo.foo"
.. automodule:: {% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | lower }}_{% endif %}{{ cookiecutter.library_name | lower }}
.. automodule:: {% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | lower }}_{% endif %}{{ cookiecutter.library_name | lower | replace(" ", "_") }}
:members:

View file

@ -29,14 +29,14 @@ extensions = [
intersphinx_mapping = {
"python": ("https://docs.python.org/3.4", None),
"python": ("https://docs.python.org/3", None),
{%- if cookiecutter.requires_bus_device in ["y", "yes"] -%}
"BusDevice": ("https://circuitpython.readthedocs.io/projects/busdevice/en/latest/", None),
"BusDevice": ("https://docs.circuitpython.org/projects/busdevice/en/latest/", None),
{% endif %}
{%- if cookiecutter.requires_register in ["y", "yes"] -%}
"Register": ("https://circuitpython.readthedocs.io/projects/register/en/latest/", None),
"Register": ("https://docs.circuitpython.org/projects/register/en/latest/", None),
{%- endif %}
"CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None),
"CircuitPython": ("https://docs.circuitpython.org/en/latest/", None),
}
# Show the docstring from both the class and its __init__() method.
@ -51,7 +51,7 @@ source_suffix = ".rst"
master_doc = "index"
# General information about the project.
project = "{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }} {% endif %} CircuitPython {{ cookiecutter.library_name }} Library"
project = "{% if cookiecutter.target_bundle != 'CircuitPython Org' %}{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }} {% endif %}{% endif %}CircuitPython {{ cookiecutter.library_name }} Library"
copyright = "{% now 'utc', '%Y' %} {{ cookiecutter.author_name }}"
author = "{{ cookiecutter.author_name }}"
@ -69,7 +69,7 @@ release = "1.0"
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = "en"
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
@ -133,7 +133,7 @@ html_static_path = ["_static"]
html_favicon = "_static/favicon.ico"
# Output file base name for HTML help builder.
htmlhelp_basename = "{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }}_{% endif %}CircuitPython_{{ cookiecutter.library_name | capitalize }}Librarydoc"
htmlhelp_basename = "{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }}_{% endif %}CircuitPython_{{ cookiecutter.library_name | capitalize | replace(' ', '_')}}_Librarydoc"
# -- Options for LaTeX output ---------------------------------------------
@ -154,7 +154,7 @@ latex_elements = {
latex_documents = [
(
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 | replace(' ', '_')}}_Library.tex",
"{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }} {% endif %}CircuitPython {{ cookiecutter.library_name }} Library Documentation",
author,
"manual",
@ -168,7 +168,7 @@ latex_documents = [
man_pages = [
(
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 | replace(' ', '_')}}_Library",
"{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }} {% endif %}CircuitPython {{ cookiecutter.library_name }} Library Documentation",
[author],
1,
@ -183,10 +183,10 @@ man_pages = [
texinfo_documents = [
(
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 | replace(' ', '_') }}_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",
"{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }}_{% endif %}CircuitPython_{{ cookiecutter.library_name | replace(' ', '_')}}_Library",
"One line description of project.",
"Miscellaneous",
),

View file

@ -3,6 +3,6 @@ Simple test
Ensure your device works with this simple test.
.. literalinclude:: ../examples/{{ cookiecutter.library_name | lower }}_simpletest.py
:caption: examples/{{ cookiecutter.library_name | lower }}_simpletest.py
.. literalinclude:: ../examples/{{ cookiecutter.library_name | lower | replace(" ", "_") }}_simpletest.py
:caption: examples/{{ cookiecutter.library_name | lower | replace(" ", "_") }}_simpletest.py
:linenos:

View file

@ -36,8 +36,9 @@ Table of Contents
.. toctree::
:caption: Other Links
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>
Download from GitHub <https://github.com/{{ cookiecutter.github_user }}/{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize}}_{% endif %}CircuitPython_{{ cookiecutter.library_name | replace(" ", "_") }}/releases/latest>
Download Library Bundle <https://circuitpython.org/libraries>
CircuitPython Reference Documentation <https://docs.circuitpython.org>
CircuitPython Support Forum <https://forums.adafruit.com/viewforum.php?f=60>
Discord Chat <https://adafru.it/discord>
Adafruit Learning System <https://learn.adafruit.com>

View file

@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
sphinx>=4.0.0

View file

@ -17,19 +17,24 @@
{%- 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.append(cookiecutter.library_name|lower|replace(" ", "-")) -%}
{%- 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.target_bundle != 'CircuitPython Org' -%}
{%- 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 -%}
{%- set repo_name = repo_name + cookiecutter.library_name | replace(" ", "_") -%}
{%- else -%}
{%- set repo_name = 'CircuitPython_' + cookiecutter.library_name -%}
{%- set repo_name = 'CircuitPython_' -%}
{%- set repo_name = repo_name + cookiecutter.library_name | replace(" ", "_") -%}
{%- endif -%}
{%- set pypi_name = repo_name|lower|replace("_", "-") -%}
{%- else -%}
{%- set repo_name = 'CircuitPython_Org_' + cookiecutter.library_name | replace(" ", "_") -%}
{%- endif -%}
{%- set pypi_name = repo_name|lower|replace("_", "-")|replace(" ", "-")|replace("circuitpython-org-", "circuitpython-") -%}
"""A setuptools based setup module.
See:
@ -50,10 +55,13 @@ 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
# {{ cookiecutter.target_bundle }} Bundle Information
name="{{ pypi_name }}",
use_scm_version=True,
use_scm_version={
# This is needed for the PyPI version munging in the Github Actions release.yml
"git_describe_command": "git describe --tags --long",
"local_scheme": "no-local-version",
},
setup_requires=["setuptools_scm"],
description="{{ cookiecutter.library_description }}",
long_description=long_description,
@ -61,21 +69,12 @@ setup(
# The project's main homepage.
url="https://github.com/{{ cookiecutter.github_user }}/{{ repo_name }}.git",
# Author details
{% if cookiecutter.target_bundle == 'Adafruit' -%}
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="",
author_email="", # TODO: Add your email here
{%- endif %}
install_requires=[
"{{ req_list.items|sort|unique|join('",\n"')|indent(width=8) }}",
@ -90,14 +89,13 @@ setup(
"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 -}}"],
py_modules=["{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | lower | replace(" ", "_") }}_{% endif %}{{ cookiecutter.library_name | lower | replace(" ", "_") }}"],
)

View file

@ -0,0 +1,19 @@
# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
build:
os: ubuntu-20.04
tools:
python: "3"
python:
install:
- requirements: docs/requirements.txt
- requirements: requirements.txt

View file

@ -1,6 +1,6 @@
<!--
SPDX-FileCopyrightText: 2014 Coraline Ada Ehmke
SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries
SPDX-FileCopyrightText: 2019-2021 Kattni Rembor for Adafruit Industries
SPDX-License-Identifier: CC-BY-4.0
-->
@ -39,6 +39,8 @@ Examples of unacceptable behavior by participants include:
* Any spamming, flaming, baiting or other attention-stealing behavior
* Excessive or unwelcome helping; answering outside the scope of the question
asked
* Discussion or promotion of activities or projects that intend or pose a risk of
significant harm
* 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
@ -77,26 +79,25 @@ involving other community members.
You may report in the following ways:
In any situation, you may send an email to <support@adafruit.com>.
In any situation, you may email <support@adafruit.com>.
On the Adafruit Discord, you may send an open message from any channel
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.
any Community Moderator.
Email and direct message reports will be kept confidential.
In situations on Discord where the issue is particularly egregious, possibly
In situations on Discord where the issue is particularly offensive, possibly
illegal, requires immediate action, or violates the Discord terms of service,
you should also report the message directly to Discord.
you should also report the message directly to [Discord](https://discord.com/safety).
These are the steps for upholding our communitys standards of conduct.
1. Any member of the community may report any situation that violates the
Adafruit Community Code of Conduct. All reports will be reviewed and
CircuitPython Community Code of Conduct. All reports will be reviewed and
investigated.
2. If the behavior is an egregious violation, the community member who
2. If the behavior is a severe violation, the community member who
committed the violation may be banned immediately, without warning.
3. Otherwise, moderators will first respond to such behavior with a warning.
4. Moderators follow a soft "three strikes" policy - the community member may
@ -106,6 +107,12 @@ behavior.
moderator, or the warning goes unheeded, they may be banned for a first or
second offense. Repeated offenses will result in the community member being
banned.
6. Disciplinary actions (warnings, bans, etc) for Code of Conduct violations apply
to the platform where the violation occurred. However, depending on the severity
of the violation, the disciplinary action may be applied across Adafruit's other
community platforms. For example, a severe violation on the Adafruit Discord
server may result in a ban on not only the Adafruit Discord server, but also on
the Adafruit GitHub organisation, Adafruit Forums, Adafruit Twitter, etc.
## Scope
@ -123,9 +130,8 @@ accordingly.
## Attribution
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>,
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/),
version 1.4, available on [contributor-covenant.org](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).
For other projects adopting the Adafruit Community Code of
@ -133,5 +139,3 @@ 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

@ -0,0 +1,138 @@
<!--
SPDX-FileCopyrightText: 2014 Coraline Ada Ehmke
SPDX-FileCopyrightText: 2019-2021 Kattni Rembor
SPDX-License-Identifier: CC-BY-4.0
-->
# CircuitPython Community Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and leaders pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level or type of
experience, education, socio-economic status, nationality, personal appearance,
race, religion, or sexual identity and orientation.
## Our Standards
We are committed to providing a friendly, safe and welcoming environment for
all.
Examples of behavior that contributes to creating a positive environment
include:
* Be kind and courteous to others
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Collaborating with other community members
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and sexual attention or advances
* The use of inappropriate images, including in a community member's avatar
* The use of inappropriate language, including in a community member's nickname
* Any spamming, flaming, baiting or other attention-stealing behavior
* Excessive or unwelcome helping; answering outside the scope of the question
asked
* Discussion or promotion of activities or projects that intend or pose a risk of
significant harm
* 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
* Other conduct which could reasonably be considered inappropriate
The goal of the standards and moderation guidelines outlined here is to build
and maintain a respectful community. We ask that you dont just aim to be
"technically unimpeachable", but rather try to be your best self.
We value many things beyond technical expertise, including collaboration and
supporting others within our community. Providing a positive experience for
other community members can have a much more significant impact than simply
providing the correct answer.
## Our Responsibilities
Project leaders are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project leaders have the right and responsibility to remove, edit, or
reject messages, comments, commits, code, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any community member for other behaviors that they deem
inappropriate, threatening, offensive, or harmful.
## Moderation
Instances of behaviors that violate the CircuitPython Community Code of Conduct
may be reported by any member of the community. Community members are
encouraged to report these situations, including situations they witness
involving other community members.
You may report in the following ways:
In any situation, you may email the project maintainer.
Email reports will be kept confidential.
In situations on GitHub where the issue is particularly offensive, possibly
illegal, requires immediate action, or violates the GitHub terms of service,
you should also report the message directly to GitHub via the comment, or via
[GitHub Support](https://support.github.com/contact/report-abuse?category=report-abuse&report=other&report_type=unspecified).
These are the steps for upholding our communitys standards of conduct.
1. Any member of the community may report any situation that violates the
CircuitPython Community Code of Conduct. All reports will be reviewed and
investigated.
2. If the behavior is a severe violation, the community member who
committed the violation may be banned immediately, without warning.
3. Otherwise, moderators will first respond to such behavior with a warning.
4. Moderators follow a soft "three strikes" policy - the community member may
be given another chance, if they are receptive to the warning and change their
behavior.
5. If the community member is unreceptive or unreasonable when warned by a
moderator, or the warning goes unheeded, they may be banned for a first or
second offense. Repeated offenses will result in the community member being
banned.
6. Disciplinary actions (warnings, bans, etc) for Code of Conduct violations apply
to the platform where the violation occurred. However, depending on the severity
of the violation, the disciplinary action may be applied across CircuitPython's
other community platforms. For example, a severe violation in one Community forum
may result in a ban on not only the CircuitPython GitHub organisation,
but also on the CircuitPython Twitter, live stream text chats, etc.
## Scope
This Code of Conduct and the enforcement policies listed above apply to all
CircuitPython Community venues. This includes but is not limited to any community
spaces (both public and private), and CircuitPython repositories. Examples of
CircuitPython Community spaces include but are not limited to meet-ups, issue
threads on GitHub, text chats during a live stream, or interaction at a conference.
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. As a community
member, you are representing our community, and are expected to behave
accordingly.
## Attribution
This Code of Conduct is adapted from the
[Adafruit Community Code of Conduct](https://github.com/adafruit/Adafruit_Community_Code_of_Conduct),
which is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/),
version 1.4, available on [contributor-covenant.org](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).
For other projects adopting the CircuitPython Community Code of
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.

View file

@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: MIT
"""
`{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | lower }}_{% endif %}{{ cookiecutter.library_name | lower }}`
`{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | lower | replace(" ", "_") }}_{% endif %}{{ cookiecutter.library_name | lower | replace(" ", "_") }}`
================================================================================
{% if cookiecutter.library_description != "" %}
@ -25,7 +25,7 @@ Implementation Notes
**Software and Dependencies:**
* Adafruit CircuitPython firmware for the supported boards:
https://github.com/adafruit/circuitpython/releases
https://circuitpython.org/downloads
.. todo:: Uncomment or remove the Bus Device and/or the Register library dependencies
based on the library's use of either.
@ -36,5 +36,18 @@ Implementation Notes
# imports
{% if cookiecutter.target_bundle != 'CircuitPython Org' -%}
{%- 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 | replace(" ", "_") -%}
{%- else -%}
{%- set repo_name = 'CircuitPython_' -%}
{%- set repo_name = repo_name + cookiecutter.library_name | replace(" ", "_") -%}
{%- endif -%}
{% else -%}
{%- set repo_name = 'CircuitPython_Org_' + cookiecutter.library_name | replace(" ", "_") -%}
{% endif -%}
__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"
__repo__ = "https://github.com/{{ cookiecutter.github_user }}/{{ repo_name }}.git"