Skip to content

Commit 8e575e7

Browse files
authored
Merge pull request #107 from pimoroni/patch-drop-python2
Drop Python 2 support
2 parents 920485e + 47089ae commit 8e575e7

File tree

10 files changed

+28
-29
lines changed

10 files changed

+28
-29
lines changed

.github/workflows/test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
python: [2.7, 3.5, 3.6, 3.7, 3.8]
14+
python: [3.6, 3.7, 3.9]
1515

1616
steps:
1717
- uses: actions/checkout@v2
@@ -33,5 +33,5 @@ jobs:
3333
run: |
3434
python -m pip install coveralls
3535
coveralls --service=github
36-
if: ${{ matrix.python == '3.8' }}
36+
if: ${{ matrix.python == '3.9' }}
3737

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ curl -sSL https://get.pimoroni.com/enviroplus | bash
3535

3636
## Or... Install from PyPi and configure manually:
3737

38-
* Run `sudo pip install enviroplus`
38+
* Run `sudo python3 -m pip install enviroplus`
3939

4040
**Note** this wont perform any of the required configuration changes on your Pi, you may additionally need to:
4141

examples/luftdaten.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def send_to_luftdaten(values, id):
127127

128128
resp_pm = None
129129
resp_bmp = None
130-
130+
131131
try:
132132
resp_pm = requests.post(
133133
"https://api.luftdaten.info/v1/push-sensor-data/",
@@ -150,7 +150,7 @@ def send_to_luftdaten(values, id):
150150
except requests.exceptions.RequestException as e:
151151
logging.warning('Luftdaten PM Request Error: {}'.format(e))
152152

153-
try:
153+
try:
154154
resp_bmp = requests.post(
155155
"https://api.luftdaten.info/v1/push-sensor-data/",
156156
json={

examples/mqtt-all.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
#!/usr/bin/env python3
12
"""
23
Run mqtt broker on localhost: sudo apt-get install mosquitto mosquitto-clients
34
45
Example run: python3 mqtt-all.py --broker 192.168.1.164 --topic enviro --username xxx --password xxxx
56
"""
6-
#!/usr/bin/env python3
77

88
import argparse
99
import ST7735
@@ -43,6 +43,7 @@
4343
DEFAULT_USERNAME = None
4444
DEFAULT_PASSWORD = None
4545

46+
4647
# mqtt callbacks
4748
def on_connect(client, userdata, flags, rc):
4849
if rc == 0:
@@ -99,7 +100,7 @@ def get_cpu_temperature():
99100
["vcgencmd", "measure_temp"], stdout=PIPE, universal_newlines=True
100101
)
101102
output, _error = process.communicate()
102-
return float(output[output.index("=") + 1 : output.rindex("'")])
103+
return float(output[output.index("=") + 1:output.rindex("'")])
103104

104105

105106
# Get Raspberry Pi serial number to use as ID
@@ -240,7 +241,7 @@ def main():
240241
HAS_PMS = False
241242
try:
242243
pms5003 = PMS5003()
243-
pm_values = pms5003.read()
244+
_ = pms5003.read()
244245
HAS_PMS = True
245246
print("PMS5003 sensor is connected")
246247
except SerialTimeoutError:

install.sh

+3-8
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,6 @@ printf "$LIBRARY_NAME $LIBRARY_VERSION Python Library: Installer\n\n"
139139
140140
cd library
141141
142-
printf "Installing for Python 2..\n"
143-
apt_pkg_install "${PY2_DEPS[@]}"
144-
python setup.py install > /dev/null
145-
if [ $? -eq 0 ]; then
146-
success "Done!\n"
147-
echo "pip uninstall $LIBRARY_NAME" >> $UNINSTALLER
148-
fi
149-
150142
if [ -f "/usr/bin/python3" ]; then
151143
printf "Installing for Python 3..\n"
152144
apt_pkg_install "${PY3_DEPS[@]}"
@@ -155,6 +147,9 @@ if [ -f "/usr/bin/python3" ]; then
155147
success "Done!\n"
156148
echo "pip3 uninstall $LIBRARY_NAME" >> $UNINSTALLER
157149
fi
150+
else
151+
printf "/usr/bin/python3 not found. Unable to install!\n"
152+
exit 1
158153
fi
159154
160155
cd $WD

library/CHANGELOG.txt

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
0.0.5
2+
-----
3+
4+
* Drop Python 2.x support
5+
16
0.0.4
27
-----
38

library/README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ curl -sSL https://get.pimoroni.com/enviroplus | bash
3535

3636
## Or... Install from PyPi and configure manually:
3737

38-
* Run `sudo pip install enviroplus`
38+
* Run `sudo python3 -m pip install enviroplus`
3939

4040
**Note** this wont perform any of the required configuration changes on your Pi, you may additionally need to:
4141

@@ -70,6 +70,12 @@ sudo apt install python-numpy python-smbus python-pil python-setuptools
7070
* Discord - https://discord.gg/hr93ByC
7171

7272
# Changelog
73+
74+
0.0.5
75+
-----
76+
77+
* Drop Python 2.x support
78+
7379
0.0.4
7480
-----
7581

library/enviroplus/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.0.4'
1+
__version__ = '0.0.5'

library/setup.cfg

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
[metadata]
33
name = enviroplus
4-
version = 0.0.4
4+
version = 0.0.5
55
author = Philip Howard
66
author_email = [email protected]
77
description = Enviro pHAT Plus environmental monitoring add-on for Raspberry Pi
@@ -20,13 +20,13 @@ classifiers =
2020
Operating System :: POSIX :: Linux
2121
License :: OSI Approved :: MIT License
2222
Intended Audience :: Developers
23-
Programming Language :: Python :: 2.7
2423
Programming Language :: Python :: 3
2524
Topic :: Software Development
2625
Topic :: Software Development :: Libraries
2726
Topic :: System :: Hardware
2827

2928
[options]
29+
python_requires = >= 3.6
3030
packages = enviroplus
3131
install_requires =
3232
pimoroni-bme280
@@ -54,14 +54,6 @@ ignore =
5454

5555
[pimoroni]
5656
py2deps =
57-
python-pip
58-
python-numpy
59-
python-smbus
60-
python-pil
61-
python-cffi
62-
python-spidev
63-
python-rpi.gpio
64-
libportaudio2
6557
py3deps =
6658
python3-pip
6759
python3-numpy

library/tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py{27,35},qa
2+
envlist = py{36, 37, 38, 39},qa
33
skip_missing_interpreters = True
44

55
[testenv]

0 commit comments

Comments
 (0)