Commit Graph

5 Commits

Author SHA1 Message Date
Anthony DiGirolamo
d14a0eef62 python: setup.py -> setup.cfg
Move all Python package definitions into setup.cfg files.

A stub setup.py file remains to support `pip install --editable` it
only runs `setuptools.setup()`. The package definition is pulled from
the setup.cfg.

Each pyproject.toml file is required to specify the build system for
the given python package. In Pigweed's case so far it always specifies
Setuptools.

See this page for details:
https://setuptools.readthedocs.io/en/latest/build_meta.html?highlight=pyproject.toml#how-to-use-it

Change-Id: Ieb52ffc46b34ff1693cbfe9b95996cf9add644d1
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/54560
Pigweed-Auto-Submit: Anthony DiGirolamo <tonymd@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
2021-08-19 21:00:28 +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
Rob Mohr
f82e7a843c Add 'pw doctor'.
Add 'pw doctor' command to check environment is correctly set up
for pigweed. For now contains minimal checks.

Change-Id: Icb132c89bb272b52c57dae0451b24966b48d4e90
Bug: 28
2020-01-03 22:28:05 +00:00