- Add pylintrc and mypy_ini options to the pw_python_package template.
These can be used to specify configuration files to use for Pylint and
Mypy.
- Run pylint and mypy from the setup directory. This allows tools to
find per-package configuration files (if they aren't specified by the
pylintrc or mypy_ini arguments).
- Fix some incorrect import ordering that Pylint detects now that it
runs from package directories. PEP8 states imports should be grouped
by standard library, third party, and local package imports.
Change-Id: I8017341178ac5920d623ebbed4535432d69527c3
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/26700
Reviewed-by: Keir Mierle <keir@google.com>
Reviewed-by: Alexei Frolov <frolv@google.com>
- Restructure pw_bloat and pw_docgen as Python packages and add them
to the build.
- Add pw_package and target-specific packages to the build.
Change-Id: I62e857d5c8b069e1923f68fe5f82ef49aa88a326
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/22302
Commit-Queue: Wyatt Hepler <hepler@google.com>
Reviewed-by: Alexei Frolov <frolv@google.com>
- PEP 561 (https://www.python.org/dev/peps/pep-0561/) specifies that
packages that wish to support type checking must provide a py.typed
marker file. Add py.typed to all packages.
- Add missing __init__.py files to pw_cli and pw_hdlc_lite.
Change-Id: I32d652222e9909a5ac4a5612c2dd1683b18b2d36
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/22200
Reviewed-by: Alexei Frolov <frolv@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
- Use the target-relative path for pylint's stamp so it is unique when
there are multiple files with the same basename (e.g. __init__.py).
- Serialize pip install commands since in-parallel --editable installs
do not work correctly.
- Run mypy over the entire package directory rather than individual
files.
- Fix various mypy issues so that mypy passes without
--ignore-missing-imports.
Change-Id: I8129144d7c963616e5b836dd2f082c41f1dc1416
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/22201
Reviewed-by: Alexei Frolov <frolv@google.com>
Previously, Python tests were executed using setup.py test. There are a
few issues with this. First, with the current setup, tests are executed
twice for some reason. Occasionally other odd errors occur. Also,
setuptools has deprecated the test command for setup.py and states that
it will be removed in a future version.
This change discovers tests by finding the package directories of
affected files and searching for tests with customizable patterns
('*_test.py' by default). This approach is simpler, faster, and no
longer relies on setuptools or unittest.
Since setup.py test is no longer used, this change removes test suite
discovery from Pigweed's setup.py files.
Change-Id: I3de6c5d05ea5e38eea27b0e3aca956fe468035be
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/12662
Reviewed-by: Rob Mohr <mohrr@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>