Skip to content

Commit

Permalink
Merge branch 'release-docs'
Browse files Browse the repository at this point in the history
  • Loading branch information
waveform80 committed Mar 15, 2021
2 parents 9155d40 + 0c7a979 commit 5e30819
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 68 deletions.
10 changes: 10 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@ Forums`_.
.. _Raspberry Pi Stack Exchange: https://raspberrypi.stackexchange.com/
.. _Raspberry Pi Forums: https://www.raspberrypi.org/forums/

Python 2 support
================

.. warning::

Version 1.6.0 of GPIO Zero is the last to support Python 2. The next release
will be Version 2.0.0 and will support Python 3 only.

Contributors
============

Expand Down Expand Up @@ -152,6 +160,7 @@ Contributors
- `Martchus`_
- `Martin O'Hanlon`_
- `Mike Kazantsev`_
- `Paulo Mateus`_
- `Phil Howard`_
- `Philippe Muller`_
- `Rick Ansell`_
Expand Down Expand Up @@ -196,6 +205,7 @@ See the `contributors page`_ on GitHub for more info.
.. _Martchus: https://github.com/gpiozero/gpiozero/commits?author=Martchus
.. _Martin O'Hanlon: https://github.com/martinohanlon/commits?author=martinohanlon
.. _Mike Kazantsev: https://github.com/gpiozero/gpiozero/commits?author=mk-fg
.. _Paulo Mateus: https://github.com/gpiozero/gpiozero/commits?author=SrMouraSilva
.. _Phil Howard: https://github.com/gpiozero/gpiozero/commits?author=Gadgetoid
.. _Philippe Muller: https://github.com/gpiozero/gpiozero/commits?author=pmuller
.. _Rick Ansell: https://github.com/gpiozero/gpiozero/commits?author=ricksbt
Expand Down
53 changes: 50 additions & 3 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,78 @@ Changelog

.. currentmodule:: gpiozero

Release 1.5.2 (unreleased)
Release 1.6.0 (2021-03-14)
==========================

