Skip to content
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
56481b1
Adding github action to comparatively benchmark PR
blue-jaye-121 Jul 4, 2025
92d2b74
Merge branch 'Unidata:main' into benchmark_pr_action
blue-jaye-121 Jul 4, 2025
0afdc72
Adding benchmarks directory and updating Jenkinfile to point to new r…
blue-jaye-121 Jul 7, 2025
2e16155
Merge branch 'Unidata:main' into benchmarking
blue-jaye-121 Jul 7, 2025
7cdda50
Fixing linting errors
blue-jaye-121 Jul 7, 2025
7eb487e
Merging with branch
blue-jaye-121 Jul 7, 2025
8400cce
Fixing linting errors
blue-jaye-121 Jul 7, 2025
62f1f26
Updating docs to include a benchmarking page under developer's guide
blue-jaye-121 Jul 7, 2025
f215ac9
Fixing linting
blue-jaye-121 Jul 7, 2025
c2007a3
Updating doc8 formatting
blue-jaye-121 Jul 7, 2025
441613b
Removing benchmarking workflow from PR
blue-jaye-121 Jul 9, 2025
d121e81
Making data array generate rather than having a too-large file
blue-jaye-121 Jul 9, 2025
cec68e0
Merge branch 'Unidata:main' into benchmarking
blue-jaye-121 Jul 9, 2025
f6488cd
updating documentation for locally running
blue-jaye-121 Jul 9, 2025
afa8663
Merging with remote
blue-jaye-121 Jul 9, 2025
d81461d
Update Jenkinsfile - change token for the Metpy-benchmark
blue-jaye-121 Jul 10, 2025
252a818
Removing trailing whitespace
blue-jaye-121 Jul 10, 2025
e637e5c
Merging with github changes
blue-jaye-121 Jul 10, 2025
1f7222a
Adding benchmarked by ASV badge
blue-jaye-121 Jul 11, 2025
31952be
Merge branch 'Unidata:main' into benchmarking
blue-jaye-121 Jul 15, 2025
b7d0fa6
Removing commit hashes file, since it's generated in the pipeline
blue-jaye-121 Jul 15, 2025
3b22d03
updating documentation with instructions for asv compare
blue-jaye-121 Jul 16, 2025
6ea360a
Fixing linting error
blue-jaye-121 Jul 16, 2025
6a0dfa7
Merge branch 'main' into benchmarking
blue-jaye-121 Jul 21, 2025
7a027be
Updating lcl benchmark to use 3d dataset
blue-jaye-121 Jul 21, 2025
1645005
Updated docs to include instructions for running in a Docker container
blue-jaye-121 Jul 22, 2025
9c6a4e8
Fixing whitespace errors
blue-jaye-121 Jul 22, 2025
94d7d96
Update benchmarks/Dockerfile - streamline dependencies
blue-jaye-121 Jul 23, 2025
e0c83e0
Merge branch 'Unidata:main' into benchmarking
blue-jaye-121 Jul 23, 2025
83046e1
Update README.md - no more code climate badge
blue-jaye-121 Jul 23, 2025
82d175d
Fixing link for results page in docs
blue-jaye-121 Jul 23, 2025
62d42ac
Removing unnecessary .json file
blue-jaye-121 Jul 28, 2025
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ MetPy
[![Conda Tests](https://github.com/Unidata/MetPy/workflows/Conda%20Tests/badge.svg)](https://github.com/Unidata/MetPy/actions?query=workflow%3A%22Conda+Tests%22)
[![Code Coverage Status](https://codecov.io/github/Unidata/MetPy/coverage.svg?branch=main)](https://codecov.io/github/Unidata/MetPy?branch=main)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/2e64843f595c42e991457cb76fcfa769)](https://www.codacy.com/gh/Unidata/MetPy/dashboard)
[![asv](https://img.shields.io/badge/benchmarked%20by-asv-blue.svg?style=flat)](https://unidata.github.io/MetPy-benchmark)
[![Maintainability](https://qlty.sh/gh/Unidata/projects/MetPy/maintainability.svg)](https://qlty.sh/gh/Unidata/projects/MetPy)

MetPy is a collection of tools in Python for reading, visualizing and
Expand Down
7 changes: 7 additions & 0 deletions benchmarks/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM python:3.12

RUN pip install --no-cache-dir netcdf4 asv pysu metpy

Check warning on line 3 in benchmarks/Dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

benchmarks/Dockerfile#L3

Pin versions in pip. Instead of `pip install <package>` use `pip install <package>==<version>` or `pip install --requirement <requirements file>`

COPY --chmod=700 entrypoint.sh /

ENTRYPOINT ["/entrypoint.sh"]
86 changes: 86 additions & 0 deletions benchmarks/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
pipeline {
agent { label 'main' }
environment {
CLONE_DIR = "temp_repo_results"
}
stages {
// checks out the results repo using secret stored in Jenkins
stage('Checkout results repo') {
steps {
sh 'git config --global credential.helper cache'
sh 'git config --global push.default simple'
checkout scmGit(branches: [[name: '*/main']], extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'temp_repo_results'], cloneOption(depth: 1, noTags: false, reference: '', shallow: true)], userRemoteConfigs: [[credentialsId: 'GH_DEPLOY_KEY_METPY_BENCH_RESULTS', url: 'https://github.com/unidata/metpy-benchmark.git']])
}
}
// copies past results into the asv/results folder on the main repo
stage('Copy past results') {
steps {
sh '''
if [ -d ${CLONE_DIR}/results ]; then
echo "-------Copying results--------"
cp -r ${CLONE_DIR}/results/* benchmarks/asv/results
fi
'''
}
}
// generates the hashes to run and stores them in a text file
stage('Setup for ASV run') {
steps {
sh '''
cd benchmarks
bash generate_hashes.sh
cd ..
'''
}
}
// Runs ASV in the docker container
// The catch error ensures that the build works even if some ASV fail
stage('Run ASV') {
steps {
catchError(buildResult: 'SUCCESS') {
sh '''
cd benchmarks
docker build -t metpy-benchmarks:latest .
cd ..
docker run --rm -v .:/container-benchmarks --hostname Docker_Container -e DUID=$(id -u) -e DGID=$(id -g) metpy-benchmarks:latest benchmark
'''
}
}
}
// Copies results from the asv/results into the results repo
stage('Copy results') {
steps{
sh '''
if [ -d "${CLONE_DIR}/results" ]; then
echo "--------results repo exist-------"
else
mkdir ${CLONE_DIR}/results
fi
cp -r benchmarks/asv/results/* ${CLONE_DIR}/results
'''
}
}
// Pushes to the git repo if there have been changes
stage('Update results repo') {
steps {
withCredentials([gitUsernamePassword(credentialsId: 'ASV_RESULTS_REPO_PAT', gitToolName: 'Default')]) {
sh '''
if [ -n "$(git status --porcelain)" ]; then
cd ${CLONE_DIR}
git add --all
git commit -m "Jenkins Updating Benchmark Results BUILD-NUMBER:${BUILD_NUMBER}" || echo "-----no changes to commit-----"
git push origin HEAD:main --force
fi
'''
}
}
}
}
post {
// always removes the temporary repo regardless of build status
always {
echo "---Cleaning up temporary repo---"
sh 'rm -rf "${CLONE_DIR}"'
}
}
}
208 changes: 208 additions & 0 deletions benchmarks/asv.conf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
{
// The version of the config file format. Do not change, unless
// you know what you are doing.
"version": 1,

// The name of the project being benchmarked
"project": "metpy",

// The project's homepage
"project_url": "https://unidata.github.io/MetPy/latest/",

// The URL or local path of the source code repository for the
// project being benchmarked
"repo": "..",

// The Python project's subdirectory in your repo. If missing or
// the empty string, the project is assumed to be located at the root
// of the repository.
//"repo_subdir": "benchmarks",

// Customizable commands for building the project.
// See asv.conf.json documentation.
// To build the package using pyproject.toml (PEP518), uncomment the following lines
"build_command": [
"python -m pip install build",
"python -m build",
"python -mpip wheel -w {build_cache_dir} {build_dir}"
],
// To build the package using setuptools and a setup.py file, uncomment the following lines
// "build_command": [
// "python setup.py build",
// "python -mpip wheel -w {build_cache_dir} {build_dir}"
// ],

// Customizable commands for installing and uninstalling the project.
// See asv.conf.json documentation.
"install_command": ["in-dir={env_dir} python -mpip install {build_dir}"],
"uninstall_command": ["return-code=any python -mpip uninstall -y {project}"],

// List of branches to benchmark. If not provided, defaults to "main"
// (for git) or "default" (for mercurial).
"branches": ["HEAD"], // for git
// "branches": ["default"], // for mercurial

// The DVCS being used. If not set, it will be automatically
// determined from "repo" by looking at the protocol in the URL
// (if remote), or by looking for special directories, such as
// ".git" (if local).
// "dvcs": "git",

// The tool to use to create environments. May be "conda",
// "virtualenv", "mamba" (above 3.8)
// or other value depending on the plugins in use.
// If missing or the empty string, the tool will be automatically
// determined by looking for tools on the PATH environment
// variable.
"environment_type": "virtualenv",

// timeout in seconds for installing any dependencies in environment
// defaults to 10 min
//"install_timeout": 600,

// the base URL to show a commit for the project.
"show_commit_url": "http://github.com/unidata/metpy/commit/",

// The Pythons you'd like to test against. If not provided, defaults
// to the current version of Python used to run `asv`.
//"pythons": ["3.8", "3.12"],

// The list of conda channel names to be searched for benchmark
// dependency packages in the specified order
"conda_channels": ["conda-forge"],

// A conda environment file that is used for environment creation.
// "conda_environment_file": "environment.yml",

// The matrix of dependencies to test. Each key of the "req"
// requirements dictionary is the name of a package (in PyPI) and
// the values are version numbers. An empty list or empty string
// indicates to just test against the default (latest)
// version. null indicates that the package is to not be
// installed. If the package to be tested is only available from
// PyPi, and the 'environment_type' is conda, then you can preface
// the package name by 'pip+', and the package will be installed
// via pip (with all the conda available packages installed first,
// followed by the pip installed packages).
//
// The ``@env`` and ``@env_nobuild`` keys contain the matrix of
// environment variables to pass to build and benchmark commands.
// An environment will be created for every combination of the
// cartesian product of the "@env" variables in this matrix.
// Variables in "@env_nobuild" will be passed to every environment
// during the benchmark phase, but will not trigger creation of
// new environments. A value of ``null`` means that the variable
// will not be set for the current combination.
//
"matrix": {
"req": {
"matplotlib": [
],
"numpy": [
],
"pandas": [
],
"pint": [
],
"pooch": [
],
"pyproj": [
],
"scipy": [
],
"traitlets": [
],
"xarray": [
],
"netcdf4": [
],
}

Check failure on line 119 in benchmarks/asv.conf.json

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

benchmarks/asv.conf.json#L119

Unexpected character ('}' (code 125)): was expecting double-quote to start field name
},
// Combinations of libraries/python versions can be excluded/included
// from the set to test. Each entry is a dictionary containing additional
// key-value pairs to include/exclude.
//
// An exclude entry excludes entries where all values match. The
// values are regexps that should match the whole string.
//
// An include entry adds an environment. Only the packages listed
// are installed. The 'python' key is required. The exclude rules
// do not apply to includes.
//
// In addition to package names, the following keys are available:
//
// - python
// Python version, as in the *pythons* variable above.
// - environment_type
// Environment type, as above.
// - sys_platform
// Platform, as in sys.platform. Possible values for the common
// cases: 'linux2', 'win32', 'cygwin', 'darwin'.
// - req
// Required packages
// - env
// Environment variables
// - env_nobuild
// Non-build environment variables
//
// "exclude": [
// {"python": "3.2", "sys_platform": "win32"}, // skip py3.2 on windows
// {"environment_type": "conda", "req": {"six": null}}, // don't run without six on conda
// {"env": {"ENV_VAR_1": "val2"}}, // skip val2 for ENV_VAR_1
// ],
//
// "include": [
// // additional env for python3.12
// {"python": "3.12", "req": {"numpy": "1.26"}, "env_nobuild": {"FOO": "123"}},
// // additional env if run on windows+conda
// {"platform": "win32", "environment_type": "conda", "python": "3.12", "req": {"libpython": ""}},
// ],

// The directory (relative to the current directory) that benchmarks are
// stored in. If not provided, defaults to "benchmarks"
// "benchmark_dir": "benchmarks",

// The directory (relative to the current directory) to cache the Python
// environments in. If not provided, defaults to "env"
"env_dir": "asv/env",

// The directory (relative to the current directory) that raw benchmark
// results are stored in. If not provided, defaults to "results".
"results_dir": "asv/results",

// The directory (relative to the current directory) that the html tree
// should be written to. If not provided, defaults to "html".
"html_dir": "asv/html",

// The number of characters to retain in the commit hashes.
// "hash_length": 8,

// `asv` will cache results of the recent builds in each
// environment, making them faster to install next time. This is
// the number of builds to keep, per environment.
"build_cache_size": 52

// The commits after which the regression search in `asv publish`
// should start looking for regressions. Dictionary whose keys are
// regexps matching to benchmark names, and values corresponding to
// the commit (exclusive) after which to start looking for
// regressions. The default is to start from the first commit
// with results. If the commit is `null`, regression detection is
// skipped for the matching benchmark.
//
// "regressions_first_commits": {
// "some_benchmark": "352cdf", // Consider regressions only after this commit
// "another_benchmark": null, // Skip regression detection altogether
// },

// The thresholds for relative change in results, after which `asv
// publish` starts reporting regressions. Dictionary of the same
// form as in ``regressions_first_commits``, with values
// indicating the thresholds. If multiple entries match, the
// maximum is taken. If no entry matches, the default is 5%.
//
// "regressions_thresholds": {
// "some_benchmark": 0.01, // Threshold of 1%
// "another_benchmark": 0.5, // Threshold of 50%
// },
}
Loading
Loading