Commit Graph

10 Commits

Author SHA1 Message Date
Nicholas Junge
a6af6eeb6a
Add a Python matrix to ensure the bindings build on all supported versions (#1871)
Also contains a run of `pre-commit autoupdate`, and a bump of cibuildwheel
to its latest tag for CPython 3.13 support.

But, since we build for 3.10+ with SABI from 3.12 onwards, we don't even
need a dedicated Python 3.13 build job or toolchain - the wheels from 3.12
can be reused.

Simplifies some version-dependent logic around assembling the bazel
build command in setup.py, and fixes a possible unbound local error in
the toolchain patch context manager.
2024-11-06 13:15:22 +00:00
Nicholas Junge
986423a62d
Bump oldest supported Python to 3.10, eliminate setuptools-scm (#1842)
Some checks failed
build-and-test / ${{ matrix.os }}.${{ matrix.build_type }}.${{ matrix.lib }}.${{ matrix.msys2.msystem }} (Debug, static, map[arch:i686 compiler:clang++ family:LLVM msystem:CLANG32], windows-latest) (push) Has been cancelled
build-and-test / ${{ matrix.os }}.${{ matrix.build_type }}.${{ matrix.lib }}.${{ matrix.msys2.msystem }} (Debug, static, map[arch:i686 compiler:g++ family:GNU msystem:MINGW32], windows-latest) (push) Has been cancelled
build-and-test / ${{ matrix.os }}.${{ matrix.build_type }}.${{ matrix.lib }}.${{ matrix.msys2.msystem }} (Debug, static, map[arch:x86_64 compiler:clang++ family:LLVM msystem:CLANG64], windows-latest) (push) Has been cancelled
build-and-test / ${{ matrix.os }}.${{ matrix.build_type }}.${{ matrix.lib }}.${{ matrix.msys2.msystem }} (Debug, static, map[arch:x86_64 compiler:g++ family:GNU msystem:MINGW64], windows-latest) (push) Has been cancelled
build-and-test / ${{ matrix.os }}.${{ matrix.build_type }}.${{ matrix.lib }}.${{ matrix.msys2.msystem }} (Debug, static, map[arch:x86_64 compiler:g++ family:GNU msystem:UCRT64], windows-latest) (push) Has been cancelled
build-and-test / ${{ matrix.os }}.${{ matrix.build_type }}.${{ matrix.lib }}.${{ matrix.msys2.msystem }} (Release, shared, map[arch:i686 compiler:clang++ family:LLVM msystem:CLANG32], windows-latest) (push) Has been cancelled
build-and-test / ${{ matrix.os }}.${{ matrix.build_type }}.${{ matrix.lib }}.${{ matrix.msys2.msystem }} (Release, shared, map[arch:i686 compiler:g++ family:GNU msystem:MINGW32], windows-latest) (push) Has been cancelled
build-and-test / ${{ matrix.os }}.${{ matrix.build_type }}.${{ matrix.lib }}.${{ matrix.msys2.msystem }} (Release, shared, map[arch:x86_64 compiler:clang++ family:LLVM msystem:CLANG64], windows-latest) (push) Has been cancelled
build-and-test / ${{ matrix.os }}.${{ matrix.build_type }}.${{ matrix.lib }}.${{ matrix.msys2.msystem }} (Release, shared, map[arch:x86_64 compiler:g++ family:GNU msystem:MINGW64], windows-latest) (push) Has been cancelled
build-and-test / ${{ matrix.os }}.${{ matrix.build_type }}.${{ matrix.lib }}.${{ matrix.msys2.msystem }} (Release, shared, map[arch:x86_64 compiler:g++ family:GNU msystem:UCRT64], windows-latest) (push) Has been cancelled
build-and-test / ${{ matrix.os }}.${{ matrix.build_type }}.${{ matrix.lib }}.${{ matrix.msys2.msystem }} (Release, static, map[arch:i686 compiler:clang++ family:LLVM msystem:CLANG32], windows-latest) (push) Has been cancelled
build-and-test / ${{ matrix.os }}.${{ matrix.build_type }}.${{ matrix.lib }}.${{ matrix.msys2.msystem }} (Release, static, map[arch:i686 compiler:g++ family:GNU msystem:MINGW32], windows-latest) (push) Has been cancelled
build-and-test / ${{ matrix.os }}.${{ matrix.build_type }}.${{ matrix.lib }}.${{ matrix.msys2.msystem }} (Release, static, map[arch:x86_64 compiler:clang++ family:LLVM msystem:CLANG64], windows-latest) (push) Has been cancelled
build-and-test / ${{ matrix.os }}.${{ matrix.build_type }}.${{ matrix.lib }}.${{ matrix.msys2.msystem }} (Release, static, map[arch:x86_64 compiler:g++ family:GNU msystem:MINGW64], windows-latest) (push) Has been cancelled
build-and-test / ${{ matrix.os }}.${{ matrix.build_type }}.${{ matrix.lib }}.${{ matrix.msys2.msystem }} (Release, static, map[arch:x86_64 compiler:g++ family:GNU msystem:UCRT64], windows-latest) (push) Has been cancelled
clang-format-lint / check-clang-format (push) Has been cancelled
clang-tidy / run-clang-tidy (push) Has been cancelled
doxygen / Build HTML documentation (push) Has been cancelled
python + Bazel pre-commit checks / pre-commit (push) Has been cancelled
sanitizer / ${{ matrix.sanitizer }}.${{ matrix.build_type }} (Debug, asan) (push) Has been cancelled
sanitizer / ${{ matrix.sanitizer }}.${{ matrix.build_type }} (Debug, msan) (push) Has been cancelled
sanitizer / ${{ matrix.sanitizer }}.${{ matrix.build_type }} (Debug, tsan) (push) Has been cancelled
sanitizer / ${{ matrix.sanitizer }}.${{ matrix.build_type }} (Debug, ubsan) (push) Has been cancelled
sanitizer / ${{ matrix.sanitizer }}.${{ matrix.build_type }} (RelWithDebInfo, asan) (push) Has been cancelled
sanitizer / ${{ matrix.sanitizer }}.${{ matrix.build_type }} (RelWithDebInfo, msan) (push) Has been cancelled
sanitizer / ${{ matrix.sanitizer }}.${{ matrix.build_type }} (RelWithDebInfo, tsan) (push) Has been cancelled
sanitizer / ${{ matrix.sanitizer }}.${{ matrix.build_type }} (RelWithDebInfo, ubsan) (push) Has been cancelled
test-bindings / Test GBM Python bindings on ${{ matrix.os }} (macos-latest) (push) Has been cancelled
test-bindings / Test GBM Python bindings on ${{ matrix.os }} (ubuntu-latest) (push) Has been cancelled
test-bindings / Test GBM Python bindings on ${{ matrix.os }} (windows-latest) (push) Has been cancelled
* Supply MacOS deployment target to delocate, use build+uv frontend

This shaves off multiple minutes from the wheel builds alone.

Also revert to trusted publishing for wheel uploads as it is now set up.

* Bump oldest supported Python to 3.10, eliminate setuptools-scm

The version is now a string again, under the same attribute as it was
before. This is a pragmatic decision in order to be able to upload wheels
again, possibly directly from main.

We could in the future also set the Python version to a development version
if we want to avoid accidental uploads of `main`.

* Add a note on supported Python versions in the docs

Also fixes the setuptools failure observed in the latest CI by pinning
to the last version before v73 until the problem is identified and resolved.
2024-09-04 17:42:07 +01:00
mosfet80
cfb7e0a330
Update libs into .pre-commit-config.yaml (#1825) 2024-07-30 14:09:31 +01:00
Nicholas Junge
144d23cf5f
hotfix: Correct pypi-publishing action tag to v1.8.14 (#1791)
Also bump pre-commit dependencies via `pre-commit autoupdate`.
2024-05-24 09:51:41 +01:00
Nicholas Junge
eaafe694d2
Add Python bindings build using bzlmod (#1764)
* Add a bzlmod Python bindings build

Uses the newly started `@nanobind_bazel` project to build nanobind
extensions. This means that we can drop all in-tree custom build defs
and build files for nanobind and the C++ Python headers.

Additionally, the temporary WORKSPACE overwrite hack naturally goes away
due to the WORKSPACE system being obsolete.

* Bump ruff -> v0.3.1, change ruff settings

The latest minor releases incurred some formatting and configuration
changes, this commit rolls them out.

---------

Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
2024-03-07 12:28:55 +00:00
Nicholas Junge
4682db08bc
Bump pre-commit dependencies (#1740)
Also fix a mypy error in `tools.gbench.util` - the condition behaves the
same as before, but in the new mypy version, the old condition results
in an unreachable code error for the final `return False` statement.

This is most likely a bug in mypy's reachability analysis, but the fix
is easy enough here to circumvent it.
2024-01-18 13:35:57 +00:00
Nicholas Junge
c2de526130
Run pre-commit autoupdate, fix stale pyproject.toml comments (#1712)
* Run `pre-commit autoupdate`, fix stale pyproject.toml comments

* Set `--enable_bzlmod=false` for the moment

Until the newer nanobind tags are pushed to the BCR, it's best to disable
bzlmod for the bindings, because the Python CI breaks due to Bazel 7
enabling bzlmod by default.

* Remove E203 ignore, add linebreaks to semantically group ruff options
2023-12-13 14:26:15 +00:00
Nicholas Junge
159eb2d0ff
Switch out black for ruff format (#1698)
Saves one pre-commit hook, some pyproject.toml configuration,
and provides much better performance with almost identical behavior.

Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
2023-11-10 10:40:31 +00:00
Nicholas Junge
bce46fb413
Drop isort hook for ruff builtin import sorting (#1689)
This behaves the same, and saves a pre-commit step. ruff just needs an
additional package location hint to correctly map first-part packages
(in this case, `google_benchmark`).

This revealed a misformat in the `google_benchmark.__init__`, which is
now fixed.
2023-10-31 10:05:37 +00:00
Nicholas Junge
b93f5a5929
Add pre-commit config and GitHub Actions job (#1688)
* Add pre-commit config and GitHub Actions job

Contains the following hooks:
* buildifier - for formatting and linting Bazel files.
* mypy, ruff, isort, black - for Python typechecking, import hygiene,
static analysis, and formatting.

The pylint CI job was changed to be a pre-commit CI job, where pre-commit
is bootstrapped via Python.

Pylint is currently no longer part of the
code checks, but can be re-added if requested. The reason to drop was
that it does not play nicely with pre-commit, and lots of its
functionality and responsibilities are actually covered in ruff.

* Add dev extra to pyproject.toml for development installs

* Clarify that pre-commit contains only Python and Bazel hooks

* Add one-line docstrings to Bazel modules

* Apply buildifier pre-commit fixes to Bazel files

* Apply pre-commit fixes to Python files

* Supply --profile=black to isort to prevent conflicts

* Fix nanobind build file formatting

* Add tooling configs to `pyproject.toml`

In particular, set line length 80 for all Python files.

* Reformat all Python files to line length 80, fix return type annotations

Also ignores the `tools/compare.py` and `tools/gbench/report.py` files
for mypy, since they emit a barrage of errors which we can deal with
later. The errors are mostly related to dynamic classmethod definition.
2023-10-30 15:35:37 +00:00