Compare commits

..

No commits in common. "ansys-cookiecutter" and "master" have entirely different histories.

48 changed files with 363 additions and 608 deletions

View file

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

View file

@ -8,27 +8,16 @@ on: [pull_request, push]
jobs:
test:
strategy:
matrix:
python-version:
- '3.7'
- '3.x'
os-version:
- ubuntu-latest
- windows-latest
- macos-latest
runs-on: ${{ matrix.os-version }}
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Set up Python
uses: actions/setup-python@v2
- name: Set up Python 3.6
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
python-version: 3.6
- name: Versions
run: |
python3 --version
@ -39,7 +28,7 @@ jobs:
- name: Install deps
run: |
pip install --upgrade pip
pip install -r tests_requirements.txt
pip install -r $GITHUB_WORKSPACE/tests_requirements.txt
- name: Run cookiecutter tests
run: |
pytest -v

33
.gitignore vendored
View file

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

View file

@ -3,13 +3,13 @@
# SPDX-License-Identifier: Unlicense
repos:
- 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/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,12 +0,0 @@
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,7 +82,8 @@ 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
any Community Moderator.
@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.
@ -93,18 +94,18 @@ you should also report the message directly to Discord.
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
investigated.
Adafruit Community Code of Conduct. All reports will be reviewed and
investigated.
2. If the behavior is an egregious violation, the community member who
committed the violation may be banned immediately, without warning.
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.
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.
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.
## Scope

View file

@ -1,93 +1,95 @@
Introduction
============
.. image :: https://img.shields.io/discord/327254708534116352.svg
:target: https://adafru.it/discord
:alt: Discord
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>`_.
.. note::
The above Learn Guide is directed towards creating a library for the Community Bundle. For libraries meant for the Adafruit Bundle, contact the CircuitPython Helpers (@circuitpython helpers) on Discord or put in a new issue on the Adafruit_CircuitPython_Bundle GitHub repository.
Cookiecutter Usage
===================
.. code-block:: bash
# The first time
pip install cookiecutter@https://github.com/cookiecutter/cookiecutter/archive/2.0.2.zip
cookiecutter gh:adafruit/cookiecutter-adafruit-circuitpython
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_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_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>`_.
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.
Post Generation Cleanup
------------------------
After generation, make sure to glance over the files to make sure they
autogenerated as you expect (such as capitalization). There are a few places
with ``.. todo::`` that should also be taken care of. After adding or updating
the information requested, make sure the ``.. todo::`` text is removed. Like this:
.. code::
# Before Cleanup
.. todo:: Describe what the module does
.. code::
# After Cleanup
This library talks to the AM4Z-1NG sensor. Typical use is for robot friends.
Windows Users
==============
Due to the development nature of cookiecutter, there are some limitations when using with Windows.
Cookiecutter Installation
--------------------------
The Python enviornment can be tricky sometimes in Windows. Use this documentation page for steps and tips on Windows installation: `Cookiecutter Installation - Windows <https://cookiecutter.readthedocs.io/en/latest/installation.html#windows>`_
<library>.py & /examples/<library>_simpletest.py File Generation
------------------------------------------------------------------
Cookiecutter was developed for use in \*\nix/OSX enviornments. When implementing prompt based configuration for things like filenames, special characters were used for programmatic detection and formatting.
.. code-block::
{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | lower }}_{% endif %}{{ cookiecutter.library_name | lower }}.py
As such, Windows will block the use of these special characters in filenames. So when cookiecutter pulls the Adafruit CircuitPython template, the <library>.py and /examples/<library>_simpletest.py files are not created. This adds an extra step. Simply copy an existing library's .py files (and structure if making a "package"), and change the prompted values (e.g. author name, library name, documentation information, etc).
.. note::
The above is from experience with using cookiecutter within a Windows native setup. This may not be applicable when using Windows Subsystem for Linux (WSL) or any *nix-For-Windows utilities.
We are always exploring ways to make things easier, so this workflow may change. Also, ideas and solutions are always welcome!
Introduction
============
.. image :: https://img.shields.io/discord/327254708534116352.svg
:target: https://adafru.it/discord
:alt: Discord
This cookiecutter creates a project structure for a 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>`_.
.. note::
The above Learn Guide is directed towards creating a library for the Community Bundle. For libraries meant for the Adafruit Bundle, contact the CircuitPython Helpers (@circuitpython helpers) on Discord or put in a new issue on the Adafruit_CircuitPython_Bundle GitHub repository.
Cookiecutter Usage
===================
.. code-block:: bash
# The first time
pip install cookiecutter
cookiecutter gh:adafruit/cookiecutter-adafruit-circuitpython
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_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.
* ``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
------------------------
After generation, make sure to glance over the files to make sure they
autogenerated as you expect (such as capitalization). There are a few places
with ``.. todo::`` that should also be taken care of. After adding or updating
the information requested, make sure the ``.. todo::`` text is removed. Like this:
.. code::
# Before Cleanup
.. todo:: Describe what the module does
.. code::
# After Cleanup
This library talks to the AM4Z-1NG sensor. Typical use is for robot friends.
Windows Users
==============
Due to the development nature of cookiecutter, there are some limitations when using with Windows.
Cookiecutter Installation
--------------------------
The Python enviornment can be tricky sometimes in Windows. Use this documentation page for steps and tips on Windows installation: `Cookiecutter Installation - Windows <https://cookiecutter.readthedocs.io/en/latest/installation.html#windows>`_
<library>.py & /examples/<library>_simpletest.py File Generation
------------------------------------------------------------------
Cookiecutter was developed for use in \*\nix/OSX enviornments. When implementing prompt based configuration for things like filenames, special characters were used for programmatic detection and formatting.
.. code-block::
{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | lower }}_{% endif %}{{ cookiecutter.library_name | lower }}.py
As such, Windows will block the use of these special characters in filenames. So when cookiecutter pulls the Adafruit CircuitPython template, the <library>.py and /examples/<library>_simpletest.py files are not created. This adds an extra step. Simply copy an existing library's .py files (and structure if making a "package"), and change the prompted values (e.g. author name, library name, documentation information, etc).
.. note::
The above is from experience with using cookiecutter within a Windows native setup. This may not be applicable when using Windows Subsystem for Linux (WSL) or any *nix-For-Windows utilities.
We are always exploring ways to make things easier, so this workflow may change. Also, ideas and solutions are always welcome!

