Coder Social home page Coder Social logo

amyreese / cookiecutter-adafruit-circuitpython Goto Github PK

View Code? Open in Web Editor NEW

This project forked from adafruit/cookiecutter-adafruit-circuitpython

0.0 2.0 0.0 132 KB

Cookiecutter template for Adafruit's CircuitPython libraries.

License: MIT License

Python 100.00%

cookiecutter-adafruit-circuitpython's Introduction

Introduction

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

cookiecutter gh:adafruit/cookiecutter-adafruit-circuitpython

Then, fill in the prompts and accomplish some post generation cleanup:

Prompts

  • library_name - Shortest name for the library. Usually a chip name such as LIS3DH.
  • library_prefix - Used to prefix the code to the organization creating the library. For example, Adafruit supported libraries should say "adafruit" here. Do not add a - or _.
  • library_description - Write a sentence describing the purpose of this library (e.g. CircuitPython helper library for the DC & Stepper Motor FeatherWing, Shield and Pi Hat kits.).
  • library_keywords - Used to populate keywords for PyPi. Enter a string of keywords (e.g dht temp humidity) NOTE: The following are included by default: adafruit, blinka, circuitpython, micropython, and the library_name you enter.
  • author - Who you are! Sets the copyright to you.
  • github_user - GitHub user or organization which will host this repo. For example, Adafruit funded libraries should say "adafruit" here.
  • company - Used to give Copyright credit to the company funding the library. For example, Adafruit funded libraries should say "Adafruit Industries" here.
  • 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.

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.

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

apatt avatar caternuson avatar dhalbert avatar evaherrada avatar kattni avatar ladyada avatar siddacious avatar sommersoft avatar tannewt avatar tdicola avatar

Watchers

 avatar  avatar

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.