Commit Graph

6 Commits

Author SHA1 Message Date
Wyatt Hepler
8ce9013bfd pw_build: Support specifying mypy/pylint config
- 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>
2020-12-04 17:59:45 +00:00
Wyatt Hepler
96992c7c4a Python: Add remaining packages to the build
- 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>
2020-10-23 20:19:46 +00:00
Wyatt Hepler
3b4047da68 Python: Add py.typed files per PEP 561
- 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>
2020-10-22 19:24:02 +00:00
Wyatt Hepler
d7dc6550c9 pw_build: pw_python_package and mypy fixes
- 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>
2020-10-22 18:28:07 +00:00
Wyatt Hepler
01197109b2 pw_presubmit: Don't use setup.py test
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>
2020-06-22 20:16:43 +00:00
Chenghan Zhou
c3c240a350 Add automatic tests for lm3s6965evb-qemu target
Change-Id: I75f2d3dbd846951dca003ec45af2c364601f0564
2020-05-08 17:17:03 +00:00