View file

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

View file

@ -1,26 +1,22 @@
{
"target_bundle": [
"Adafruit",
"Community",
"CircuitPython Org",
"test"
"Community"
],
"github_user": "{%- if cookiecutter.target_bundle == 'Adafruit' -%} adafruit {%- elif cookiecutter.target_bundle == 'CircuitPython Org' -%} circuitpython {%- endif -%}",
"github_user": "{%- if cookiecutter.target_bundle == 'Adafruit' -%} adafruit {%- endif -%}",
"author_name": null,
"company": "{%- if cookiecutter.target_bundle == 'Adafruit' -%} Adafruit Industries {%- elif cookiecutter.target_bundle == 'CircuitPython Org' -%} CircuitPython Organization{%- endif -%}",
"company": "{%- if cookiecutter.target_bundle == 'Adafruit' -%} Adafruit Industries {%- endif -%}",
"library_name": null,
"library_description": "",
"library_keywords": "",
"library_prefix": "{%- if cookiecutter.target_bundle == 'Adafruit' -%} adafruit {%- endif -%}",
"adafruit_product_id": "",
"adafruit_pid": "",
"requires_bus_device": "",
"requires_register": "",
"other_requirements": "",
"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 -%}",
"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/*"],
"__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 %}"
"_copy_without_render": ["*.github/*"]
}

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)

View file

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

View file

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

View file

