File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ {
2+ "version" : 1 ,
3+ "project" : " microbiorust-py" ,
4+ "project_url" : " https://github.com/LCrossman/microBioRust/microbiorust-py" ,
5+
6+ // MONOREPO SETTINGS
7+ // 1. The git history is one level up
8+ "repo" : " .." ,
9+ // 2. The python project is inside this folder
10+ "repo_subdir" : " microbiorust-py" ,
11+
12+ // BUILD SETTINGS
13+ // This creates a virtualenv for every test
14+ "environment_type" : " virtualenv" ,
15+ "pythons" : [" 3.11" ],
16+ "matrix" : {
17+ "req" : {}
18+ },
19+
20+ // Install using pip + pyproject.toml + maturin
21+ "install_command" : [
22+ " pip install ."
23+ ],
24+ "uninstall_command" : [
25+ " pip uninstall -y {project}"
26+ ],
27+
28+ // CONFIGURATION
29+ "benchmark_dir" : " benchmarks" ,
30+ "results_dir" : " .asv/results" ,
31+ "html_dir" : " .asv/html" ,
32+ "show_commit_url" : " https://github.com/LCrossman/microBioRust/microbiorust-py/commit/"
33+ }
Original file line number Diff line number Diff line change 1+ import os
2+ import microbiorust
3+
4+ class PipelineSuite :
5+ """
6+ Benchmarks for microbiorust-py
7+ """
8+ # Setup runs before the timer starts
9+ def setup (self ):
10+ bench_dir = os .path .dirname (__file__ )
11+
12+ # 2. Join it with your filename
13+ self .filepath = os .path .join (bench_dir , "Rhiz3841.gbk.gb" )
14+
15+ # Check if it exists just to be safe (helps debugging)
16+ if not os .path .exists (self .filepath ):
17+ raise FileNotFoundError (f"Could not find benchmark file at: { self .filepath } " )
18+ # 1. Benchmark TIME
19+ def time_process_all (self ):
20+ # This calls your function that returns Vec<String>
21+ result = gbk_to_faa (self .filepath )
22+ for r in result :
23+ print (r )
24+
25+ # 2. Benchmark MEMORY (The known spike)
26+ def peakmem_process_all (self ):
27+ result = gbk_to_faa (self .filepath )
28+ for r in result :
29+ print (r )
Original file line number Diff line number Diff line change 1+ [build-system ]
2+ # This tells pip: "Use Maturin to build this, not setuptools"
3+ requires = [" maturin>=1.0,<2.0" ]
4+ build-backend = " maturin"
5+
6+ [project ]
7+ name = " microbiorust-py"
8+ # Valid python versions
9+ requires-python = " >=3.10"
10+ classifiers = [
11+ " Programming Language :: Rust" ,
12+ " Programming Language :: Python :: Implementation :: CPython" ,
13+ " Programming Language :: Python :: Implementation :: PyPy" ,
14+ ]
15+ # If you have runtime python dependencies (e.g. Biopython), list them here.
16+ # For benchmarking pure Rust speed, usually keep this empty.
17+ dependencies = []
18+
19+ # This tells Python to look at Cargo.toml for the version number.
20+ [tool .maturin ]
21+ bindings = " pyo3"
22+ module-name = " microbiorust_py"
23+ features = [" pyo3/extension-module" ]
You can’t perform that action at this time.
0 commit comments