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

Add git info and Python package info providers #64

Merged
merged 2 commits into from
Feb 7, 2024

Conversation

nicholasjng
Copy link
Collaborator

They are classes with minimal state and a no-arguments __call__() operator, giving a dictionary of context values as required.

Tests both providers in a lean unit test each.

@nicholasjng nicholasjng added the enhancement New feature or request label Feb 6, 2024
They are classes with minimal state and a no-arguments `__call__()`
operator, giving a dictionary of context values as required.

Tests all providers in a lean unit test each.

The CPU info provider requires `psutil` to work. Unfortunately, it does
not have cache info available, which requires a different solution.
@nicholasjng nicholasjng force-pushed the add-helpful-context-providers branch from 55a3767 to 2033805 Compare February 7, 2024 10:06
@nicholasjng
Copy link
Collaborator Author

It might make sense to move these semantically grouped context values down a notch, and use a top-level key for it:

So that, when e.g. using GitEnvironmentInfo(), the context goes from this (currently)

r = nnbench.BenchmarkRunner()
res = r.run(..., context=(GitEnvironmentInfo(),))

res["context"]
# {"commit": "123456789abcdef", ...}

to this:

res = r.run(..., context=(GitEnvironmentInfo(),))

res["context"]
# prints {"git": {"commit": "123456789abcdef", ...}}

This is possible within the current typing, since the value type is Any.

@nicholasjng nicholasjng merged commit 0db8e92 into main Feb 7, 2024
5 checks passed
@nicholasjng nicholasjng deleted the add-helpful-context-providers branch February 7, 2024 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant