diff --git a/.gitignore b/.gitignore index 544ec4a..db3d538 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,7 @@ _build # Virtual environment-specific files .env +.venv # MacOS-specific files *.DS_Store diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0e5fccc..179cf07 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,27 +4,27 @@ repos: - repo: https://github.com/python/black - rev: 22.3.0 + rev: 23.3.0 hooks: - id: black - repo: https://github.com/fsfe/reuse-tool - rev: v0.14.0 + rev: v1.1.2 hooks: - id: reuse - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.2.0 + rev: v4.4.0 hooks: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/pycqa/pylint - rev: v2.15.5 + rev: v2.17.4 hooks: - id: pylint name: pylint (library code) types: [python] args: - - --disable=consider-using-f-string + - --disable=consider-using-f-string,duplicate-code exclude: "^(docs/|examples/|tests/|setup.py$)" - id: pylint name: pylint (example code) diff --git a/.pylintrc b/.pylintrc index 40208c3..f945e92 100644 --- a/.pylintrc +++ b/.pylintrc @@ -396,4 +396,4 @@ min-public-methods=1 # Exceptions that will emit a warning when being caught. Defaults to # "Exception" -overgeneral-exceptions=Exception +overgeneral-exceptions=builtins.Exception diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..33c2a61 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,19 @@ +# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries +# +# SPDX-License-Identifier: Unlicense + +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +build: + os: ubuntu-20.04 + tools: + python: "3" + +python: + install: + - requirements: docs/requirements.txt + - requirements: requirements.txt diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index fbe8444..a773adf 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,10 +1,10 @@ -# CircuitPython Community Code of Conduct +# Adafruit Community Code of Conduct ## Our Pledge @@ -20,35 +20,52 @@ race, religion, or sexual identity and orientation. We are committed to providing a friendly, safe and welcoming environment for all. -Examples of behavior that contributes to creating a positive environment +Examples of behavior that contributes to creating and maintaining a positive environment include: * Be kind and courteous to others * Using welcoming and inclusive language +* Respecting the identity of every community member, including asking for their + pronouns if uncertain * Being respectful of differing viewpoints and experiences * Collaborating with other community members +* Providing desired assistance and knowledge to other community members +* Being open to new information and ideas * Gracefully accepting constructive criticism * Focusing on what is best for the community * Showing empathy towards other community members -Examples of unacceptable behavior by participants include: +Examples of unacceptable behavior by community members include: * The use of sexualized language or imagery and sexual attention or advances * The use of inappropriate images, including in a community member's avatar -* The use of inappropriate language, including in a community member's nickname +* The use of inappropriate language or profanity, including in a community member's nickname * Any spamming, flaming, baiting or other attention-stealing behavior * Excessive or unwelcome helping; answering outside the scope of the question asked * Discussion or promotion of activities or projects that intend or pose a risk of significant harm -* Trolling, insulting/derogatory comments, and personal or political attacks +* Trolling, insulting/derogatory comments, and attacks of any nature (including, + but not limited to, personal or political attacks) * Promoting or spreading disinformation, lies, or conspiracy theories against a person, group, organisation, project, or community * Public or private harassment * Publishing others' private information, such as a physical or electronic address, without explicit permission +* Engaging in behavior that creates an unwelcoming or uninclusive environment * Other conduct which could reasonably be considered inappropriate +The Adafruit Community welcomes everyone and strives to create a safe space for all. It is built +around sharing and contributing to technology. We encourage discussing your thoughts, experiences, +and feelings within the scope of the community. However, there are topics that can sometimes stray +from that scope, and can lead to hurting others and create an unwelcoming, uninclusive environment. + +Examples of discussion topics that have been known to stray outside the scope of the Adafruit +Community include, but are not limited to: + +* Discussions regarding religion and related topics +* Discussions regarding politics and related topics + The goal of the standards and moderation guidelines outlined here is to build and maintain a respectful community. We ask that you don’t just aim to be "technically unimpeachable", but rather try to be your best self. @@ -72,26 +89,30 @@ inappropriate, threatening, offensive, or harmful. ## Moderation -Instances of behaviors that violate the CircuitPython Community Code of Conduct +Instances of behaviors that violate the Adafruit Community Code of Conduct may be reported by any member of the community. Community members are encouraged to report these situations, including situations they witness involving other community members. You may report in the following ways: -In any situation, you may email the project maintainer. +In any situation, you may email . + +On the Adafruit Discord, you may send an open message from any channel +to all Community Moderators by tagging @community moderators. You may +also send an open message from the #help-with-community channel, or a +direct message to any Community Moderator. -Email reports will be kept confidential. +The source of email and direct message reports will be kept confidential. -In situations on GitHub where the issue is particularly offensive, possibly -illegal, requires immediate action, or violates the GitHub terms of service, -you should also report the message directly to GitHub via the comment, or via -[GitHub Support](https://support.github.com/contact/report-abuse?category=report-abuse&report=other&report_type=unspecified). +In situations on Discord where the issue is particularly offensive, possibly +illegal, requires immediate action, or violates the Discord terms of service, +you should also report the message directly to [Discord](https://discord.com/safety). These are the steps for upholding our community’s standards of conduct. 1. Any member of the community may report any situation that violates the - CircuitPython Community Code of Conduct. All reports will be reviewed and + Adafruit Community Code of Conduct. All reports will be reviewed and investigated. 2. If the behavior is a severe violation, the community member who committed the violation may be banned immediately, without warning. @@ -105,18 +126,19 @@ These are the steps for upholding our community’s standards of conduct. banned. 6. Disciplinary actions (warnings, bans, etc) for Code of Conduct violations apply to the platform where the violation occurred. However, depending on the severity - of the violation, the disciplinary action may be applied across CircuitPython's - other community platforms. For example, a severe violation in one Community forum - may result in a ban on not only the CircuitPython GitHub organisation, - but also on the CircuitPython Twitter, live stream text chats, etc. + of the violation, the disciplinary action may be applied across Adafruit's other + community platforms. For example, a severe violation on the Adafruit Discord + server may result in a ban on not only the Adafruit Discord server, but also on + the Adafruit GitHub organisation, Adafruit Forums, Adafruit Twitter, etc. ## Scope This Code of Conduct and the enforcement policies listed above apply to all -CircuitPython Community venues. This includes but is not limited to any community -spaces (both public and private), and CircuitPython repositories. Examples of -CircuitPython Community spaces include but are not limited to meet-ups, issue -threads on GitHub, text chats during a live stream, or interaction at a conference. +Adafruit Community venues. This includes but is not limited to any community +spaces (both public and private), the entire Adafruit Discord server, and +Adafruit GitHub repositories. Examples of Adafruit Community spaces include +but are not limited to meet-ups, audio chats on the Adafruit Discord, or +interaction at a conference. This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. As a community @@ -125,13 +147,11 @@ accordingly. ## Attribution -This Code of Conduct is adapted from the -[Adafruit Community Code of Conduct](https://github.com/adafruit/Adafruit_Community_Code_of_Conduct), -which is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), +This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), version 1.4, available on [contributor-covenant.org](https://www.contributor-covenant.org/version/1/4/code-of-conduct.html), and the [Rust Code of Conduct](https://www.rust-lang.org/en-US/conduct.html). -For other projects adopting the CircuitPython Community Code of +For other projects adopting the Adafruit Community Code of Conduct, please contact the maintainers of those projects for enforcement. If you wish to use this code of conduct for your own project, consider explicitly mentioning your moderation policy or making a copy with your diff --git a/README.rst.license b/README.rst.license index a7a170a..8c56559 100644 --- a/README.rst.license +++ b/README.rst.license @@ -1,3 +1,4 @@ SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries SPDX-FileCopyrightText: Copyright (c) 2022 JG for Cedar Grove Maker Studios + SPDX-License-Identifier: MIT diff --git a/cedargrove_nau7802.py b/cedargrove_nau7802.py index 4cdc9b5..19d77cd 100755 --- a/cedargrove_nau7802.py +++ b/cedargrove_nau7802.py @@ -1,6 +1,7 @@ # SPDX-FileCopyrightText: Copyright (c) 2023 JG for Cedar Grove Maker Studios # # SPDX-License-Identifier: MIT + """ `cedargrove_nau7802` ================================================================================ diff --git a/docs/_static/favicon.ico b/docs/_static/favicon.ico new file mode 100644 index 0000000..5aca983 Binary files /dev/null and b/docs/_static/favicon.ico differ diff --git a/docs/_static/favicon.ico.license b/docs/_static/favicon.ico.license new file mode 100644 index 0000000..86a3fbf --- /dev/null +++ b/docs/_static/favicon.ico.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries + +SPDX-License-Identifier: CC-BY-4.0 diff --git a/docs/api.rst b/docs/api.rst new file mode 100644 index 0000000..ded3a0a --- /dev/null +++ b/docs/api.rst @@ -0,0 +1,5 @@ + +.. If you created a package, create one automodule per module in the package. + +.. automodule:: cedargrove_nau7802 + :members: diff --git a/docs/api.rst.license b/docs/api.rst.license new file mode 100644 index 0000000..9aae48d --- /dev/null +++ b/docs/api.rst.license @@ -0,0 +1,3 @@ +# SPDX-FileCopyrightText: 2020 ladyada for Adafruit Industries +# +# SPDX-License-Identifier: MIT diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..6b27c5b --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,186 @@ +# -*- coding: utf-8 -*- + +# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries +# +# SPDX-License-Identifier: MIT + +import os +import sys +import datetime + +sys.path.insert(0, os.path.abspath("..")) + +# -- General configuration ------------------------------------------------ + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + "sphinx.ext.autodoc", + "sphinxcontrib.jquery", + "sphinx.ext.intersphinx", + "sphinx.ext.napoleon", + "sphinx.ext.todo", +] + +# Uncomment the below if you use native CircuitPython modules such as +# digitalio, micropython and busio. List the modules you use. Without it, the +# autodoc module docs will fail to generate with a warning. +# autodoc_mock_imports = ["digitalio", "busio", "micropython", "adafruit_bus_device"] + +intersphinx_mapping = { + "python": ("https://docs.python.org/3", None), + "BusDevice": ( + "https://docs.circuitpython.org/projects/busdevice/en/latest/", + None, + ), + "CircuitPython": ("https://docs.circuitpython.org/en/latest/", None), +} + +# Add any paths that contain templates here, relative to this directory. +templates_path = ["_templates"] + +source_suffix = ".rst" + +# The master toctree document. +master_doc = "index" + +# General information about the project. +project = "Adafruit NAU7802 Library" +creation_year = "2023" +current_year = str(datetime.datetime.now().year) +year_duration = ( + current_year + if current_year == creation_year + else creation_year + " - " + current_year +) +copyright = year_duration + " JG" +author = "JG" + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = "1.0" +# The full version, including alpha/beta/rc tags. +release = "1.0" + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = "en" + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This patterns also effect to html_static_path and html_extra_path +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ".env", "CODE_OF_CONDUCT.md"] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +# +default_role = "any" + +# If true, '()' will be appended to :func: etc. cross-reference text. +# +add_function_parentheses = True + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = "sphinx" + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = False + +# If this is True, todo emits a warning for each TODO entries. The default is False. +todo_emit_warnings = True + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +on_rtd = os.environ.get("READTHEDOCS", None) == "True" + +if not on_rtd: # only import and set the theme if we're building docs locally + try: + import sphinx_rtd_theme + + html_theme = "sphinx_rtd_theme" + html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."] + except: + html_theme = "default" + html_theme_path = ["."] +else: + html_theme_path = ["."] + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ["_static"] + +# Output file base name for HTML help builder. +htmlhelp_basename = "AdafruitNAU7802Librarydoc" + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + ( + master_doc, + "AdafruitNAU7802Library.tex", + "Adafruit NAU7802 Library Documentation", + author, + "manual", + ), +] + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ( + master_doc, + "AdafruitNAU7802library", + "Adafruit NAU7802 Library Documentation", + [author], + 1, + ) +] + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + ( + master_doc, + "AdafruitNAU7802Library", + "Adafruit NAU7802 Library Documentation", + author, + "AdafruitNAU7802Library", + "One line description of project.", + "Miscellaneous", + ), +] diff --git a/docs/examples.rst b/docs/examples.rst new file mode 100644 index 0000000..3932541 --- /dev/null +++ b/docs/examples.rst @@ -0,0 +1,8 @@ +Simple test +------------ + +Ensure your device works with this simple test. + +.. literalinclude:: ../examples/nau7802_simpletest.py + :caption: examples/nau7802_simpletest.py + :linenos: diff --git a/docs/examples.rst.license b/docs/examples.rst.license new file mode 100644 index 0000000..9aae48d --- /dev/null +++ b/docs/examples.rst.license @@ -0,0 +1,3 @@ +# SPDX-FileCopyrightText: 2020 ladyada for Adafruit Industries +# +# SPDX-License-Identifier: MIT diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..e8bd216 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,48 @@ +.. include:: ../README.rst + +Table of Contents +================= + +.. toctree:: + :maxdepth: 4 + :hidden: + + self + +.. toctree:: + :caption: Examples + + examples + +.. toctree:: + :caption: API Reference + :maxdepth: 3 + + api + +.. toctree:: + :caption: Tutorials + +.. toctree:: + :caption: Related Products + + Adafruit NAU7802 24-Bit ADC + +.. toctree:: + :caption: Other Links + + Download from GitHub + Download Library Bundle + CircuitPython Reference Documentation + CircuitPython Support Forum + Discord Chat + Adafruit Learning System + Adafruit Blog + Adafruit Store + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/index.rst.license b/docs/index.rst.license new file mode 100644 index 0000000..9aae48d --- /dev/null +++ b/docs/index.rst.license @@ -0,0 +1,3 @@ +# SPDX-FileCopyrightText: 2020 ladyada for Adafruit Industries +# +# SPDX-License-Identifier: MIT diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000..797aa04 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,6 @@ +# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries +# +# SPDX-License-Identifier: Unlicense + +sphinx>=4.0.0 +sphinxcontrib-jquery diff --git a/optional_requirements.txt b/optional_requirements.txt new file mode 100644 index 0000000..d4e27c4 --- /dev/null +++ b/optional_requirements.txt @@ -0,0 +1,3 @@ +# SPDX-FileCopyrightText: 2022 Alec Delaney, for Adafruit Industries +# +# SPDX-License-Identifier: Unlicense diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..0ffa4cb --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,46 @@ +# SPDX-FileCopyrightText: 2022 Alec Delaney for Adafruit Industries +# +# SPDX-License-Identifier: MIT + +[build-system] +requires = [ + "setuptools", + "wheel", + "setuptools-scm", +] + +[project] +name = "cedargrove-nau7802" +description = "A CircuitPython driver class for the NAU7802 24-bit ADC" +version = "0.0.0+auto.0" +readme = "README.rst" +authors = [ + {name = "Adafruit Industries", email = "circuitpython@adafruit.com"} +] +urls = {Homepage = "https://github.com/adafruit/CircuitPython_NAU7802"} +keywords = [ + "adafruit", + "nau7802", + "adc", + "sensor", + "hardware", + "micropython", + "circuitpython", +] +license = {text = "MIT"} +classifiers = [ + "Intended Audience :: Developers", + "Topic :: Software Development :: Libraries", + "Topic :: Software Development :: Embedded Systems", + "Topic :: System :: Hardware", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", +] +dynamic = ["dependencies", "optional-dependencies"] + +[tool.setuptools] +py-modules = ["cedargrove_nau7802"] + +[tool.setuptools.dynamic] +dependencies = {file = ["requirements.txt"]} +optional-dependencies = {optional = {file = ["optional_requirements.txt"]}} diff --git a/pyproject.toml.disabled b/pyproject.toml.disabled deleted file mode 100644 index cb5c722..0000000 --- a/pyproject.toml.disabled +++ /dev/null @@ -1,6 +0,0 @@ -# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò -# -# SPDX-License-Identifier: Unlicense - -# This library is not deployed to PyPI. It is either a board-specific helper library, or -# does not make sense for use on or is incompatible with single board computers and Linux.