Skip to main content
Chemistry LibreTexts

8.5: Third Party Library Functions

  • Page ID
    470271
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    Third party functions can be downloaded as packages or libraries, which are collections of modules. These are very similiar to each other, with the main difference being that a package has a directory structure that includes an __init__.py file that initializes the package.  So a library can be organized as a package, but it does not have to be.  When it is, you can bring up functions within modules as methods [module_name.method_name].

     

    The following modules are at 8: Third Party Library Modules

    1. Requests
    2. Gpiozero (standard on Raspberry Pi)

    PyPi Python Package Index

    The python Package Index (https://pypi.org/) is an excellent source of third party python packages and as of 2024-02-07 there are 512,807 projects with 10,234,789 files from a community of 782,675 users.

    To install a third party package from PyPi you use the pip install command

    pip install package-name
    

    You bought a 5 pack of DS18B20 temperature sensors and want to find some code.

    clipboard_e41382c71220a5b213beea398ca513f3d.pngFigure \(\PageIndex{1}\): Copy and Paste Caption here. (Copyright; author via source)

    Go to PyPi and do a search for "Raspberry Pi DS18B20 temperature sensor" (figure \(\PageIndex{2}\)

    clipboard_e55652377ec202bf5b854e73bd615f08e.pngFigure \(\PageIndex{2}\): Search for DS18B20 sensors on 2024-02-07. (Copyright; author via source)
    PyPi Search Tip

    When searching it is often prudent to open several links in new tabs and quickly skim through them until you find one you like.  I typically look at the first 3-5 hits, review them and close them if I do not see what I want, and then if needed, extend my search with a new tab.

    The third hit of the above search sends you to a package that was updated within the last 6 months, https://pypi.org/project/w1thermsensor/.

    GitHub

    GitHub (https://github.com/) is of course one of the best places to look for code.  Unlike the PyPi Python Package index (that is devoted to Python Packages) GitHub covers non-Python code and so you may want to alter your search to Raspberry Pi Python DS18B20 temperature sensor, and the first hit is the same hit as hit 3 in PyPi

    Instructables

    Instructables (https://www.instructables.com/) is a website hosted by AutoDesk that allows people to post all sorts of projects, and these include both hardware, wiring and code.

     

    Vendors

    Many "Maker Community" vendors supply code for their products, and this incomplete list will be growing.

    AdaFruit

    AdaFruit (https://www.adafruit.com/

     

     


    This page titled 8.5: Third Party Library Functions is shared under a not declared license and was authored, remixed, and/or curated by Robert Belford.

    • Was this article helpful?