From f44caab157250fa397009ca51ced89b6b629c8e4 Mon Sep 17 00:00:00 2001 From: Kattni Rembor Date: Thu, 27 Jan 2022 12:36:43 -0500 Subject: [PATCH 1/2] Publish to PyPI. --- README.rst | 80 +++++++++++++++++++++++++++++++++++++++++------ setup.py | 65 ++++++++++++++++++++++++++++++++++++++ setup.py.disabled | 8 ----- 3 files changed, 136 insertions(+), 17 deletions(-) create mode 100644 setup.py delete mode 100644 setup.py.disabled diff --git a/README.rst b/README.rst index 8ceb477..cddc01b 100644 --- a/README.rst +++ b/README.rst @@ -1,18 +1,26 @@ Introduction ============ + .. image:: https://readthedocs.org/projects/adafruit-circuitpython-nunchuk/badge/?version=latest :target: https://docs.circuitpython.org/projects/nunchuk/en/latest/ :alt: Documentation Status + .. image:: https://img.shields.io/discord/327254708534116352.svg :target: https://adafru.it/discord :alt: Discord + .. image:: https://github.com/adafruit/Adafruit_CircuitPython_Nunchuk/workflows/Build%20CI/badge.svg - :target: https://github.com/adafruit/Adafruit_CircuitPython_Nunchuk/actions/ + :target: https://github.com/adafruit/Adafruit_CircuitPython_Nunchuk/actions :alt: Build Status + +.. image:: https://img.shields.io/badge/code%20style-black-000000.svg + :target: https://github.com/psf/black + :alt: Code Style: Black + CircuitPython library for Nintendo Nunchuk controller @@ -25,7 +33,64 @@ This driver depends on: Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading -`the Adafruit library and driver bundle `_. +`the Adafruit library and driver bundle `_ +or individual libraries can be installed using +`circup `_. + +Works with the Wii controller (Nunchuck / Wiichuck). + +`Purchase one from the Adafruit shop `_ + + +Installing from PyPI +===================== +On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from +PyPI `_. +To install for current user: + +.. code-block:: shell + + pip3 install adafruit-circuitpython-nunchuk + +To install system-wide (this may be required in some cases): + +.. code-block:: shell + + sudo pip3 install adafruit-circuitpython-nunchuk + +To install in a virtual environment in your current project: + +.. code-block:: shell + + mkdir project-name && cd project-name + python3 -m venv .env + source .env/bin/activate + pip3 install adafruit-circuitpython-nunchuk + + + +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 nunchuk + +Or the following command to update an existing version: + +.. code-block:: shell + + circup update Usage Example ============= @@ -34,17 +99,14 @@ See nunchuk_simpletest.py in examples folder. Documentation ============= - API documentation for this library can be found on `Read the Docs `_. +For information on building library documentation, please check out +`this guide `_. + Contributing ============ Contributions are welcome! Please read our `Code of Conduct -`_ +`_ before contributing to help this project stay welcoming. - -Documentation -============= - -For information on building library documentation, please check out `this guide `_. diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..27af278 --- /dev/null +++ b/setup.py @@ -0,0 +1,65 @@ +# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries +# SPDX-FileCopyrightText: Copyright (c) 2022 Carter Nelson for Adafruit Industries +# +# SPDX-License-Identifier: MIT + +"""A setuptools based setup module. + +See: +https://packaging.python.org/en/latest/distributing.html +https://github.com/pypa/sampleproject +""" + +from setuptools import setup, find_packages + +# To use a consistent encoding +from codecs import open +from os import path + +here = path.abspath(path.dirname(__file__)) + +# Get the long description from the README file +with open(path.join(here, "README.rst"), encoding="utf-8") as f: + long_description = f.read() + +setup( + # Adafruit Bundle Information + name="adafruit-circuitpython-nunchuk", + use_scm_version={ + # This is needed for the PyPI version munging in the Github Actions release.yml + "git_describe_command": "git describe --tags --long", + "local_scheme": "no-local-version", + }, + setup_requires=["setuptools_scm"], + description="CircuitPython library for Nintendo Nunchuk controller", + long_description=long_description, + long_description_content_type="text/x-rst", + # The project's main homepage. + url="https://github.com/adafruit/Adafruit_CircuitPython_Nunchuk.git", + # Author details + author="Adafruit Industries", + author_email="circuitpython@adafruit.com", + install_requires=[ + "Adafruit-Blinka", + "adafruit-circuitpython-busdevice", + ], + # Choose your license + license="MIT", + # See https://pypi.python.org/pypi?%3Aaction=list_classifiers + classifiers=[ + "Development Status :: 3 - Alpha", + "Intended Audience :: Developers", + "Topic :: Software Development :: Libraries", + "Topic :: System :: Hardware", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", + ], + # What does your project relate to? + keywords="adafruit blinka circuitpython micropython nunchuk nunchuck nintendo controller", + + # 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=["adafruit_nunchuk"], +) diff --git a/setup.py.disabled b/setup.py.disabled deleted file mode 100644 index 78b5cc4..0000000 --- a/setup.py.disabled +++ /dev/null @@ -1,8 +0,0 @@ -# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries -# -# SPDX-License-Identifier: MIT - -""" -This library is not deployed to PyPI. It is either a board-specific helper library, or -does not make sense for use on or is incompatible with single board computers and Linux. -""" From 236a0469fa4a7f2c15eda6da24dc268c13772b98 Mon Sep 17 00:00:00 2001 From: Kattni Rembor Date: Thu, 27 Jan 2022 12:38:13 -0500 Subject: [PATCH 2/2] Black --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index 27af278..d9b0380 100644 --- a/setup.py +++ b/setup.py @@ -56,7 +56,6 @@ ], # What does your project relate to? keywords="adafruit blinka circuitpython micropython nunchuk nunchuck nintendo controller", - # 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,