Skip to content

Commit

Permalink
ENH: Add pyproject with hatchling
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoZeke committed Feb 12, 2024
1 parent a96a817 commit 08c73aa
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 20 deletions.
6 changes: 4 additions & 2 deletions asv.conf.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
"matrix": {
"req": {
"numpy": ["", null],
},
"pip+asv-bench-memray": [">=0.1.2"],
"asv": [">=0.6.2"]
}
},
"env_dir": ".asv/env",
"results_dir": ".asv/results",
"html_dir": ".asv/html",
"html_dir": ".asv/html"
}
30 changes: 12 additions & 18 deletions benchmarks/benchmarks.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
from asv_samples.benchme import add_arr


class TimeSuite:
"""
Benchmark that times various operations, including custom summation of
lists.
"""

def setup(self):
self.list1 = [i for i in range(500)]
self.list2 = [i for i in range(500, 1000)]

def time_add_arr(self):
"""
Time the add_arr function with two lists of numbers.
"""
add_arr(self.list1, self.list2)
from asv_runner.benchmarks.mark import SkipNotImplemented

class MemrayBenchmarks:
params = [10, int(2e4)]

def ray_sum(self, n):
try:
import numpy as np
except ImportError:
raise SkipNotImplemented("Can't run without NumPy")
self.data = np.random.rand(n)
np.sum(self.data)
22 changes: 22 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[build-system]
build-backend = "hatchling.build"
requires = [ "hatch-vcs", "hatchling" ]

[tool.hatch.build.hooks.vcs]
version-file = "_version.py"

[tool.hatch.build]
include = [ "asv_samples/**/*.py", "asv_samples/*.py" ]

[project]
name = "asv_samples"
version = "0.1.0"
description = "A set of asv samples"
authors = [
{name = "Rohit Goswami", email = "[email protected]"},
]
license = {file = "LICENSE"}
readme = "readme.md"

[project.urls]
repository = "https://github.com/HaoZeke/asv_samples"

0 comments on commit 08c73aa

Please sign in to comment.