* Added :class:`RotaryEncoder` class (thanks to Paulo Mateus) (`#482`_, `#928`_)
* Added support for multi-segment character displays with
:class:`LEDCharDisplay` and :class:`LEDMultiCharDisplay` along with "font"
support using :class:`LEDCharFont` (thanks to Martin O'Hanlon) (`#357`_,
`#485`_, `#488`_, `#493`_, `#930`_)
* Added :class:`Pibrella` class (thanks to Carl Monk) (`#773`_, `#798`_)
* Added :class:`TrafficpHat` class (thanks to Ryan Walmsley) (`#845`_, `#846`_)
* Added support for the `lgpio`_ library as a pin factory (`#927`_)
(:class:`~gpiozero.pins.lgpio.LGPIOFactory`) (thanks to Joan for lg) (`#927`_)
* Allow :class:`Motor` to pass :attr:`~Device.pin_factory` to its child
:class:`OutputDevice` objects (thanks to Yisrael Dov Lebow) (`#792`_)
* Small SPI exception fix (thanks to Maksim Levental) (`#762`_)
* Warn users when using default pin factory for Servos and Distance Sensors
(thanks to Sofiia Kosovan and Daniele Procida at the EuroPython sprints)
(`#780`_, `#781`_)
* Add :attr:`~Servo.pulse_width` property to :class:`Servo` (suggested by
* Added :attr:`~Servo.pulse_width` property to :class:`Servo` (suggested by
Daniele Procida at the PyCon UK sprints) (`#795`_, `#797`_)
* Added event-driven functionality to :doc:`internal devices <api_internal>`
(`#941`_)
* Allowed :class:`Energenie` sockets preserve their state on construction
(thanks to Jack Wearden) (`#865`_)
* Added source tools :func:`~gpiozero.tools.scaled_half` and
:func:`~gpiozero.tools.scaled_full`
* Added complete Pi 4 support to :class:`~gpiozero.pins.native.NativeFactory`
(thanks to Andrew Scheller) (`#920`_, `#929`_, `#940`_)
* Updated add-on boards to use BOARD numbering (`#349`_, `#860`_)
* Fixed :class:`ButtonBoard` release events (`#761`_)
* Add ASCII art diagrams to :program:`pinout` for Pi 400 and CM4 (`#932`_)
* Cleaned up software SPI (thanks to Andrew Scheller and Kyle Morgan) (`#777`_,
`#895`_, `#900`_)
* Added USB3 and Ethernet speed attributes to :func:`pi_info`
* Various docs updates

.. warning::

This is the last release to support Python 2

.. _lgpio: http://abyz.me.uk/lg/py_lgpio.html
.. _#482: https://github.com/gpiozero/gpiozero/issues/482
.. _#928: https://github.com/gpiozero/gpiozero/issues/928
.. _#357: https://github.com/gpiozero/gpiozero/issues/357
.. _#485: https://github.com/gpiozero/gpiozero/issues/485
.. _#488: https://github.com/gpiozero/gpiozero/issues/488
.. _#493: https://github.com/gpiozero/gpiozero/issues/493
.. _#930: https://github.com/gpiozero/gpiozero/issues/930
.. _#773: https://github.com/gpiozero/gpiozero/issues/773
.. _#798: https://github.com/gpiozero/gpiozero/issues/798
.. _#792: https://github.com/gpiozero/gpiozero/issues/792
.. _#845: https://github.com/gpiozero/gpiozero/issues/845
.. _#846: https://github.com/gpiozero/gpiozero/issues/846
.. _#927: https://github.com/gpiozero/gpiozero/issues/927
.. _#792: https://github.com/gpiozero/gpiozero/issues/792
.. _#762: https://github.com/gpiozero/gpiozero/issues/762
.. _#780: https://github.com/gpiozero/gpiozero/issues/780
.. _#781: https://github.com/gpiozero/gpiozero/issues/781
.. _#795: https://github.com/gpiozero/gpiozero/issues/795
.. _#797: https://github.com/gpiozero/gpiozero/issues/797
.. _#941: https://github.com/gpiozero/gpiozero/issues/941
.. _#865: https://github.com/gpiozero/gpiozero/issues/865
.. _#920: https://github.com/gpiozero/gpiozero/issues/920
.. _#929: https://github.com/gpiozero/gpiozero/issues/929
.. _#940: https://github.com/gpiozero/gpiozero/issues/940
.. _#939: https://github.com/gpiozero/gpiozero/issues/939
.. _#349: https://github.com/gpiozero/gpiozero/issues/349
.. _#860: https://github.com/gpiozero/gpiozero/issues/860
.. _#761: https://github.com/gpiozero/gpiozero/issues/761
.. _#932: https://github.com/gpiozero/gpiozero/issues/932
.. _#777: https://github.com/gpiozero/gpiozero/issues/777
.. _#895: https://github.com/gpiozero/gpiozero/issues/895
.. _#900: https://github.com/gpiozero/gpiozero/issues/900

Release 1.5.1 (2019-06-24)
==========================
Expand Down
6 changes: 3 additions & 3 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ Python 2/3
==========

The library is 100% compatible with both Python 2.7 and Python 3 from version
3.2 onwards. We intend to drop Python 2 support in 2020 when Python 2 reaches
`end-of-life`_.
3.2 onwards. Since Python 2 is now past its `end-of-life`_, the 1.6.0 release
(2021-03-14) is the last to support Python 2.


.. _docs: https://github.com/gpiozero/gpiozero/tree/master/docs
.. _issue: https://github.com/gpiozero/gpiozero/issues
.. _issue: https://github.com/gpiozero/gpiozero/issues/new
.. _end-of-life: http://legacy.python.org/dev/peps/pep-0373/
114 changes: 57 additions & 57 deletions docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,61 @@ events to be detected::
pause()


What's the difference between when_pressed, is_pressed and wait_for_press?
==========================================================================

gpiozero provides a range of different approaches to reading input devices.
Sometimes you want to ask if a button's pressed, sometimes you want to do
something until it's pressed, and sometimes you want something to happen *when*
it's been pressed, regardless of what else is going on.

In a simple example where the button is the only device in play, all of the
options would be equally effective. But as soon as you introduce an extra
element, like another GPIO device, you might need to choose the right approach
depending on your use case.

* :attr:`~gpiozero.Button.is_pressed` is an attribute which reveals whether the
button is currently pressed by returning ``True`` or ``False``::

while True:
if btn.is_pressed:
print("Pressed")
else:
print("Not pressed")

* :meth:`~gpiozero.Button.wait_for_press()` as a method which blocks the code from
continuing until the button is pressed. Also see
:meth:`~gpiozero.Button.wait_for_release()`::

while True:
print("Released. Waiting for press..")
btn.wait_for_press()
print("Pressed. Waiting for release...")
btn.wait_for_release()

* :attr:`~gpiozero.Button.when_pressed` is an attribute which assigns a callback
function to the event of the button being pressed. Every time the button is
pressed, the callback function is executed in a separate thread. Also see
:attr:`~gpiozero.Button.when_released`::

def pressed():
print("Pressed")

def released():
print("Released")

btn.when_pressed = pressed
btn.when_released = released

This pattern of options is common among many devices. All :doc:`input devices
<api_input>` and :doc:`internal devices <api_internal>` have ``is_active``,
``when_activated``, ``when_deactivated``, ``wait_for_active`` and
``wait_for_inactive``, and many provide aliases (such as "pressed" for
"activated").

Also see a more advanced approach in the :doc:`source_values` page.


My event handler isn't being called
===================================

Expand Down Expand Up @@ -158,9 +213,9 @@ version of gpiozero is available in your Python environment like so:
>>> from pkg_resources import require
>>> require('gpiozero')
[gpiozero 1.5.1 (/usr/lib/python3/dist-packages)]
[gpiozero 1.6.0 (/usr/lib/python3/dist-packages)]
>>> require('gpiozero')[0].version
'1.5.1'
'1.6.0'
If you have multiple versions installed (e.g. from :command:`pip` and
:command:`apt`) they will not show up in the list returned by the
Expand Down Expand Up @@ -370,61 +425,6 @@ curve for beginners by making it easy to get started and easy to build up to
more advanced projects.


What's the difference between when_pressed, is_pressed and wait_for_press?
==========================================================================

gpiozero provides a range of different approaches to reading input devices.
Sometimes you want to ask if a button's pressed, sometimes you want to do
something until it's pressed, and sometimes you want something to happen *when*
it's been pressed, regardless of what else is going on.

In a simple example where the button is the only device in play, all of the
options would be equally effective. But as soon as you introduce an extra
element, like another GPIO device, you might need to choose the right approach
depending on your use case.

* :attr:`~gpiozero.Button.is_pressed` is an attribute which reveals whether the
button is currently pressed by returning ``True`` or ``False``::

while True:
if btn.is_pressed:
print("Pressed")
else:
print("Not pressed")

* :meth:`~gpiozero.Button.wait_for_press()` as a method which blocks the code from
continuing until the button is pressed. Also see
:meth:`~gpiozero.Button.wait_for_release()`::

while True:
print("Released. Waiting for press..")
btn.wait_for_press()
print("Pressed. Waiting for release...")
btn.wait_for_release()

* :attr:`~gpiozero.Button.when_pressed` is an attribute which assigns a callback
function to the event of the button being pressed. Every time the button is
pressed, the callback function is executed in a separate thread. Also see
:attr:`~gpiozero.Button.when_released`::

def pressed():
print("Pressed")

def released():
print("Released")

btn.when_pressed = pressed
btn.when_released = released

This pattern of options is common among many devices. All :doc:`input devices
<api_input>` and :doc:`internal devices <api_internal>` have ``is_active``,
``when_activated``, ``when_deactivated``, ``wait_for_active`` and
``wait_for_inactive``, and many provide aliases (such as "pressed" for
"activated").

Also see a more advanced approach in the :doc:`source_values` page.


.. _get-pip: https://pip.pypa.io/en/stable/installing/
.. _GitHub issues: https://github.com/gpiozero/gpiozero/issues
.. _commits: https://github.com/gpiozero/gpiozero/commits/master
Expand Down
24 changes: 19 additions & 5 deletions docs/installing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,23 @@ the `Raspberry Pi Desktop`_ image for PC/Mac, both available from
and other operating systems, including for PCs using the :doc:`remote GPIO
<remote_gpio>` feature.

.. _Raspberry Pi OS: https://www.raspberrypi.org/software/operating-systems/
.. _Raspberry Pi Desktop: https://www.raspberrypi.org/software/raspberry-pi-desktop/
.. _raspberrypi.org: https://www.raspberrypi.org/software/

Raspberry Pi
============

GPIO Zero is packaged in the apt repositories of Raspberry Pi OS, `Debian`_ and
`Ubuntu`_. It is also available on `PyPI`_.

.. _Debian: https://packages.debian.org/buster/python3-gpiozero
.. _Ubuntu: https://packages.ubuntu.com/hirsute/python3-gpiozero
.. _PyPI: https://pypi.org/project/gpiozero/

apt
---

First, update your repositories list:

.. code-block:: console
Expand All @@ -36,6 +50,9 @@ or Python 2:
pi@raspberrypi:~$ sudo apt install python-gpiozero
pip
---

If you're using another operating system on your Raspberry Pi, you may need to
use pip to install GPIO Zero instead. Install pip using `get-pip`_ and then
type:
Expand All @@ -52,6 +69,8 @@ or for Python 2:
To install GPIO Zero in a virtual environment, see the :doc:`development` page.

.. _get-pip: https://pip.pypa.io/en/stable/installing/

PC/Mac
======

Expand Down Expand Up @@ -94,10 +113,5 @@ download from the `ReadTheDocs site`_. Simply click on the "Read the Docs" box
at the bottom-left corner of the page (under the table of contents) and select
"PDF" or "Epub" from the "Downloads" section.


.. _Raspberry Pi OS: https://www.raspberrypi.org/software/operating-systems/
.. _Raspberry Pi Desktop: https://www.raspberrypi.org/software/raspberry-pi-desktop/
.. _raspberrypi.org: https://www.raspberrypi.org/software/
.. _get-pip: https://pip.pypa.io/en/stable/installing/
.. _doc-base: https://wiki.debian.org/doc-base
.. _ReadTheDocs site: https://gpiozero.readthedocs.io/

0 comments on commit 5e30819

Please sign in to comment.