Skip to content

Commit 1443fc4

Browse files
authored
Capture total times by each locator (#50)
Helps us with a breakdown ``` Breakdown by each locator: -------------------------- VirtualEnvWrapper : 697.167µs MacXCode : 538.458µs Venv : 699.5µs MacCmdLineTools : 194.643458ms VirtualEnv : 665.459µs MacPythonOrg : 32.387083ms Homebrew : 81.388042ms PyEnv : 141.412542ms Conda : 250.8985ms Poetry : 948.042µs PipEnv : 625ns Breakdown for finding Environments: ----------------------------------- Using locators : 251.063625ms PATH Variable : 214.762458ms Global virtual envs : 81.220291ms Custom search paths : 1.252041ms Managers: --------- Conda : 6 Poetry : 1 Pyenv : 1 Environments (50): ------------------ Conda : 27 Homebrew : 4 MacCommandLineTools : 1 MacPythonOrg : 1 MacXCode : 1 Pipenv : 1 Pyenv : 9 PyenvVirtualEnv : 3 Venv : 1 VirtualEnvWrapper : 2 ```
1 parent 3db7558 commit 1443fc4

File tree

18 files changed

+131
-18
lines changed

18 files changed

+131
-18
lines changed

crates/pet-conda/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ impl Conda {
146146
}
147147

148148
impl Locator for Conda {
149+
fn get_name(&self) -> &'static str {
150+
"Conda"
151+
}
149152
fn supported_categories(&self) -> Vec<PythonEnvironmentCategory> {
150153
vec![PythonEnvironmentCategory::Conda]
151154
}

crates/pet-core/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ pub struct Configuration {
3434
}
3535

3636
pub trait Locator: Send + Sync {
37+
/// Returns the name of the locator.
38+
fn get_name(&self) -> &'static str;
3739
fn configure(&self, _config: &Configuration) {
3840
//
3941
}

crates/pet-homebrew/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ fn from(env: &PythonEnv) -> Option<PythonEnvironment> {
9898
}
9999

100100
impl Locator for Homebrew {
101+
fn get_name(&self) -> &'static str {
102+
"Homebrew"
103+
}
101104
fn supported_categories(&self) -> Vec<PythonEnvironmentCategory> {
102105
vec![PythonEnvironmentCategory::Homebrew]
103106
}

crates/pet-linux-global-python/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ impl Default for LinuxGlobalPython {
2626
}
2727
}
2828
impl Locator for LinuxGlobalPython {
29+
fn get_name(&self) -> &'static str {
30+
"LinuxGlobalPython"
31+
}
2932
fn supported_categories(&self) -> Vec<PythonEnvironmentCategory> {
3033
vec![PythonEnvironmentCategory::LinuxGlobal]
3134
}

crates/pet-mac-commandlinetools/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ impl Default for MacCmdLineTools {
2828
}
2929
}
3030
impl Locator for MacCmdLineTools {
31+
fn get_name(&self) -> &'static str {
32+
"MacCmdLineTools"
33+
}
3134
fn supported_categories(&self) -> Vec<PythonEnvironmentCategory> {
3235
vec![PythonEnvironmentCategory::MacCommandLineTools]
3336
}

crates/pet-mac-python-org/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ impl Default for MacPythonOrg {
2727
}
2828
}
2929
impl Locator for MacPythonOrg {
30+
fn get_name(&self) -> &'static str {
31+
"MacPythonOrg"
32+
}
3033
fn supported_categories(&self) -> Vec<PythonEnvironmentCategory> {
3134
vec![PythonEnvironmentCategory::MacPythonOrg]
3235
}

crates/pet-mac-xcode/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ impl Default for MacXCode {
2525
}
2626
}
2727
impl Locator for MacXCode {
28+
fn get_name(&self) -> &'static str {
29+
"MacXCode"
30+
}
2831
fn supported_categories(&self) -> Vec<PythonEnvironmentCategory> {
2932
vec![PythonEnvironmentCategory::MacCommandLineTools]
3033
}

crates/pet-pipenv/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ impl PipEnv {
7171
}
7272
}
7373
impl Locator for PipEnv {
74+
fn get_name(&self) -> &'static str {
75+
"PipEnv"
76+
}
7477
fn supported_categories(&self) -> Vec<PythonEnvironmentCategory> {
7578
vec![PythonEnvironmentCategory::Pipenv]
7679
}

crates/pet-poetry/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ impl Poetry {
134134
}
135135

136136
impl Locator for Poetry {
137+
fn get_name(&self) -> &'static str {
138+
"Poetry"
139+
}
137140
fn configure(&self, config: &Configuration) {
138141
if let Some(search_paths) = &config.search_paths {
139142
if !search_paths.is_empty() {

crates/pet-pyenv/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ impl PyEnv {
4848
}
4949

5050
impl Locator for PyEnv {
51+
fn get_name(&self) -> &'static str {
52+
"PyEnv"
53+
}
5154
fn supported_categories(&self) -> Vec<PythonEnvironmentCategory> {
5255
vec![
5356
PythonEnvironmentCategory::Pyenv,

0 commit comments

Comments
 (0)