From 90bf1530cb014b687dbe95b35a6575073a21f4c0 Mon Sep 17 00:00:00 2001 From: Kattni Rembor Date: Sun, 5 Aug 2018 14:31:03 -0400 Subject: [PATCH 1/3] PyPi setup. --- .gitignore | 7 ++++- .travis.yml | 38 +++++++++++++------------- adafruit_is31fl3731.py | 2 +- docs/conf.py | 2 +- requirements.txt | 1 + setup.py | 61 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 89 insertions(+), 22 deletions(-) create mode 100644 setup.py diff --git a/.gitignore b/.gitignore index 6337ada..55f127b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,12 @@ +*.mpy +.idea __pycache__ _build *.pyc -*.mpy .env build* bundles +*.DS_Store +.eggs +dist +**/*.egg-info \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 508d24a..84eadc3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,32 +1,32 @@ -# This is a common .travis.yml for generating library release zip files for -# CircuitPython library releases using circuitpython-build-tools. -# See https://github.com/adafruit/circuitpython-build-tools for detailed setup -# instructions. - dist: trusty sudo: false language: python python: - - "3.6" - +- '3.6' cache: - pip: true - + pip: true deploy: - provider: releases - api_key: $GITHUB_TOKEN +- provider: releases + api_key: "$GITHUB_TOKEN" file_glob: true - file: $TRAVIS_BUILD_DIR/bundles/* + file: "$TRAVIS_BUILD_DIR/bundles/*" skip_cleanup: true overwrite: true on: tags: true - +- provider: pypi + user: adafruit-travis + on: + tags: true + password: + secure: JjxKJfGwpUjwykn94pEiVIO+XtAp1JkhPxpd5GIGH5o2mhR7TDgKkNCLTmN7dhVofTb23UeB0RSCMqXkcu2aYx5t9ohEHk9PPds7LxCyYb6kmiDq0mZHjvj7dzKQjXMgImIJjLN/DtTI3q62q9aufPvC1JExgHheSZ7lsXk2tD7M7430qSN0zPeG9Zbr8Fm+ljvwrSZgkZ7Ln/9QKSOinYdW/Xz5gSLYSoK8b1oHCw0RdFscBcDcNJXmaV8FukBWORJ265aTA/ONkqhPgKSEZ6rK7L/JCKsC8UIvO1TQ/4C8RdnscZ57zInmlLK0Y3PzUT2p5jX5rHGxQ0GXjf2c6n27UlfWtt6JA6sycBDkDZZWCxKaCpwY/8i5hlTXCXrMkxtgeg8zLIIuQfdbkqYBG6nhkSOqj2o0EFaVIfJCOHmXEBiV+as/uMVyw+9VpgiFjF7wlK2WgTcaJa3n36omURmQ+Xl/VcQ0/W95N638j2Z3ibQYuLqwNBYGgEKLCPjv5gZ0s2kmS+71NpXQqr2Lp8sT2Wii/XwDbRfnNd4aVIdkoojW+iN4ZRYki9wND1Q6FEi4VkjpWEnnl35VUkmE+KnQf3Iqddt24RDaplmQ5OGI0Q8wtIpTjyknyByn8vn58ZIz+MDw8QriwnA22Ej4lMLVFn1NIkdLODPus50rb7g= install: - - pip install pylint circuitpython-build-tools Sphinx sphinx-rtd-theme - +- pip install -r requirements.txt +- pip install pylint circuitpython-build-tools Sphinx sphinx-rtd-theme +- pip install --force-reinstall pylint==1.9.2 script: - - pylint adafruit_is31fl3731.py - - ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/*.py) - - circuitpython-build-bundles --filename_prefix adafruit-circuitpython-is31fl3731 --library_location . - - cd docs && sphinx-build -E -W -b html . _build/html +- pylint adafruit_is31fl3731.py +- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/*.py) +- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-is31fl3731 + --library_location . +- cd docs && sphinx-build -E -W -b html . _build/html && cd .. diff --git a/adafruit_is31fl3731.py b/adafruit_is31fl3731.py index 932a9c2..16d8231 100644 --- a/adafruit_is31fl3731.py +++ b/adafruit_is31fl3731.py @@ -258,7 +258,7 @@ def blink(self, rate=None): """ if rate is None: return (self._register(_CONFIG_BANK, _BLINK_REGISTER) & 0x07) * 270 - elif rate == 0: + if rate == 0: self._register(_CONFIG_BANK, _BLINK_REGISTER, 0x00) return None rate //= 270 diff --git a/docs/conf.py b/docs/conf.py index 6ff5426..2636466 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -18,7 +18,7 @@ # Uncomment the below if you use native CircuitPython modules such as # digitalio, micropython and busio. List the modules you use. Without it, the # autodoc module docs will fail to generate with a warning. -autodoc_mock_imports = ["micropython"] +# autodoc_mock_imports = ["micropython"] intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'BusDevice': ('https://circuitpython.readthedocs.io/projects/busdevice/en/latest/', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)} diff --git a/requirements.txt b/requirements.txt index e69de29..6b4e64a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -0,0 +1 @@ +Adafruit-Blinka \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..dc3a267 --- /dev/null +++ b/setup.py @@ -0,0 +1,61 @@ +"""A setuptools based setup module. + +See: +https://packaging.python.org/en/latest/distributing.html +https://github.com/pypa/sampleproject +""" + +# Always prefer setuptools over distutils +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( + name='adafruit-circuitpython-is31fl3731', + + use_scm_version=True, + setup_requires=['setuptools_scm'], + + description='CircuitPython library for IS31FL3731 charlieplex LED matrices.', + long_description=long_description, + long_description_content_type='text/x-rst', + + # The project's main homepage. + url='https://github.com/adafruit/Adafruit_CircuitPython_IS31FL3731', + + # Author details + author='Adafruit Industries', + author_email='circuitpython@adafruit.com', + + install_requires=['Adafruit-Blinka'], + + # 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', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + ], + + # What does your project relate to? + keywords='adafruit is31fl3731 led matrix charlieplex featherwing' + 'breakout hardware micropython circuitpython', + + # You can just specify the packages manually here if your project is + # simple. Or you can use find_packages(). + py_modules=['adafruit_is31fl3731'], +) From c6acddbcc376f78770a2acfa561544e05c48f361 Mon Sep 17 00:00:00 2001 From: Kattni Rembor Date: Mon, 6 Aug 2018 12:43:45 -0400 Subject: [PATCH 2/3] pylint: disable added --- adafruit_is31fl3731.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/adafruit_is31fl3731.py b/adafruit_is31fl3731.py index 16d8231..0938653 100644 --- a/adafruit_is31fl3731.py +++ b/adafruit_is31fl3731.py @@ -256,9 +256,10 @@ def audio_play(self, sample_rate, audio_gain=0, def blink(self, rate=None): """Updates the blink register """ + # pylint: disable=no-else-return if rate is None: return (self._register(_CONFIG_BANK, _BLINK_REGISTER) & 0x07) * 270 - if rate == 0: + elif rate == 0: self._register(_CONFIG_BANK, _BLINK_REGISTER, 0x00) return None rate //= 270 From 07793d9c0e1237ba6d1eec96326b164fc8a69a0b Mon Sep 17 00:00:00 2001 From: Kattni Rembor Date: Mon, 6 Aug 2018 12:45:17 -0400 Subject: [PATCH 3/3] Added comment --- adafruit_is31fl3731.py | 1 + 1 file changed, 1 insertion(+) diff --git a/adafruit_is31fl3731.py b/adafruit_is31fl3731.py index 0938653..fe978e3 100644 --- a/adafruit_is31fl3731.py +++ b/adafruit_is31fl3731.py @@ -257,6 +257,7 @@ def blink(self, rate=None): """Updates the blink register """ # pylint: disable=no-else-return + # This needs to be refactored when it can be tested if rate is None: return (self._register(_CONFIG_BANK, _BLINK_REGISTER) & 0x07) * 270 elif rate == 0: