Skip to content

Commit db07c91

Browse files
committed
ENH: Add pyproject with hatchling
1 parent 7886e44 commit db07c91

File tree

3 files changed

+38
-20
lines changed

3 files changed

+38
-20
lines changed

asv.conf.base.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
"matrix": {
99
"req": {
1010
"numpy": ["", null],
11-
},
11+
"pip+asv-bench-memray": [">=0.1.2"],
12+
"asv": [">=0.6.2"]
13+
}
1214
},
1315
"env_dir": ".asv/env",
1416
"results_dir": ".asv/results",
15-
"html_dir": ".asv/html",
17+
"html_dir": ".asv/html"
1618
}

benchmarks/benchmarks.py

+12-18
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
1-
from asv_samples.benchme import add_arr
2-
3-
4-
class TimeSuite:
5-
"""
6-
Benchmark that times various operations, including custom summation of
7-
lists.
8-
"""
9-
10-
def setup(self):
11-
self.list1 = [i for i in range(500)]
12-
self.list2 = [i for i in range(500, 1000)]
13-
14-
def time_add_arr(self):
15-
"""
16-
Time the add_arr function with two lists of numbers.
17-
"""
18-
add_arr(self.list1, self.list2)
1+
from asv_runner.benchmarks.mark import SkipNotImplemented
2+
3+
class MemrayBenchmarks:
4+
params = [10, int(2e4)]
5+
6+
def ray_sum(self, n):
7+
try:
8+
import numpy as np
9+
except ImportError:
10+
raise SkipNotImplemented("Can't run without NumPy")
11+
self.data = np.random.rand(n)
12+
np.sum(self.data)

pyproject.toml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[build-system]
2+
build-backend = "hatchling.build"
3+
requires = [ "hatch-vcs", "hatchling" ]
4+
5+
[tool.hatch.build.hooks.vcs]
6+
version-file = "_version.py"
7+
8+
[tool.hatch.build]
9+
include = [ "asv_samples/**/*.py", "asv_samples/*.py" ]
10+
11+
[project]
12+
name = "asv_samples"
13+
version = "0.1.0"
14+
description = "A set of asv samples"
15+
authors = [
16+
{name = "Rohit Goswami", email = "[email protected]"},
17+
]
18+
license = {file = "LICENSE"}
19+
readme = "readme.md"
20+
21+
[project.urls]
22+
repository = "https://github.com/HaoZeke/asv_samples"

0 commit comments

Comments
 (0)