Commit Graph

23 Commits

Author SHA1 Message Date
Nicholas Junge 986423a62d
Bump oldest supported Python to 3.10, eliminate setuptools-scm (#1842)
* 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
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 3623765dd3
Add `setuptools_scm` for dynamic zero-config Python versioning (#1690)
* Add `setuptools_scm` for dynamic zero-config Python versioning

This removes the need for manually bumping versions in the Python
bindings.

For the wheel uploads, the correct semver version is inferred in the case
of tagged commits, which is exactly the case in GitHub CI.

The docs were updated to reflect the changes in the release workflow.

* Add separate version variable and module, use PEP484-compliant exports

This is the best practice mentioned in the `setuptools_scm` docs, see
https://setuptools-scm.readthedocs.io/en/latest/usage/#version-at-runtime.
2023-11-01 09:48:01 +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
Dominic Hamon 344117638c bump version to 1.8.3 2023-08-31 13:16:50 +01:00
Dominic Hamon 015d1a091a bump version to 1.8.2 ready for release 2023-07-06 09:50:35 +01:00
Dominic Hamon daa12bcc5a bump version to 1.8.1 pre release 2023-07-04 08:48:07 +01:00
Dominic Hamon 2dd015dfef update version to v1.8.0 2023-05-05 11:25:54 +01:00
SunBlack fe65457e80
Fix typos found by codespell (#1519) 2023-01-10 12:25:32 +00:00
Dominic Hamon d572f47773 version bump for release 2022-11-11 14:01:03 +00:00
Dominic Hamon af32e3fe1a
run ClearRegisteredBenchmarks at exit (#1463) 2022-08-08 21:34:20 +01:00
Dominic Hamon 361e8d1cfe version bump 2022-07-25 12:35:38 +01:00
Dominic Hamon 7a2024e961 v1.6.2 bump 2022-07-18 15:34:24 +01:00
Ross McIlroy 48c2d1c1ee
Expose google_benchmark.State for python bindings. (#1430)
Allows for type annotations.
2022-07-15 18:06:53 +01:00
Dominic Hamon 0d98dba29d Creating release commit for v1.6.1 2022-01-10 19:14:27 +00:00
Dominic Hamon 5a77a6d8dc
fix minor typo 2021-04-09 13:00:06 +01:00
feserr 378ed8ff25
Add 'seconds' time unit (#1076)
Fixes #1075.

* Add an option to report in seconds.

* Reduce the time of the test.

* Add CSV/JSON tests for new time reports.
2020-12-21 20:15:58 +03:00
Antoine Prouvost 73d4d5e8d6
Bind benchmark builder to Python (#1040)
* Fix setup.py and reformat

* Bind benchmark

* Add benchmark option to Python

* Add Python examples for range, complexity, and thread

* Remove invalid multithreading in Python

* Bump Python bindings version to 0.2.0

Co-authored-by: Dominic Hamon <dominichamon@users.noreply.github.com>
2020-09-11 10:55:18 +01:00
Antoine Prouvost 12e85b2eeb
Bind more State methods/attributes to Python (#1037)
* Bind Counter to Python

* Bind State methods to Python

* Bind state.counters to Python

* Import _benchmark.Counter

* Add Python example of state usage

Co-authored-by: Dominic Hamon <dominichamon@users.noreply.github.com>
2020-09-10 09:57:30 +01:00
Dominic Hamon beb360d03e
Create pylint.yml (#1039)
* Create pylint.yml

* improve file matching

* fix some pylint issues

* run on PR and push (force on master only)

* more pylint fixes

* suppress noisy exit code and filter to fatals

* add conan as a dep so the module is importable

* fix lint error on unreachable branch
2020-09-09 09:43:26 +01:00
Chris Jones 37177a84b7
Fix python extension import (#1000) 2020-07-09 12:54:41 +01:00
Chris Jones 39c8d58a76
Rename python bindings package to `google_benchmark`. (#999)
A few people have complained that `benchmark` is too generic. Also, add
Python 3.8.
2020-07-09 09:23:06 +01:00
Renamed from bindings/python/benchmark/__init__.py (Browse further)