@ -22,10 +22,10 @@ jobs:
awk -F '\/' '{ print tolower($2) }' |
tr '_' '-'
)
- name: Set up Python 3.x
uses: actions/setup-python@v2
- name: Set up Python 3.6
uses: actions/setup-python@v1
with:
python-version: "3.x"
python-version: 3.6
- 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 Sphinx, pre-commit
- name: Pip install pylint, Sphinx, pre-commit
run: |
pip install --force-reinstall Sphinx sphinx-rtd-theme pre-commit
pip install --force-reinstall pylint 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.x
uses: actions/setup-python@v2
- name: Set up Python 3.6
uses: actions/setup-python@v1
with:
python-version: "3.x"
python-version: 3.6
- 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@v2
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install dependencies
@ -81,8 +81,5 @@ 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/*

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

@ -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,unspecified-encoding
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

View file

@ -1,6 +1,6 @@
<!--
SPDX-FileCopyrightText: 2014 Coraline Ada Ehmke
SPDX-FileCopyrightText: 2019-2021 Kattni Rembor for Adafruit Industries
SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries
SPDX-License-Identifier: CC-BY-4.0
-->
@ -39,8 +39,6 @@ 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
@ -79,40 +77,35 @@ involving other community members.
You may report in the following ways:
In any situation, you may email <support@adafruit.com>.
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
any Community Moderator.
@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.
In situations on Discord where the issue is particularly offensive, possibly
In situations on Discord where the issue is particularly egregious, possibly
illegal, requires immediate action, or violates the Discord terms of service,
you should also report the message directly to [Discord](https://discord.com/safety).
you should also report the message directly to Discord.
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.
Adafruit Community Code of Conduct. All reports will be reviewed and
investigated.
2. If the behavior is an egregious 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.
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 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.
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.
## Scope
@ -130,8 +123,9 @@ accordingly.
## Attribution
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),
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).
For other projects adopting the Adafruit Community Code of
@ -139,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,39 +1,25 @@
{%- 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 -%}
{% 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("_", "-") -%}
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 | replace(" ", "-") | replace("_", "-") }}/badge/?version=latest
.. 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.target_bundle == 'Adafruit' %}
:target: {{ docs_url }}
:target: https://circuitpython.readthedocs.io/projects/{{ cookiecutter.library_name | lower }}/en/latest/
{%- else %}
:target: {{ docs_url }}
:target: https://circuitpython-{{ cookiecutter.library_name | lower }}.readthedocs.io/
{%- 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
@ -76,10 +62,12 @@ 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_product_id}}>`_
`Purchase one from the Adafruit shop <http://www.adafruit.com/products/{{cookiecutter.adafruit_pid}}>`_
{% endif -%}
{%- if cookiecutter.pypi_release in ["y", "yes"] %}
{%- if cookiecutter.pypi_release in ["y", "yes"] -%}
Installing from PyPI
=====================
@ -89,18 +77,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/{%- if cookiecutter.library_prefix -%}{{ cookiecutter.library_prefix }}-{%- endif -%}circuitpython-{{ pypi_name }}/>`_.
PyPI <https://pypi.org/project/adafruit-circuitpython-{{ cookiecutter.library_name|lower }}/>`_.
To install for current user:
.. code-block:: shell
pip3 install {% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix }}-{% endif %}circuitpython-{{ pypi_name }}
pip3 install adafruit-circuitpython-{{ pypi_name }}
To install system-wide (this may be required in some cases):
.. code-block:: shell
sudo pip3 install {% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix }}-{% endif %}circuitpython-{{ pypi_name }}
sudo pip3 install adafruit-circuitpython-{{ pypi_name }}
To install in a virtual environment in your current project:
@ -109,49 +97,25 @@ 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 {% if cookiecutter.library_prefix -%}{{ cookiecutter.library_prefix }}-{% endif -%}circuitpython-{{ pypi_name }}
pip3 install adafruit-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/HEAD/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.
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 | replace(" ", "_") }}
.. automodule:: {% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | lower }}_{% endif %}{{ cookiecutter.library_name | lower }}
:members:

View file

@ -29,14 +29,14 @@ extensions = [
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"python": ("https://docs.python.org/3.4", None),
{%- if cookiecutter.requires_bus_device in ["y", "yes"] -%}
"BusDevice": ("https://docs.circuitpython.org/projects/busdevice/en/latest/", None),
"BusDevice": ("https://circuitpython.readthedocs.io/projects/busdevice/en/latest/", None),
{% endif %}
{%- if cookiecutter.requires_register in ["y", "yes"] -%}
"Register": ("https://docs.circuitpython.org/projects/register/en/latest/", None),
"Register": ("https://circuitpython.readthedocs.io/projects/register/en/latest/", None),
{%- endif %}
"CircuitPython": ("https://docs.circuitpython.org/en/latest/", None),
"CircuitPython": ("https://circuitpython.readthedocs.io/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.target_bundle != 'CircuitPython Org' %}{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }} {% endif %}{% endif %}CircuitPython {{ cookiecutter.library_name }} Library"
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 }}"
@ -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 = "en"
language = None
# 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 | replace(' ', '_')}}_Librarydoc"
htmlhelp_basename = "{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }}_{% endif %}CircuitPython_{{ cookiecutter.library_name | capitalize }}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 | replace(' ', '_')}}_Library.tex",
"{% 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",
@ -168,7 +168,7 @@ latex_documents = [
man_pages = [
(
master_doc,
"{% 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",
"{% 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 | replace(' ', '_') }}_Library",
"{% 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 | replace(' ', '_')}}_Library",
"{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize }}_{% endif %}CircuitPython_{{ cookiecutter.library_name }}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 | replace(" ", "_") }}_simpletest.py
:caption: examples/{{ cookiecutter.library_name | lower | replace(" ", "_") }}_simpletest.py
.. literalinclude:: ../examples/{{ cookiecutter.library_name | lower }}_simpletest.py
:caption: examples/{{ cookiecutter.library_name | lower }}_simpletest.py
:linenos:

View file

@ -36,9 +36,8 @@ Table of Contents
.. toctree::
:caption: Other Links
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>
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>
Adafruit Learning System <https://learn.adafruit.com>

View file

@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: MIT
"""
`{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | lower | replace(" ", "_") }}_{% endif %}{{ cookiecutter.library_name | lower | replace(" ", "_") }}`
`{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | lower }}_{% endif %}{{ cookiecutter.library_name | lower }}`
================================================================================
{% if cookiecutter.library_description != "" %}
@ -25,7 +25,7 @@ Implementation Notes
**Software and Dependencies:**
* Adafruit CircuitPython firmware for the supported boards:
https://circuitpython.org/downloads
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.
@ -36,18 +36,5 @@ 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 }}/{{ repo_name }}.git"
__repo__ = "https://github.com/{{ cookiecutter.github_user }}/{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | capitalize}}_{% endif %}CircuitPython_{{ cookiecutter.library_name }}.git"

View file

@ -17,24 +17,19 @@
{%- 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|replace(" ", "-")) -%}
{%- 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.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 -%}
{%- 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_Org_' + cookiecutter.library_name | replace(" ", "_") -%}
{%- set repo_name = 'CircuitPython_' + cookiecutter.library_name -%}
{%- endif -%}
{%- set pypi_name = repo_name|lower|replace("_", "-")|replace(" ", "-")|replace("circuitpython-org-", "circuitpython-") -%}
{%- set pypi_name = repo_name|lower|replace("_", "-") -%}
"""A setuptools based setup module.
See:
@ -55,13 +50,10 @@ with open(path.join(here, "README.rst"), encoding="utf-8") as f:
long_description = f.read()
setup(
# {{ cookiecutter.target_bundle }} Bundle Information
{% if cookiecutter.target_bundle == 'Adafruit' -%}
# Adafruit Bundle Information
name="{{ pypi_name }}",
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",
},
use_scm_version=True,
setup_requires=["setuptools_scm"],
description="{{ cookiecutter.library_description }}",
long_description=long_description,
@ -69,12 +61,21 @@ 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="", # TODO: Add your email here
author_email="",
{%- endif %}
install_requires=[
"{{ req_list.items|sort|unique|join('",\n"')|indent(width=8) }}",
@ -89,13 +90,14 @@ 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 | replace(" ", "_") }}_{% endif %}{{ cookiecutter.library_name | lower | replace(" ", "_") }}"],
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 @@
# 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

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

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

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

View file

@ -1,19 +0,0 @@
# 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,138 +0,0 @@
<!--
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.