Skip to content

Commit

Permalink
Version 0.7.0
Browse files Browse the repository at this point in the history
Updating MetaWear-CPPApi to 0.7.4
Refactored connection behaviour: connect keyword in client to avoid autoconnect if desired.
Unit test work done and a working MockBackend.
Moved backends to simple modules instead of packages.
Flake8 adaptations.
Fix for multiple logging handlers bug. Fixes #23
Removed bluepy
Updated docs for removed bluepy.
Removing Tox testing, reverting to old Travis solution.
Added Python 3.6 to tests.
New examples: Two clients and Complimentary filter (#22).
  • Loading branch information
hbldh committed Jan 13, 2017
1 parent 2f5e8ab commit 2f11bfc
Show file tree
Hide file tree
Showing 65 changed files with 1,612 additions and 924 deletions.
10 changes: 10 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,13 @@ source = pymetawear
include = */pymetawear/*
omit =
*/setup.py
*/MetaWear-CppAPI/*

[report]
exclude_lines =
except ImportError:
def add_stream_logger
if debug:
raise NotImplementedError
pass
def _log
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ language: python
sudo: required
dist: trusty
python:
- 2.7.11
- 2.7
- 3.4
- 3.5
- 3.6
- "nightly"
matrix:
allow_failures:
- python: 3.4
- python: 3.5
- python: 3.6
- python: "nightly"
branches:
only:
Expand Down Expand Up @@ -48,4 +49,4 @@ deploy:
script: bash ./deploy_gh_pages.sh
on:
branch: master
python: 2.7.11
python: 2.7
22 changes: 22 additions & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
=======
Credits
=======

Development Lead
----------------

* Henrik Blidh <[email protected]>

Contributors (sorted alphabetically)
------------------------------------

* `Jonas Böer <https://github.com/morgil>`_ (Kinemic GmbH)
- Magnetometer module

* `Thibaud Mathieu <https://github.com/enlight3d>`_
- Raw example for temperature module

* `Eric Tsai <https://github.com/scaryghost>`_ (mbientlab)
- 64-bit datasignal address handling and typecasting


13 changes: 0 additions & 13 deletions CONTRIBUTORS.md

This file was deleted.

48 changes: 31 additions & 17 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,21 +1,35 @@
=======
History
=======

v0.7.0 (2017-01-13)
-------------------
- Using MetaWear-CppAPI version 0.7.4
- Removed bluepy backend due to it not being fully functional.
- Refactored connection behaviour. Optional autoconnect via keyword.
- Unit test work started with Mock backend.
- Flake8 adaptations.
- Fix for logging bug (#22)
- New examples: Two client setup and complimentary filter sensor fusion (#23).

v0.6.0 (2016-10-31)
===================
-------------------
- Using MetaWear-CppAPI version 0.6.0
- Replaced print-logging with proper logging module usage.
- Removed 64-bit special handling that was no longer needed.

v0.5.2 (2016-10-13)
===================
-------------------
- Temperature Module
- Using Pygatt 3.0.0 (including PR from PyMetaWear contributors)
- Builds on Windows

v0.5.1 (2016-09-15)
===================
-------------------
- Corrections to make it distributable via PyPI.

v0.5.0 (2016-09-15)
===================
-------------------
- Using MetaWear-CppAPI version 0.5.22
- Changed building procedure to handle ARM processors
- Updated requirements to make pygatt default, all others extras
Expand All @@ -28,82 +42,82 @@ v0.5.0 (2016-09-15)
- High speed sampling for accelerometer and gyroscope

v0.4.4 (2016-04-28)
===================
-------------------
- Updated MetaWear-CppAPI submodule version.
- Removed temporary build workaround.

v0.4.3 (2016-04-27)
===================
-------------------
- Critical fix for switch notifications.
- Updated MetaWear-CppAPI submodule version.
- Now using the new ``setup_metawear`` method.
- Restructured the ``IS_64_BIT`` usage which is still needed.

v0.4.2 (2016-04-27)
===================
-------------------
- Critical fix for timeout in pybluez/gattlib backend.
- Added Gyroscope module.
- Added soft reset method to client.
- Updated examples.
- Updated documentation.

v0.4.1 (2016-04-20)
===================
-------------------
- Cleanup of new modules sensor data parsing.
- Bug fix related to accelerometer module.
- Timeout parameter for client and backends.

v0.4.0 (2016-04-17)
===================
-------------------
- Major refactorisation into new module layout.
- New examples using the new module handling.
- Accelerometer convenience methods shows strange lag still.

v0.3.1 (2016-04-10)
===================
-------------------
- Critical fix for data signal subscription method.
- ``Setup.py`` handling of building made better,
- Documentation improved.

v0.3.0 (2016-04-09)
===================
-------------------
- Major refactoring: all BLE comm code practically moved to backends.
- Backend ``pybluez`` with ``gattlib`` now works well.
- Travis CI problems with Python 2.7 encoding led to
that we are now building on 2.7.11

v0.2.3 (2016-04-07)
===================
-------------------
- Changed from using ``gattlib`` on its own to using
``pybluez`` with ``gattlib``
- Travis CI and Coveralls
- Travis CI deploys documentation to gh-pages.
- Some documentation written.

v0.2.2 (2016-04-06)
===================
-------------------
- Convenience method for switch.
- Sphinx documentation added.
- Docstring updates.

v0.2.1 (2016-04-04)
===================
-------------------
- Refactoring in moving functionality back to client from backends.
- Enable BlueZ 4.X use with ``pygatt``.
- Disconnect methods added.
- Example with switch button notification.

v0.2.0 (2016-04-02)
===================
-------------------
- Two backends: ``pygatt`` and ``gattlib``
- ``pygatt`` backend can be fully initialize, i.e. handles notifications.
- ``gattlib`` backend **cannot** fully initialize, i.e. does **not** handles notifications.

v0.1.1 (2016-03-30)
===================
-------------------
- Fix to support Python 3

v0.1.0 (2016-03-30)
===================
-------------------
- Initial release
- Working communication, tested with very few API options.
14 changes: 10 additions & 4 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include LICENSE
include README.rst
include HISTORY.rst
include CONTRIBUTORS.md
include AUTHORS.rst
include requirements.txt

recursive-include pymetawear/Metawear-CppAPI *
Expand All @@ -10,8 +10,14 @@ prune pymetawear/Metawear-CppAPI/build
prune pymetawear/Metawear-CppAPI/dist

recursive-include examples *.py
recursive-include tests *.py
recursive-include docs *
recursive-include tests *
recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif
prune docs/build

global-exclude __pycache__/*
recursive-exclude * __pycache__
recursive-exclude * *.py[co]





81 changes: 81 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
make help.PHONY: clean clean-test clean-pyc clean-build docs help
.DEFAULT_GOAL := help
define BROWSER_PYSCRIPT
import os, webbrowser, sys
try:
from urllib import pathname2url
except:
from urllib.request import pathname2url

webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
endef
export BROWSER_PYSCRIPT

define PRINT_HELP_PYSCRIPT
import re, sys

for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
print("%-20s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT
BROWSER := python -c "$$BROWSER_PYSCRIPT"

help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)

clean: clean-build clean-pyc clean-test clean-docs ## remove all build, test, coverage and Python artifacts


clean-build: ## remove build artifacts
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +

clean-pyc: ## remove Python file artifacts
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +

clean-test: ## remove test and coverage artifacts
rm -fr .tox/
rm -f .coverage
rm -fr htmlcov/

clean-docs: ## Clean docs
make -C docs clean

lint: ## check style with flake8
flake8 pymetawear --exclude=Metawear-CppAPI,mbientlab --ignore=E501

test: ## run tests quickly with the default Python
py.test tests/

coverage: ## check code coverage quickly with the default Python
py.test tests/ --cov pymetawear --cov-report term-missing
coverage html
$(BROWSER) htmlcov/index.html

docs: clean-docs ## generate Sphinx HTML documentation, including API docs
make -C docs html
$(BROWSER) docs/build/html/index.html

servedocs: docs ## compile the docs watching for changes
watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D .

release: clean ## package and upload a release
python setup.py sdist upload
python setup.py bdist_wheel upload

dist: clean ## builds source and wheel package
python setup.py sdist
python setup.py bdist_wheel
ls -l dist

install: clean ## install the package to the active Python's site-packages
python setup.py install
22 changes: 7 additions & 15 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
==========
PyMetaWear
==========

Expand All @@ -11,18 +12,18 @@ Python package for connecting to and using

PyMetawear is meant to be a thin wrapper around the
`MetaWear C++ API <https://github.com/mbientlab/Metawear-CppAPI>`_,
providing a more Pythonic interface. It has support for several different
providing a more Pythonic interface. It has support for two different
Python packages for Bluetooth Low Energy communication:

- `pygatt <https://github.com/peplin/pygatt>`_
- `pybluez <https://github.com/karulis/pybluez>`_ with
`gattlib <https://bitbucket.org/OscarAcena/pygattlib>`_
- `bluepy <https://github.com/IanHarvey/bluepy>`_ (not completely functional yet)

PyMetaWear can be run with Python 2 and 3.4 with both backends,
but only with the `pygatt` backend for Python 3.5.
but only with the `pygatt` backend for Python 3.5.

**It is a Linux-only package right now**! It can be built on Windows, given that Visual Studio Community 2015 has been installed first,
**It is a Linux-only package right now**! It can be built on Windows, given that
Visual Studio Community 2015 has been installed first,
but there is no working backend for Windows BLE yet.

Installation
Expand All @@ -33,17 +34,12 @@ Installation
$ pip install pymetawear
Currently, only the `pygatt <https://github.com/peplin/pygatt>`_ communication
backend is installed by default. The other backends can be installed as extras:
backend is installed by default. The other backend can be installed as extras:

.. code-block:: bash
$ pip install pymetawear[pybluez]
or

.. code-block:: bash
$ pip install pymetawear[bluepy]
Debian requirements for ``pymetawear``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -60,10 +56,6 @@ Additional requirements for ``pybluez``
* ``libboost-python-dev``
* ``libboost-thread-dev``

Additional requirements for ``bluepy``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* ``libglib2.0-dev``


Development
~~~~~~~~~~~
Expand Down Expand Up @@ -103,7 +95,7 @@ MetaWear board, is equal for both the two usage profiles:
.. code-block:: python
from pymetawear.client import MetaWearClient
backend = 'pygatt' # Or 'pybluez' or 'bluepy'
backend = 'pygatt' # Or 'pybluez'
c = MetaWearClient('DD:3A:7D:4D:56:F0', backend)
An example: blinking with the LED lights can be done like this with the
Expand Down
1 change: 1 addition & 0 deletions docs/source/authors.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. include:: ../../AUTHORS.rst
Loading

0 comments on commit 2f11bfc

Please sign in to comment.