Coder Social home page Coder Social logo

cookiecutter-adafruit-circuitpython's Introduction

Introduction

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 The section for using cookiecutter is here.

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

# The first time
pip install cookiecutter~=2.1

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. 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. 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.
  • 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:

# Before Cleanup
.. todo:: Describe what the module does
# After Cleanup
This library talks to the AM4Z-1NG sensor. Typical use is for robot friends.

Note

If you are not uploading the repository for Adafruit (i.e., the Community bundle), and you wish to use the Release feature on GitHub to upload libraries to PyPI, you will need to add your PyPI token to the repository secrets. Set a secret named PYPI_USERNAME to __token__ and a secret named PYPI_PASSWORD to your API token with the proper scope. Never share your API token anyone!

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

<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.

{% 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!

cookiecutter-adafruit-circuitpython's People

Contributors

2bndy5 avatar ajs256 avatar amyreese avatar apatt avatar askpatrickw avatar caternuson avatar dhalbert avatar evaherrada avatar flameeyes avatar foamyguy avatar garrettheath4 avatar hugodahl avatar imnotjames avatar jepler avatar jposada202020 avatar kattni avatar keiththeee avatar ladyada avatar lesamouraipourpre avatar makermelissa avatar ricardoquesada avatar siddacious avatar sommersoft avatar tammymakesthings avatar tannewt avatar tdicola avatar tekktrik avatar xsc27 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cookiecutter-adafruit-circuitpython's Issues

Prefix or No Prefix specified is changing the library from prefix_cp_library to cp_org_library

I'm not sure if this is intentional or not, but if you specify a prefix you get a community bundle type name, and if you don't you get a circuitpython_org bundle type name.

Prefix

cookiecutter cookiecutter-adafruit-circuitpython
Select target_bundle:
1 - Adafruit
2 - Community
Choose from 1, 2 [1]: 2
github_user []: askpatrickw
author_name: Patrickw
company []: Pimoroni
library_name: LTR765
library_description []: Magic !
library_keywords []: keys
library_prefix []: PREFIX
adafruit_pid []:
requires_bus_device []: n
requires_register []: n
other_requirements []: n
pypi_release [no]: n
sphinx_docs [no]: n

result: Prefix_CircuitPython_LTR765

NO Prefix

cookiecutter cookiecutter-adafruit-circuitpython
Select target_bundle:
1 - Adafruit
2 - Community
Choose from 1, 2 [1]: 2
github_user []: myuser
author_name: My Name
company []:
library_name: library 2000
library_description []:
library_keywords []:
library_prefix []:
adafruit_pid []:
requires_bus_device []:
requires_register []:
other_requirements []:
pypi_release [no]:
sphinx_docs [no]:

result: CircuitPython_Org_library_2000

Git clone unsuccessful on Windows

Quite a straightforward issue with a seemingly complicated fix for cookiecutter v1.7

Windows does not like certain characters in its filenames. These characters appear in files in this repo and prevent cookiecutter from working properly on Windows, this is noted in the README.

To resolve this issue, we need to somehow remove pipes from the filenames. In cookiecutter 2.0, private variables exist such that my fork here will allow clones on a Windows FS: master...TheGuardianWolf:master

Unfortunately cookiecutter 2.0 is not released as of yet, Windows users however can use my fork with the latest version of cookiecutter:

pip3 install git+git://github.com/cookiecutter/cookiecutter.git
cookiecutter gh:TheGuardianWolf/cookiecutter-adafruit-circuitpython

To resolve this issue for the current cookiecutter, I looked into post and pre generation hooks, but these do not allow modifications of the context variables. There seems to be no way to hook into the generation process and modify these variables.

Community library - Code of Conduct

When generating a community library with circup cookiecutter it uses the standard CODE_OF_CONDUCT.md that it uses for Adafruit libraries.

Example: https://github.com/lesamouraipourpre/Community_CircuitPython_TCA9555/blob/HEAD/CODE_OF_CONDUCT.md

There are parts in this which seem to be Adafruit specific in particular the Moderation and Scope sections. While I would obviously respect any reports received through these channels, I feel this puts undue responsibility on the Adafruit Team/Adafruit Discord Team.

Should this use a less branded, library specific Code of Conduct, possibly a 'CircuitPython Community Code of Conduct' (CCCoC) and should circup cookiecutter be amended to provide this version?

If we were to go for a generic CCCoC, what should it say in these sections?

.travis.yml not generated

All the documentation says that one of the files to be generated is a config file for Travis CI, however no .travis.yml file is being generated.

`

ls -al
total 52
drwxr-xr-x 1 lnelson lnelson 278 Feb 8 15:05 .
drwxr-xr-x 1 lnelson lnelson 76 Feb 8 15:05 ..
-rw-r--r-- 1 lnelson lnelson 2148 Feb 8 15:05 circuitpython_clockhand.py
-rw-r--r-- 1 lnelson lnelson 5831 Feb 8 15:05 CODE_OF_CONDUCT.md
drwxr-xr-x 1 lnelson lnelson 84 Feb 8 15:05 docs
drwxr-xr-x 1 lnelson lnelson 74 Feb 8 15:05 examples
drwxr-xr-x 1 lnelson lnelson 18 Feb 8 15:05 .github
-rw-r--r-- 1 lnelson lnelson 102 Feb 8 15:05 .gitignore
-rw-r--r-- 1 lnelson lnelson 1096 Feb 8 15:05 LICENSE
-rw-r--r-- 1 lnelson lnelson 16110 Feb 8 15:05 .pylintrc
-rw-r--r-- 1 lnelson lnelson 2667 Feb 8 15:05 README.rst
-rw-r--r-- 1 lnelson lnelson 59 Feb 8 15:05 .readthedocs.yml
-rw-r--r-- 1 lnelson lnelson 45 Feb 8 15:05 requirements.txt
-rw-r--r-- 1 lnelson lnelson 2013 Feb 8 15:05 setup.py
`

Running pre-commit yields error

The error displayed is:

error: pathspec 'latest' did not match any file(s) known to git

Here's the log sections already nicely formatted for git :)

version information

pre-commit version: 2.8.2
sys.version:
    3.9.0 (default, Nov 11 2020, 09:57:57)
    [Clang 12.0.0 (clang-1200.0.32.21)]
sys.executable: /usr/local/opt/[email protected]/bin/python3.9
os.name: posix
sys.platform: darwin

error information

An unexpected error has occurred: CalledProcessError: command: ('/usr/local/bin/git', 'checkout', 'latest')
return code: 1
expected return code: 0
stdout: (none)
stderr:
    error: pathspec 'latest' did not match any file(s) known to git

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/pre_commit/store.py", line 183, in clone_strategy
    self._shallow_clone(ref, _git_cmd)
  File "/usr/local/lib/python3.9/site-packages/pre_commit/store.py", line 165, in _shallow_clone
    git_cmd('-c', git_config, 'fetch', 'origin', ref, '--depth=1')
  File "/usr/local/lib/python3.9/site-packages/pre_commit/store.py", line 180, in _git_cmd
    cmd_output_b('git', *args, cwd=directory, env=env)
  File "/usr/local/lib/python3.9/site-packages/pre_commit/util.py", line 154, in cmd_output_b
    raise CalledProcessError(returncode, cmd, retcode, stdout_b, stderr_b)
pre_commit.util.CalledProcessError: command: ('/usr/local/bin/git', '-c', 'protocol.version=2', 'fetch', 'origin', 'latest', '--depth=1')
return code: 128
expected return code: 0
stdout: (none)
stderr:
    fatal: couldn't find remote ref latest


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/pre_commit/error_handler.py", line 65, in error_handler
    yield
  File "/usr/local/lib/python3.9/site-packages/pre_commit/main.py", line 375, in main
    return run(args.config, store, args)
  File "/usr/local/lib/python3.9/site-packages/pre_commit/commands/run.py", line 377, in run
    for hook in all_hooks(config, store)
  File "/usr/local/lib/python3.9/site-packages/pre_commit/repository.py", line 210, in all_hooks
    return tuple(
  File "/usr/local/lib/python3.9/site-packages/pre_commit/repository.py", line 213, in <genexpr>
    for hook in _repository_hooks(repo, store, root_config)
  File "/usr/local/lib/python3.9/site-packages/pre_commit/repository.py", line 188, in _repository_hooks
    return _cloned_repository_hooks(repo_config, store, root_config)
  File "/usr/local/lib/python3.9/site-packages/pre_commit/repository.py", line 154, in _cloned_repository_hooks
    manifest_path = os.path.join(store.clone(repo, rev), C.MANIFEST_FILE)
  File "/usr/local/lib/python3.9/site-packages/pre_commit/store.py", line 187, in clone
    return self._new_repo(repo, ref, deps, clone_strategy)
  File "/usr/local/lib/python3.9/site-packages/pre_commit/store.py", line 144, in _new_repo
    make_strategy(directory)
  File "/usr/local/lib/python3.9/site-packages/pre_commit/store.py", line 185, in clone_strategy
    self._complete_clone(ref, _git_cmd)
  File "/usr/local/lib/python3.9/site-packages/pre_commit/store.py", line 158, in _complete_clone
    git_cmd('checkout', ref)
  File "/usr/local/lib/python3.9/site-packages/pre_commit/store.py", line 180, in _git_cmd
    cmd_output_b('git', *args, cwd=directory, env=env)
  File "/usr/local/lib/python3.9/site-packages/pre_commit/util.py", line 154, in cmd_output_b
    raise CalledProcessError(returncode, cmd, retcode, stdout_b, stderr_b)
pre_commit.util.CalledProcessError: command: ('/usr/local/bin/git', 'checkout', 'latest')
return code: 1
expected return code: 0
stdout: (none)
stderr:
    error: pathspec 'latest' did not match any file(s) known to git

__init__() docstrings are not being included in generated sphinx documentation

Sphinx does not include the docstring of an __init__() method by default. Instead, it includes only the class docstring.

There are several ways to fix this:
https://stackoverflow.com/questions/5599254/how-to-use-sphinxs-autodoc-to-document-a-classs-init-self-method#

This is the easiest way:
https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#confval-autoclass_content

We would add this to conf.py:

# Show the docstring from both the class and its __init__() method
autoclass_content = "both"

This setting is not included by default in the cookiecutter, but should be.

In our libraries, there are a number of cases where an __init__() docstring exists, usually to document the args to the constructor. I did confirm for a couple of these that the string is missing in RTD.

A rough grep/awk survey of the libraries shows that at least those below have __init__() docstrings. I used this command line, which will miss __init__()s where the arglist is spread over several lines.

ag __init__ -A1 |grep '"""' | awk -F / '{ print $2; }' |sort -u

Of these, only the hcsr04 library currently includes autoclass_content = "both" in its conf.py.

  • 74hc595
  • adafruitio
  • ads1x15
  • atecc
  • azure
  • bitbangio
  • ble
  • ble-radio
  • bluefruitconnect
  • bme280
  • bme680
  • charlcd
  • debouncer
  • dht
  • dymoscale
  • esp-atcontrol
  • featherwing
  • fona
  • hashlib
  • hcsr04
  • hid
  • hue
  • lifx
  • lis3dh
  • logging
  • matrixkeypad
  • mcp230xx
  • miniqr
  • motorkit
  • pcf8591
  • pn532
  • rplidar
  • sgp30
  • st7735r
  • stmpe610
  • tinylora
  • tmp007

How should Copyright be applied to files AND Should anything be default no in Community?

This conversation is only about the files within the template folder which in the master branch is called {{ cookiecutter.library_name }} today.

These are the ways copyright is added today:

Template Author & Library Author

Some files have a copyright line crediting Scott and then an added line for the author is appended.

# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
# SPDX-FileCopyrightText: Copyright (c) {% now 'utc', '%Y' %} {{ cookiecutter.author }}{% if cookiecutter.company %} for {{ cookiecutter.company }}{% endif %}
#
# SPDX-License-Identifier: MIT
  • library_name.py
  • setup.py
  • requirements.txt

Author Only

The author is added when the template is processed

  • LICENSE

Coraline and Kattni

  • Code_of_Conduct.md

Diego only

  • pyproject.toml
  • pre-commit-config.yaml

Scott only

  • readme.rst (I believe via readme.rst.license)
  • .readthedocs.yml
  • .pylintrc
  • .gitignore
  • .github/workflow/build.yml
  • .github/workflow/release.yml
  • examples/library_name_simpletest.py
  • Everything in docs except the favicon which is Phillip

I thought this was messier than it actually is, but here's my proposal and question:

  1. Add the Author the examples file, and Readme file.
  2. Add a sphinx_docs to the cookiecutter which defaults to Yes for Adafruit and No for Community and if NO, excludes the Docs folder and readthedocs.yml

I could be talked out of 2. Just my opinion. I don't see everyone wanting the docs, they will just update the readme I'm sure and that's it.

Make Templates Bundle Aware: Adafruit or Community

In assisting someone with creating a library for the Community Bundle, and providing information in conjunction with the Learn Guide, I realized we could probably do this better.

The Community version will have changes with regards to the CI portion, at minimum. The templated GitHub Actions workflows assume an Adafruit library, and will require changes every time. Further, no option for Travis is provided; which could be desired by the library creator.

Thoughts?

upload artifacts from "Build assets" step in build.yml

It just occurred to me that I could use the build.yml workflow to generate my mpy files for testing (or verifying the assets are correct before release). I'm noting it here as it might be very useful to people developing from windows (without WSL setup) or from lower-end dev stations (like tablets or a GitPod env).

I was able to get this done by adding

    - name: Archive bundles
      uses: actions/upload-artifact@v2
      with:
        name: bundles
        path: ${{ github.workspace }}/bundles/

directly after the "Build assets" step which resulted with
image
I can easily submit a PR if this is an acceptable contribution

jinja2.exceptions.TemplateSyntaxError: when running from msys2 (windows)

$ cookiecutter gh:adafruit/cookiecutter-adafruit-circuitpython
You've downloaded C:/Users/ladyada/.cookiecutters/cookiecutter-adafruit-circuitpython before. Is it okay to delete and re-download it? [yes]:
Select target_bundle:
1 - Adafruit
2 - Community
Choose from 1, 2 [1]: 1
github_user [adafruit]:
author_name: ladyada
company [Adafruit Industries]:
library_name: NeoKey
library_description []: Python library for seesaw-based NeoKey boards
library_keywords []: python circuitpython neopixel seesaw mechanical keyboard
library_prefix [adafruit]:
adafruit_pid []: 4980
requires_bus_device []:
requires_register []:
other_requirements []: adafruit-circuitpython-seesaw
pypi_release [yes]:
sphinx_docs [yes]:
Select default_branch:
1 - master
2 - main
Choose from 1, 2 [1]: 2
Traceback (most recent call last):
  File "C:/msys64/mingw32/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:/msys64/mingw32/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:/msys64/mingw32/bin/cookiecutter.exe/__main__.py", line 7, in <module>
  File "C:/msys64/mingw32/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "C:/msys64/mingw32/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "C:/msys64/mingw32/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:/msys64/mingw32/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "C:/msys64/mingw32/lib/python3.8/site-packages/cookiecutter/cli.py", line 140, in main
    cookiecutter(
  File "C:/msys64/mingw32/lib/python3.8/site-packages/cookiecutter/main.py", line 101, in cookiecutter
    result = generate_files(
  File "C:/msys64/mingw32/lib/python3.8/site-packages/cookiecutter/generate.py", line 272, in generate_files
    project_dir, output_directory_created = render_and_create_dir(
  File "C:/msys64/mingw32/lib/python3.8/site-packages/cookiecutter/generate.py", line 190, in render_and_create_dir
    name_tmpl = environment.from_string(dirname)
  File "C:/msys64/mingw32/lib/python3.8/site-packages/jinja2/environment.py", line 941, in from_string
    return cls.from_code(self, self.compile(source), globals, None)
  File "C:/msys64/mingw32/lib/python3.8/site-packages/jinja2/environment.py", line 638, in compile
    self.handle_exception(source=source_hint)
  File "C:/msys64/mingw32/lib/python3.8/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "C:/msys64/mingw32/lib/python3.8/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "<unknown>", line 1, in template
jinja2.exceptions.TemplateSyntaxError: unexpected char '\uf07c' at 67

Make template PyPI status aware

Include a prompt to specify whether a library is destined to be deployed to PyPI. If not, add setup.py.disabled with a specific string in it, instead of setup.py.

I'm not certain how I feel about adding this due to the fact that whether a library ends up on PyPI may not be a decision made by the author, but that's another issue to address.

Double copyright lines

I just used the latest cookiecutter to start on a library, and noticed the copyright lines include both the 2017 copyright and the generated one:, e.g.:

# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
# SPDX-FileCopyrightText: Copyright (c) 2021 Dan Halbert for Adafruit Industries

Is this deliberate? I removed the first line, which appeared in several files.

move actions to use a "composite action" to ease updating actions across all libs

For an unrelated thing (arduino ci) I was prototyping the use of a "composite action". Composite actions can have shell steps and steps that call out to other actions. By making the cookie-cut version of the actions file refer to (an as yet to be created) composite action, we can update all actions simultaneously across all cookie-cut repos. (by using an evergreen @main instead of a pinned @v1, all workflows would automatically get the newest version of the composite action)

Example composite action for arduino-ci: https://github.com/jepler/actions-arduino-ci/blob/main/action.yml

Example use of it: https://github.com/jepler/Adafruit_SI1145_Library/blob/21eb009648326cdf849beab2263254cf4840fe5d/.github/workflows/githubci.yml

pre-commit is not happy with latest and stable

As seen in a recent PR, pre-commit is not happy with latest and stable as rev: values.

Happy to submit a PR, what version number do you want to use?

Which version of black? - 20.8b1 is latest
https://github.com/psf/black/releases

Which version of reuse tool? - v0.12.1 is latest
https://github.com/fsfe/reuse-tool/releases

Another option would be to use an Organizational secret like I'm sure you're doing with AWS auth, etc... Which would fix maintaining these values, but would not run locally for contributors.


Example of the failure:

https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SH1107/runs/1788637904?check_suite_focus=true#step:11:1

Warning:  The 'rev' field of repo 'https://github.com/python/black' appears to be a mutable reference
(moving tag / branch).  
Mutable references are never updated after first install and are not supported. 
See https://pre-commit.com/#using-the-latest-version-for-a-repository for more details.

Warning:  The 'rev' field of repo 'https://github.com/fsfe/reuse-tool' appears to be a mutable reference
(moving tag / branch). 
Mutable references are never updated after first install and are not supported. 
See https://pre-commit.com/#using-the-latest-version-for-a-repository for more details.

[INFO] Initializing environment for https://github.com/python/black.
An unexpected error has occurred: CalledProcessError: command: ('/usr/bin/git', 'checkout', 'latest')
return code: 1
expected return code: 0
stdout: (none)
stderr:
    error: pathspec 'latest' did not match any file(s) known to git
    
Check the log at /home/runner/.cache/pre-commit/pre-commit.log
Error: Process completed with exit code 3.

This approach of hard-coding the specific version is problematic to manage, so I'm going to test several things and see if we can come up with another approach.

  • Using Secrets to specify a version for a pre-commit hook. Let's pretend this would work from within GitHub. Locally, it fails 100% so its a non-starter. Secrets don't appear to be available outside Actions as well.
  • using command line options, NOPE this is not available as a modifier to run
    - autoupdate
    - autoupdate --bleeding-edge

Centralize pre-commit.yaml

- PR to pre-commit to support --config and .pre-commit.yaml referring to an externally hosted yaml file (URL based) which could be hosted in a GIST or a repo. - pre-commit/pre-commit#450 Discusses the need for this and the maintainer saying. "No."

  • SO discussion about that approach by having one command in your pre-commit being a custom hook that gets the config you want and then calls pre-commit. Note: That is from the pre-commit maintainer.
  • Someone wrote a tool to pull configs and then insrtall pre-commit, not the same as the wrapper hook: Pierre-Sassoulas/centralized-pre-commit-conf The readme is pretty good. ;-)

Update pre-commit.yaml everywhere

Maintaining .pre-commit.yaml separately and when it changes update all affected repos. Some ways to do that:

  • Kattni mentioned Adabot
  • I found Gitbot
  • Maintainer of pre-commit also publishes all-repos and in the above bug they mention this as a way to manage this

I do think Adafruit is going to need a way to update across repos no matter what. Rolling your own or looking into Gitbot or All-Repos is my suggestion with a heavy leaning towards not rolling your own. ;-)

pre-commit pylint checks are doing too much work

I noticed that in adafruit_datetime, the pre-commit check could take a long time, especially for the "tests" step. Furthermore, all 4 of my CPU cores were active.

I believe this is because by default, pre-commit

  • assumes that the program accepts filenames on its commandline/argv
  • runs multiple processes in parallel if there are multiple files

Since pylint needs to get a view of all the source files it's checking in order to do proper code duplication checks, we make our own list of files to pylint with find and ignore the positional arguments that are given. But unless we also specify pass_filenames: false pre-commit doesn't know about it and starts invoking the "pylint all files" command once for each file!

This change is one I'm testing locally in adafruit_datetime:

From 10ebce0339182073dc0aabd010f73df00ae348a6 Mon Sep 17 00:00:00 2001
From: Jeff Epler <[email protected]>
Date: Mon, 22 Mar 2021 20:34:25 -0500
Subject: [PATCH] pre-commit: don't do too much work

---
 .pre-commit-config.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index cce4c7b..96f0626 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -32,6 +32,7 @@ repos:
         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
+        pass_filenames: false
 -   repo: local
     hooks:
     -   id: pylint_tests
@@ -40,3 +41,4 @@ repos:
         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
+        pass_filenames: false
-- 
2.29.2

If we want to make a change like this we'll have to apply it with adabot to existing repos as well.

Fix README.rst {{ library_prefix }} Capitalization

@kattni and I have noticed that when making a new library, the Travis badge link is broken when using library_prefix = adafruit. I can't remember at this time, but I think using a prefix with title case ("Adafruit") breaks other parts of the cookiecutter output.

See this PR for an example of the extra step required.

Add another pre-commit hook to run Pylint on tests directories as with examples

We need to add a third Pylint pre-commit hook to run on the tests directory, similar to the one for the examples directory, except only disable=missing-docstring (leave out invalid-name). As an example, see this commit.

There are very few libraries that have a tests directory, but in moving Pylint to Pre-Commit, we found it failing on the datetime library tests. After discussion, we came to a few of conclusions. One, datetime is special and will be handled on an individual basis. Two, we should not patch all the libraries to include this new pre-commit hook, we should only add it to the libraries that currently have tests directories. Three, we should add the new hook to cookiecutter so it's on any future libraries that may include tests directories.

Suggested library PR template content

Here is my suggestion for the library PR template. This would appear in all PRs opened on any CircuitPython library. Including it here for discussion. We will be deploying this in the next 24-48 hours, so any suggestions must be made ASAP.

Note that this code snippet does not auto-wrap the text, but the PR template will.

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://circuitpython.readthedocs.io/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.

PyPI Credentials For New Library

I am creating a new library to place into the CircuitPython Community Bundle but am having problems getting it distributed to PyPI as part of the GitHub Action release process.

I created a PyPI account along with a PyPI token. I added the token name and password as pypi_username and pypi_password as GitHub repository secrets as seemed correct from the release.yml file. Python packaging and distribution is new to me so I might need a little newbie help, which would be greatly appreciated.

pyproject.toml is breaking local `pip3 install -e`

I used cookiecutter to create a new library (Adafruit_Board_Toolkit), and it added a pyproject.toml file. The existence of this file is now preventing me from doing a local editable installation of the library. If I remove or rename the file this error does not occur.

pip3 install -e ~/repos/Adafruit_Board_Toolkit

fails as below:

halbert@tuna:~/repos/adafruit/Adafruit_Board_Toolkit$ pip3 install -e .
Obtaining file:///home/halbert/repos/adafruit/Adafruit_Board_Toolkit
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
    Preparing wheel metadata ... done
Requirement already satisfied: pyserial in /home/halbert/.local/lib/python3.8/site-packages (from adafruit-board-toolkit==0.1.dev2+gf3d3357.d20210316) (3.4)
Installing collected packages: adafruit-board-toolkit
  Running setup.py develop for adafruit-board-toolkit
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/halbert/repos/adafruit/Adafruit_Board_Toolkit/setup.py'"'"'; __file__='"'"'/home/halbert/repos/adafruit/Adafruit_Board_Toolkit/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --user --prefix=
         cwd: /home/halbert/repos/adafruit/Adafruit_Board_Toolkit/
    Complete output (28 lines):
    running develop
    WARNING: The user site-packages directory is disabled.
    error: can't create or remove files in install directory
    
    The following error occurred while trying to add or remove files in the
    installation directory:
    
        [Errno 13] Permission denied: '/usr/local/lib/python3.8/dist-packages/test-easy-install-203240.write-test'
    
    The installation directory you specified (via --install-dir, --prefix, or
    the distutils default setting) was:
    
        /usr/local/lib/python3.8/dist-packages/
    
    [detailed message elided due to length]
    
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/halbert/repos/adafruit/Adafruit_Board_Toolkit/setup.py'"'"'; __file__='"'"'/home/halbert/repos/adafruit/Adafruit_Board_Toolkit/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --user --prefix= Check the logs for full command output.

Interestingly

pip3 install ~/repos/Adafruit_Board_Toolkit

still works:

halbert@tuna:~/repos/adafruit/Adafruit_Board_Toolkit$ pip3 install .
Processing /home/halbert/repos/adafruit/Adafruit_Board_Toolkit
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
    Preparing wheel metadata ... done
Requirement already satisfied: pyserial in /home/halbert/.local/lib/python3.8/site-packages (from adafruit-board-toolkit==0.1.dev2+gf3d3357.d20210316) (3.4)
Building wheels for collected packages: adafruit-board-toolkit
  Building wheel for adafruit-board-toolkit (PEP 517) ... done
  Created wheel for adafruit-board-toolkit: filename=adafruit_board_toolkit-0.1.dev2+gf3d3357.d20210316-py3-none-any.whl size=8406 sha256=40b4290b60e2884c49ca36425fdb6710dc8843c24f9273141eb1e610065911f3
  Stored in directory: /tmp/pip-ephem-wheel-cache-e3wp8lh1/wheels/5f/2e/50/836fb2092e752bc5a6951810241942aa3b01b2845e20a7fb1b
Successfully built adafruit-board-toolkit
Installing collected packages: adafruit-board-toolkit
Successfully installed adafruit-board-toolkit-0.1.dev2+gf3d3357.d20210316

I'll research this further but if anyone understands the issue please comment.

Bad github link generated for CircuitPythonOrg library

When generating a CircuitPythonOrg library there is a bad github link in docs/index.rst

> cookiecutter gh:adafruit/cookiecutter-adafruit-circuitpython
You've downloaded /home/purpleankh/.cookiecutters/cookiecutter-adafruit-circuitpython before. Is it okay to delete and re-download it? [yes]: yes
Select target_bundle:
1 - Adafruit
2 - Community
Choose from 1, 2 [1]: 2
github_user []: example
author_name: Example Example
company []: Example Company
library_name: example example
library_description []: Example
library_keywords []: example
library_prefix []: 
adafruit_pid []: 
requires_bus_device []: 
requires_register []: 
other_requirements []: 
pypi_release [no]: yes
sphinx_docs [no]: yes

grep -ir "github.*example" *

docs/index.rst:    Download <https://github.com/example/CircuitPython_example_example/releases/latest>
example_example.py:__repo__ = "https://github.com/example/CircuitPython_Org_example_example.git"
README.rst:.. image:: https://github.com/example/CircuitPython_Org_example_example/workflows/Build%20CI/badge.svg
README.rst:    :target: https://github.com/example/CircuitPython_Org_example_example/actions
README.rst:<https://github.com/example/CircuitPython_Org_example_example/blob/HEAD/CODE_OF_CONDUCT.md>`_
setup.py:    url="https://github.com/example/CircuitPython_Org_example_example.git",

The docs/index.rst link should be https://github.com/example/CircuitPython_Org_example_example/releases/latest

Add a `readme_renderer` check to `build.yml`

I ran into an issue with Adafruit_CircuitPython_ICM20649 :
adafruit/Adafruit_CircuitPython_ICM20X#1
An issue with the parsing of the README.rst was preventing it from getting uploaded to PyPi. The symptom was a failing "Release Actions" -> "upload-pypi" job with this error:

image

The included URL pointed me to docs that lead me to the 'readme_parser' module that PyPi users. I was able to test with:

pip install --user --upgrade setuptools wheel twine readme_renderer
python setup.py sdist
python setup.py bdist_wheel --universal
twine check dist/*

Adding Register even if response is No

Recently ran cookiecutter for a new CP lib. I said "yes" to BusDevice, but "no" to Register. It still put Register in README.rst:

Dependencies
=============
This driver depends on:

* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
* `Bus Device <https://github.com/adafruit/Adafruit_CircuitPython_BusDevice>`_
* `Register <https://github.com/adafruit/Adafruit_CircuitPython_Register>`_

More conf.py Cleanup

There are still two conf.py files; one in the top directory, and one in the docs directory.

  • top directory: has info for MCP9808, and much more (outdated?) settings for sphinx
  • docs directory: in the correct spot, missing the favicon setting (and maybe a couple more)

I'll submit some changes in a few after updating my fork...

Cookiecutter ignoring register and busdevice choices

When running cookiecutter it asks whether or not the lib depends on busdevice and register. If you choose no, both are still added to adafruit_sensorname.py, conf.py, README.rst, and requirements.txt. The conf.py addition may be intentional, but the rest presumably shouldn't have both.

@sommersoft I seem to remember thinking you had noticed this as well.

Update files to pass black

Started a new library via cookiecutter and black didn't like a few of the files:

image

Passed once I ran them through black and just let it reformat.

The release action is publishing .py with invalid __version__

@lesamouraipourpre originally reported this in the Build Tools repo: adafruit/circuitpython-build-tools#70

And they gave an EXCELLENT assessment of the issue

After reading far too much documentation and github repos I think I've got it figured down as follows:

Currently in .github/workflows/release.yml (simplified):

  • build the release bundles (.py, & .mpy) for github and used by circup. As part of this circuitpython-build-tools munges the version information into the files with the method _munge_to_temp
  • python setup.py sdist and python setup.py bdist_wheel --universal. These are what gets uploaded to PyPi and are using the unmunged files.

The fix would be to move the version munging to it's own earlier step and do it in place. The files are going to be deleted from the (docker?) container anyway once the release is completed:

  • munge the version information into the files in place.
  • build the release bundles for github.
  • python setup.py for uploading to PyPi.

This is far above the knowledge level that I feel I have in relation to github/PyPi/CircuitPython and I don't know if this is a viable way to achieve this.

Add "reuse" copyright and license templates

From the reuse documentation, it appears that having a template for copyright and license information which can be used by the reuse tool to apply the correct format and standard headers to files.

With information on how to use the reuse tool when using the cookie-cutter template, this could go at least part of the way to helping resolve, long term, issue #99 for this and other repositories.

auto-generated links to core classes from arguments are incorrect

Metadata Errors and Python Wheel Issue

I wrote this in another issue, adafruit/Adafruit_CircuitPython_LSM6DS#24, but it was suggested I make it its own issue.

  • package metadata is wrong, this works on python 3.7 and 3.8, I haven't tested 3.6. Also, isn't this more Beta level or higher?
classifiers=[
        "Development Status :: 3 - Alpha",
        "Intended Audience :: Developers",
        "Topic :: Software Development :: Libraries",
        "Topic :: System :: Hardware",
        "License :: OSI Approved :: MIT License",
        "Programming Language :: Python :: 3",
        "Programming Language :: Python :: 3.4",
        "Programming Language :: Python :: 3.5",
    ],
  • you only make source packages on pypi, not wheels ... why?

    • I can see you are trying to build wheels here, but it isn't getting pushed to pypi
    - name: Build Python package
      run: |
        pip install --upgrade setuptools wheel twine readme_renderer testresources
        python setup.py sdist
        python setup.py bdist_wheel --universal
        twine check dist/*
    
    • I am unfamiliar with the --universal ... never used that before
    • Also, I have switched to poetry and just use a pyproject.toml which holds everything now ... it is awesome
      • Oh, I have no affiliation with poetry other than I really like it
  • There is the temperature sensor access, but I have that under a different issue ticket as an enhancement

Installing from Circup

Please add an Installing from Circup section in README.rst similar to the Installing from PyPI section.

An example might be:

Installing to a connected CircuitPython Device with Circup
==========================================================

Make sure that you have ``circup`` installed in your ``pip`` 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 adafruit-circuitpython-LIBRARY_NAME

Or the following command to update an existing version:

.. code-block:: shell

    circup update

Incorporate `pylint` with pre-commit

Discussed during the weekly CP call that running pylint on local changes would be of value to library contributors. This would make the pre-commit process a "one-stop-shop" for running formatting, performing validations, etc. This mostly involves adding the steps to the .pre-commit-config.yaml, with some caveats (below).

One concern mentioned by @jepler during the call was that it adds a required tool as part of the execution environment - both for contributors as well as within the CI pipeline. @tannewt mentioned the possibility of there being a requirements.txt like file for development environments within pip, possibly dev-requirements.txt.

There was also a heads-up from @kattni to make sure that the revision value for the pre-commit hook can NOT be "latest" or "current". Rather, it MUST have a proper version/tag number, i.e. "v0.2".

Finally, part of the changes would be to the generated GitHub workflow (/.github/workflows/build.yml) and remove the calls to pylint, since they would be performed by pre-commit from within the generated .pre-commit-config.yaml.

Reference: CircuitPython Weekly for 16 February 2021

path error on windows/msys

tried running cutter on both windows and msys with same error result:

C:\Users\ladyada\Dropbox\ArduinoSketches\libraries\Adafruit_IS31FL3741>cookiecutter gh:adafruit/cookiecutter-adafruit-circuitpython
You've downloaded C:\Users\ladyada\.cookiecutters\cookiecutter-adafruit-circuitpython before. Is it okay to delete and re-download it? [yes]: yes
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\shutil.py", line 616, in _rmtree_unsafe
    os.unlink(fullname)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\ladyada\\.cookiecutters\\cookiecutter-adafruit-circuitpython\\{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix \uf07c capitalize }}_{% endif %}CircuitPython_{{ cookiecutter.library_name}}\\examples\\{{ cookiecutter.library_name \uf07c lower }}_simpletest.py'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\ladyada\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\Scripts\cookiecutter.exe\__main__.py", line 7, in <module>
  File "c:\Users\ladyada\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "c:\Users\ladyada\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "c:\Users\ladyada\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\Users\ladyada\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "c:\Users\ladyada\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\cookiecutter\cli.py", line 140, in main
    cookiecutter(
  File "c:\Users\ladyada\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\cookiecutter\main.py", line 67, in cookiecutter
    repo_dir, cleanup = determine_repo_dir(
  File "c:\Users\ladyada\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\cookiecutter\repository.py", line 110, in determine_repo_dir
    cloned_repo = clone(
  File "c:\Users\ladyada\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\cookiecutter\vcs.py", line 95, in clone
    clone = prompt_and_delete(repo_dir, no_input=no_input)
  File "c:\Users\ladyada\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\cookiecutter\utils.py", line 99, in prompt_and_delete
    rmtree(path)
  File "c:\Users\ladyada\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\cookiecutter\utils.py", line 34, in rmtree
    shutil.rmtree(path, onerror=force_delete)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\shutil.py", line 740, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\shutil.py", line 613, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\shutil.py", line 613, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\shutil.py", line 618, in _rmtree_unsafe
    onerror(os.unlink, fullname, sys.exc_info())
  File "c:\Users\ladyada\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\cookiecutter\utils.py", line 25, in force_delete
    os.chmod(path, stat.S_IWRITE)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\ladyada\\.cookiecutters\\cookiecutter-adafruit-circuitpython\\{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix \uf07c capitalize }}_{% endif %}CircuitPython_{{ cookiecutter.library_name}}\\examples\\{{ cookiecutter.library_name \uf07c lower }}_simpletest.py'

Formatting issues in PyPI installation section in README.rst

Couple of things I found with the lib I cookied yesterday.

1. The title for the Installing from PyPI section is not formatted as a title. It is currently:

Installing from PyPI
On supported GNU/Linux...

Needs to be:

Installing from PyPI
====================
On supported GNU/Linux

2. Apparently when there are underscores in the lib name (debug_bus_device in this case), the PyPI URL, and all of the pip commands retain the _ in the lib name, vs converting them to - which is what PyPI will do on deployment. Example:

Installing from PyPI
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
PyPI <https://pypi.org/project/adafruit-circuitpython-debug_bus_device/>`_. To install for current user:

.. code-block:: shell

    pip3 install adafruit-circuitpython-debug_bus_device

Same followed for the rest of the PyPI instructions.

conf.py can be confused with library code

I wonder if it's a good idea to have the conf.py and all the documentation at the top level of the repositories, and not in a docs directory like all the other projects. I think it's pretty easy to get confused and copy the conf.py file to the board together with the other library files, and then panic when another library has the same file and there is a conflict. As far as I understand how Sphinx works, it's possible to use relative paths with ".." in them in its configuration, so the README file could still reside at the top level, even if conf.py was moved to docs.

"CircuitPython" not added consistently

I'm publishing my first library and first, let me say this is GREAT! Thank you!

I wanted to have my library named CircuitPython_Magic and I did not want to supply a prefix.

If you supply library_name CircuitPython_MAGIC:

  1. repo = "https://github.com/askpatrickw/CircuitPython_CircuitPython_Magic.git"
  2. Folder created is CircuitPython_MAGIC.
  3. library .py file name is circuitpython_magic.py

If you supply just Magic:

  1. repo = "https://github.com/askpatrickw/CircuitPython_Magic.git"
  2. Folder created is Magic.
  3. library .py file name is magic.py

I suggest ading a question Y\N to add CircuitPython between the prefix and the library name and if Yes, to have it be added to the repo, folder name created and library name. OR just always do this and don't prompt.

From the names of libraries in the community bundle today, I don't think I would ever find them if it wasn't for bundle. Adding CircuitPython would make them more discoverable.

As I went through the files, I found more inconsistently named items:

  • folder created on disk
  • library .py filename
  • repo in .py
  • in Readme.rst
    • Documentation and Build status urls
    • PyPi url
    • Pip install steps
  • PyPI section has adafruit in all names

Generated projects are missing most files

It seems that the wires got crossed somehow between #136 and #135. There are currently two of the jinja2 template directories and when cookie cutter is run it's only using one of them, which is the one with the PR template in it.

The generated project only contains the PR template:
image

I am working on a fix for this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.