Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/update from template #451

Merged
merged 19 commits into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: pre-commit

on: [pull_request]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: pre-commit/[email protected]
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
with:
pypi-token: ${{ secrets.PYPI_API_TOKEN }}
gh-token: ${{ secrets.GITHUB_TOKEN }}
parse-changelog: true
parse-changelog: true
60 changes: 60 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# To use:
#
# pre-commit run -a
#
# Or:
#
# pre-commit install # (runs every time you commit in git)
#
# To update this file:
#
# pre-commit autoupdate
#
# See https://github.com/pre-commit/pre-commit

repos:
# Standard hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-case-conflict
- id: check-docstring-first
- id: check-merge-conflict
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: name-tests-test
- id: detect-private-key
- id: check-symlinks
- id: check-toml
- id: check-xml
- id: check-yaml
args: ['--unsafe'] # Fixes errors parsing custom jinja templates
# - id: check-json
# - id: pretty-format-json
# args: ['--autofix']
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
# - id: trailing-whitespace
- id: fix-byte-order-marker

# Formatter for python
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.3
hooks:
# Run the linter.
- id: ruff
types_or: [ python, pyi ]
args: [ --fix ]
# Run the formatter.
- id: ruff-format
types_or: [ python, pyi ]
# Checks for spelling mistakes
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0 #TODO latest version 2.3.0 finds a lot of spelling mistakes but fails on "assertIn"
hooks:
- id: codespell
args: ['--write-changes']
exclude: \.(svg|pyc|lock|json)$
32 changes: 16 additions & 16 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"recommendations": [
"ms-python.python",
"ms-python.vscode-pylance",
"ms-python.pylint",
"ms-python.black-formatter",
"njpwerner.autodocstring",
"charliermarsh.ruff",
"mhutchie.git-graph",
"eamodio.gitlens",
"tamasfe.even-better-toml",
"Codium.codium",
"ms-azuretools.vscode-docker",
"ryanluker.vscode-coverage-gutters",
"jjjermiah.pixi-vscode"
]
}
"recommendations": [
"ms-python.python",
"ms-python.vscode-pylance",
"ms-python.pylint",
"ms-python.black-formatter",
"njpwerner.autodocstring",
"charliermarsh.ruff",
"mhutchie.git-graph",
"eamodio.gitlens",
"tamasfe.even-better-toml",
"Codium.codium",
"ms-azuretools.vscode-docker",
"ryanluker.vscode-coverage-gutters",
"jjjermiah.pixi-vscode"
]
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
"python.analysis.autoImportCompletions": false,
"python.analysis.typeCheckingMode": "off",
"python.defaultInterpreterPath": "/workspaces/bencher/.pixi/envs/default/bin/python" //vscode gets it wrong more than right and mostly gets in the way
}
}
1 change: 1 addition & 0 deletions bencher.deps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ apt_tools:
pip_language-toolchain:
- uv #use uv instead of pip
- pip #update to the latest pip
- pre-commit
2 changes: 1 addition & 1 deletion bencher/example/benchmark_data.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""This file contains an example of how to define benchmarking parameters sweeps. Categorical values are defined as enums and passed to EnumSweep classes, other types of sweeps are defined by their respective classes.

You can define a subclass which contains an input configuration which can be passed to a function in a type safe way. You can combine the subclass with a higher level class which contains more configuation parameters. This is to help manage the complexity of large configuration/parameter spaces.
You can define a subclass which contains an input configuration which can be passed to a function in a type safe way. You can combine the subclass with a higher level class which contains more configuation parameters. This is to help manage the complexity of large configuration/parameter spaces.
"""

import math
Expand Down
1 change: 0 additions & 1 deletion bencher/example/example_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class ExampleMergeDataset(bch.ParametrizedSweep):

value = bch.FloatSweep(default=0, bounds=[0, 10])
repeats_x = bch.IntSweep(default=2, bounds=[2, 4])
# repeats_y = bch.IntSweep(default=2, bounds=[2, 4])
Expand Down
1 change: 0 additions & 1 deletion bencher/example/example_image1.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def example_image_vid_sequential1(


if __name__ == "__main__":

ex_run_cfg = bch.BenchRunCfg()
ex_run_cfg.use_sample_cache = True
ex_run_cfg.overwrite_sample_cache = True
Expand Down
2 changes: 1 addition & 1 deletion bencher/results/bench_result_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def to_dataset(

ds_out = self.ds if result_var is None else self.ds[result_var.name]

match (reduce):
match reduce:
case ReduceType.REDUCE:
ds_reduce_mean = ds_out.mean(dim="repeat", keep_attrs=True)
ds_reduce_std = ds_out.std(dim="repeat", keep_attrs=True)
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
holobench
sphinxcontrib-napoleon
sphinx-rtd-theme
sphinx-autoapi
sphinx-autoapi
Loading
Loading