From f39188f4ed0c412bdeb29bfe71ecf80c298bce4b Mon Sep 17 00:00:00 2001 From: Brennen Bearnes Date: Mon, 2 Jul 2018 15:15:37 -0600 Subject: [PATCH] add setup.py, add pypi to travis.yml, misc. tweaks for pypi Changes per instructions here: https://github.com/adafruit/circuitpython/issues/979 ...builds locally. Let's see what Travis thinks. --- .travis.yml | 43 ++++++++++++++++----------------- docs/conf.py | 5 ---- requirements.txt | 3 ++- setup.py | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 84 insertions(+), 29 deletions(-) create mode 100644 setup.py diff --git a/.travis.yml b/.travis.yml index bde19a9..284b39e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,31 +1,28 @@ -# 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 - file_glob: true - file: $TRAVIS_BUILD_DIR/bundles/* - skip_cleanup: true - on: - tags: true - +- provider: releases + api_key: "$GITHUB_TOKEN" + file_glob: true + file: "$TRAVIS_BUILD_DIR/bundles/*" + skip_cleanup: true + on: + tags: true +- provider: pypi + user: adafruit-travis + password: + secure: QCVXg2x28R7W6g+YvewEM0XamfyNVUal0CvNTFgjrnqj4K9Yd9gd8uKXM9cmFxD54y2Uvw8vWyNwQ4IsVZOuuTTohzc3hIlQhSEWhYZTt5i/JQISQSph/Q/dSn0/rb7n2/utfj/g1hB7cQlAtkecISrtIF7wOJacrh11z5/Ay99kcpc60Y7YFjZTbx02g8NnM0g6Cg92fEdRLr2UtwloFw1C0+nQxdb9vS7xj3IWrtfopQ3LRVsLTGocctj5u6OPgkh+FZma+NCIseONqpYX4PYRrRZJRQ4g+SZ+6tFb6zVOHsIAJ0Z6PdLMZmUeNGb42mTfHxPFWaTtPXi5/bgsOLfuL7IMpkirrqQFyppvqi7bqBYC5dCDGguEvzwHZusK4h8SAXiLJL4hZVkzNQ4JJN3JQSvAaF7nv8LIHGNpPsFOF8sd5gndMHUOBZx+lJ6wHqk3dxrhfehKKyv/xZ8Tl1ot65E8I3QBrJfREDbSgTfyetEFMPQLOUkZFcag3FCjiLVfR2AxxxaSPMcS0eUDefhYHm78ukZi8EQRiM/5Pnqv7tnsFg4+ua4c5Hw2Tck5htNAHEMMJ94PxvFSGhbZ8ujjSjiSPePfAVoJZo1617rL7cw54LeaOe6zU5fJiWEMVDeonCFK9yZ9tmqxpEnEf+wwK4bfTI8TycA9e5oNY0M= 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 script: - - pylint adafruit_ads1x15/*.py - - ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/*.py) - - circuitpython-build-bundles --filename_prefix adafruit-circuitpython-ads1x15 --library_location . - - cd docs && sphinx-build -E -W -b html . _build/html +- pylint adafruit_ads1x15/*.py +- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/*.py) +- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-ads1x15 --library_location + . +- cd docs && sphinx-build -E -W -b html . _build/html && cd .. diff --git a/docs/conf.py b/docs/conf.py index 30d1bf6..3167ea4 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -15,11 +15,6 @@ extensions = [ 'sphinx.ext.viewcode', ] -# 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 = ["adafruit_bus_device", "micropython"] - intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'BusDevice': ('https://circuitpython.readthedocs.io/projects/busdevice/en/latest/', None),'Register': ('https://circuitpython.readthedocs.io/projects/register/en/latest/', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)} # Add any paths that contain templates here, relative to this directory. diff --git a/requirements.txt b/requirements.txt index c47d35a..3031961 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ -adafruit-circuitpython-bus-device +Adafruit-Blinka +adafruit-circuitpython-busdevice diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..6424e46 --- /dev/null +++ b/setup.py @@ -0,0 +1,62 @@ +"""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( + name='adafruit-circuitpython-ads1x15', + + use_scm_version=True, + setup_requires=['setuptools_scm'], + + description='CircuitPython library for controlling an ADS1x15 ADC.', + long_description=long_description, + long_description_content_type='text/x-rst', + + # The project's main homepage. + url='https://github.com/adafruit/Adafruit_CircuitPython_ADS1x15', + + # 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', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + ], + + # What does your project relate to? + keywords='adafruit ads1x115 adc hardware micropython circuitpython', + + # You can just specify the packages manually here if your project is + # simple. Or you can use find_packages(). + packages=['adafruit_ads1x15'], +)