Skip to content

Commit 47ff915

Browse files
Add updated PyPi and example install instructions
1 parent f78dbbd commit 47ff915

File tree

1 file changed

+21
-28
lines changed

1 file changed

+21
-28
lines changed

README.md

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -50,43 +50,25 @@ The first step to using this package is installing it on your system. The instal
5050

5151
### Python
5252

53-
The package is primarily installed using the `pip` command, downloading the package from the Python Index - "PyPi". Note - the below instructions outline installation an Linux-based (Raspberry Pi) system.
54-
5553
#### PyPi Installation
5654

57-
The SparkFun Qwiic Soil Moisture Sensor Python package is part of the overall SparkFun Qwiic Python package which is hosted on PyPi. On systems that support PyPi installation via pip, this library is installed using the following commands
55+
The package is primarily installed using the `pip3` command, downloading the package from the Python Index - "PyPi".
5856

59-
For all users (note: the user must have sudo privileges):
60-
```sh
61-
sudo pip install sparkfun-qwiic
62-
```
63-
For the current user:
57+
Note - the below instructions outline installation an Linux-based (Raspberry Pi) system.
6458

59+
First, setup a virtual environment from a specific directory using venv:
6560
```sh
66-
pip install sparkfun-qwiic
67-
```
68-
---
69-
---
70-
> [!CAUTION]
71-
> **TODO** Put together how this works with the new virtual environments used with the latest Python install
72-
---
73-
---
74-
#### Local Installation
75-
To install, make sure the setuptools package is installed on the system.
76-
77-
Direct installation at the command line:
78-
```sh
79-
python setup.py install
61+
python3 -m venv path/to/venv
8062
```
63+
You can pass any path as path/to/venv, just make sure you use the same one for all future steps. For more information on venv [click here](https://docs.python.org/3/library/venv.html).
8164

82-
To build a package for use with pip:
65+
Next, install the qwiic package with:
8366
```sh
84-
python setup.py sdist
85-
```
86-
A package file is built and placed in a subdirectory called dist. This package file can be installed using pip.
67+
path/to/venv/bin/pip3 install sparkfun-qwiic-soil-moisture-sensor
68+
```
69+
Now you should be able to run any example or custom python scripts that have `import qwiic_soil_moisture_sensor` by running e.g.:
8770
```sh
88-
cd dist
89-
pip install sparkfun_qwiic_soil_moisture_sensor-<version>.tar.gz
71+
path/to/venv/bin/python3 example_script.py
9072
```
9173

9274
### MicroPython Installation
@@ -97,6 +79,11 @@ Connect a device with MicroPython installed to your computer and then install th
9779
mpremote mip install github:sparkfun/qwiic_soil_moisture_sensor_py
9880
```
9981

82+
If you would also like to install the examples for this repository, issue the following mip command as well:
83+
```sh
84+
mprmeote mip install github:sparkfun/qwiic_soil_moisture_sensor_py@examples
85+
```
86+
10087
### CircuitPython Installation
10188
If not already installed, follow the [instructions here](https://docs.circuitpython.org/projects/circup/en/latest/#installation) to install CircUp on your computer.
10289

@@ -110,6 +97,12 @@ Finally, connect a device with CircuitPython installed to your computer and then
11097
circup install --py qwiic_soil_moisture_sensor
11198
```
11299

100+
If you would like to install any of the examples from this repository, issue the corresponding circup command from below. (NOTE: The below syntax assumes you are using CircUp on Windows. Linux and Mac will have different path seperators (i.e. "/" vs. "\"). See the [CircUp "example" command documentation](https://learn.adafruit.com/keep-your-circuitpython-libraries-on-devices-up-to-date-with-circup/example-command) for more information)
101+
```sh
102+
circup example qwiic_soil_moisture_sensor\Example1_GetReadings
103+
circup example qwiic_soil_moisture_sensor\Example2_Change_I2C_Address
104+
```
105+
113106
Example Use
114107
---------------
115108
Below is a quickstart program to print moisture level and toggle the LED on the Soil Moisture Sensor.

0 commit comments

Comments
 (0)