evo-cli 0.1.1__py3-none-any.whl → 0.1.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
evo_cli/cli.py CHANGED
@@ -10,7 +10,8 @@ Be creative! do whatever you want!
10
10
 
11
11
  import argparse
12
12
  import sys
13
- from evo_cli.ssh_setup import setup_ssh, show_usage
13
+ from evo_cli.ssh_setup import setup_ssh, show_usage as show_ssh_usage
14
+ from evo_cli.miniconda_setup import install_miniconda, show_usage as show_miniconda_usage
14
15
 
15
16
  def main(): # pragma: no cover
16
17
  """
@@ -50,12 +51,27 @@ def main(): # pragma: no cover
50
51
  ssh_args = ssh_parser.parse_args(sys.argv[2:])
51
52
 
52
53
  if ssh_args.help_examples:
53
- show_usage()
54
+ show_ssh_usage()
54
55
  return
55
56
 
56
57
  setup_ssh(ssh_args)
58
+ elif args.command == "miniconda":
59
+ # Parse arguments for miniconda installation
60
+ miniconda_parser = argparse.ArgumentParser(description="Install Miniconda with OS-specific settings")
61
+ miniconda_parser.add_argument('-p', '--prefix', help='Installation directory')
62
+ miniconda_parser.add_argument('-f', '--force', action='store_true', help='Force reinstallation')
63
+ miniconda_parser.add_argument('--help-examples', action='store_true', help='Show usage examples')
64
+
65
+ miniconda_args = miniconda_parser.parse_args(sys.argv[2:])
66
+
67
+ if miniconda_args.help_examples:
68
+ show_miniconda_usage()
69
+ return
70
+
71
+ install_miniconda(miniconda_args)
57
72
  else:
58
73
  print(f"Unknown command: {args.command}")
59
74
  print("Available commands:")
60
- print(" setupssh - Set up SSH key-based authentication")
75
+ print(" setupssh - Set up SSH key-based authentication")
76
+ print(" miniconda - Install Miniconda (cross-platform)")
61
77
  parser.print_help()
@@ -0,0 +1,173 @@
1
+ """Miniconda installation functionality for EVO CLI."""
2
+ import os
3
+ import platform
4
+ import subprocess
5
+ import tempfile
6
+ import sys
7
+ from pathlib import Path
8
+
9
+ def show_usage():
10
+ """Show usage examples for Miniconda installation."""
11
+ print("""
12
+ Miniconda Installation Script
13
+ ============================
14
+
15
+ This command installs Miniconda on your system and configures your shell environment.
16
+
17
+ Usage:
18
+ evo miniconda [options]
19
+
20
+ Options:
21
+ -p, --prefix PATH Installation directory (default: ~/miniconda3 or %USERPROFILE%\\miniconda3)
22
+ -f, --force Force installation even if Miniconda is already installed
23
+ --help-examples Show usage examples
24
+
25
+ Examples:
26
+ evo miniconda # Install with default settings
27
+ evo miniconda -p /custom/path # Install to a custom path
28
+ evo miniconda -f # Force reinstallation
29
+ """)
30
+
31
+ def is_windows():
32
+ """Check if the current OS is Windows."""
33
+ return platform.system() == "Windows"
34
+
35
+ def is_conda_installed(prefix):
36
+ """Check if conda is already installed at the specified prefix."""
37
+ conda_executable = os.path.join(prefix, "condabin", "conda.bat" if is_windows() else "conda")
38
+ return os.path.exists(conda_executable)
39
+
40
+ def get_default_install_path():
41
+ """Get the default installation path based on the OS."""
42
+ if is_windows():
43
+ return os.path.join(os.environ.get("USERPROFILE", ""), "miniconda3")
44
+ else:
45
+ return os.path.join(os.path.expanduser("~"), "miniconda3")
46
+
47
+ def install_miniconda_windows(prefix, force=False):
48
+ """Install Miniconda on Windows."""
49
+ if is_conda_installed(prefix) and not force:
50
+ print(f"Miniconda is already installed at {prefix}")
51
+ print("Use --force to reinstall")
52
+ return True
53
+
54
+ try:
55
+ # Create temp directory for the installer
56
+ with tempfile.TemporaryDirectory() as temp_dir:
57
+ installer_path = os.path.join(temp_dir, "miniconda_installer.exe")
58
+
59
+ # Download the installer
60
+ print("Downloading Miniconda installer...")
61
+ download_cmd = [
62
+ "powershell",
63
+ "-Command",
64
+ f"Invoke-WebRequest -Uri https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe -OutFile {installer_path}"
65
+ ]
66
+ subprocess.run(download_cmd, check=True)
67
+
68
+ # Run the installer silently
69
+ print(f"Installing Miniconda to {prefix}...")
70
+ install_cmd = [
71
+ installer_path,
72
+ "/InstallationType=JustMe",
73
+ "/RegisterPython=0",
74
+ "/S",
75
+ "/D=" + prefix
76
+ ]
77
+ subprocess.run(install_cmd, check=True)
78
+
79
+ # Add to PATH using setx
80
+ bin_dir = os.path.join(prefix, "Scripts")
81
+ condabin_dir = os.path.join(prefix, "condabin")
82
+
83
+ # Get current PATH
84
+ path_cmd = ["powershell", "-Command", "Write-Output $env:PATH"]
85
+ result = subprocess.run(path_cmd, capture_output=True, text=True, check=True)
86
+ current_path = result.stdout.strip()
87
+
88
+ # Only add to PATH if not already present
89
+ if bin_dir not in current_path and condabin_dir not in current_path:
90
+ print("Adding Miniconda to PATH...")
91
+ subprocess.run(["setx", "PATH", f"{bin_dir};{condabin_dir};{current_path}"], check=True)
92
+
93
+ print("\nMiniconda has been installed successfully!")
94
+ print("\nTo use conda, restart your terminal or run:")
95
+ print(f" {os.path.join(prefix, 'condabin', 'conda.bat')} init")
96
+ return True
97
+
98
+ except Exception as e:
99
+ print(f"Error installing Miniconda: {str(e)}")
100
+ return False
101
+
102
+ def install_miniconda_unix(prefix, force=False):
103
+ """Install Miniconda on Linux/macOS."""
104
+ if is_conda_installed(prefix) and not force:
105
+ print(f"Miniconda is already installed at {prefix}")
106
+ print("Use --force to reinstall")
107
+ return True
108
+
109
+ try:
110
+ # Create temp directory for the installer
111
+ with tempfile.TemporaryDirectory() as temp_dir:
112
+ installer_path = os.path.join(temp_dir, "miniconda.sh")
113
+
114
+ # Determine the correct installer based on platform
115
+ if platform.system() == "Darwin":
116
+ if platform.machine() == "arm64":
117
+ installer_url = "https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh"
118
+ else:
119
+ installer_url = "https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh"
120
+ else: # Linux
121
+ if platform.machine() == "aarch64":
122
+ installer_url = "https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh"
123
+ else:
124
+ installer_url = "https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh"
125
+
126
+ # Download the installer
127
+ print("Downloading Miniconda installer...")
128
+ download_cmd = ["wget", installer_url, "-O", installer_path]
129
+ subprocess.run(download_cmd, check=True)
130
+
131
+ # Make the installer executable
132
+ subprocess.run(["chmod", "+x", installer_path], check=True)
133
+
134
+ # Run the installer
135
+ print(f"Installing Miniconda to {prefix}...")
136
+ install_cmd = ["bash", installer_path, "-b", "-p", prefix]
137
+ subprocess.run(install_cmd, check=True)
138
+
139
+ # Add to PATH if needed
140
+ shell_rc_file = os.path.expanduser("~/.bashrc")
141
+ if platform.system() == "Darwin":
142
+ if os.path.exists(os.path.expanduser("~/.zshrc")):
143
+ shell_rc_file = os.path.expanduser("~/.zshrc")
144
+
145
+ # Check if already in PATH
146
+ with open(shell_rc_file, "r") as f:
147
+ content = f.read()
148
+ if prefix not in content:
149
+ print(f"Adding Miniconda to PATH in {shell_rc_file}...")
150
+ with open(shell_rc_file, "a") as f:
151
+ f.write(f'\n# >>> conda initialize >>>\n')
152
+ f.write(f'export PATH="{prefix}/bin:$PATH"\n')
153
+ f.write(f'# <<< conda initialize <<<\n')
154
+
155
+ print("\nMiniconda has been installed successfully!")
156
+ print("\nTo use conda, restart your terminal or run:")
157
+ print(f" source {shell_rc_file}")
158
+ return True
159
+
160
+ except Exception as e:
161
+ print(f"Error installing Miniconda: {str(e)}")
162
+ return False
163
+
164
+ def install_miniconda(args):
165
+ """Main function to install Miniconda based on the current OS."""
166
+ # Get installation prefix
167
+ prefix = args.prefix or get_default_install_path()
168
+
169
+ # Install based on OS
170
+ if is_windows():
171
+ return install_miniconda_windows(prefix, args.force)
172
+ else:
173
+ return install_miniconda_unix(prefix, args.force)
@@ -0,0 +1,65 @@
1
+ Metadata-Version: 2.1
2
+ Name: evo-cli
3
+ Version: 0.1.2
4
+ Summary: Awesome evo_cli created by maycuatroi
5
+ Home-page: https://github.com/maycuatroi/evo-cli/
6
+ Author: maycuatroi
7
+ License: UNKNOWN
8
+ Platform: UNKNOWN
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: paramiko>=2.7.0
12
+ Provides-Extra: test
13
+ Requires-Dist: pytest; extra == "test"
14
+ Requires-Dist: coverage; extra == "test"
15
+ Requires-Dist: flake8; extra == "test"
16
+ Requires-Dist: black; extra == "test"
17
+ Requires-Dist: isort; extra == "test"
18
+ Requires-Dist: pytest-cov; extra == "test"
19
+ Requires-Dist: mypy; extra == "test"
20
+ Requires-Dist: gitchangelog; extra == "test"
21
+ Requires-Dist: mkdocs; extra == "test"
22
+
23
+ # Evolution CLI (Develop by Dev And for Dev)
24
+
25
+ [![codecov](https://codecov.io/gh/maycuatroi/evo-cli/branch/main/graph/badge.svg?token=evo-cli_token_here)](https://codecov.io/gh/maycuatroi/evo-cli)
26
+ [![CI](https://github.com/maycuatroi/evo-cli/actions/workflows/main.yml/badge.svg)](https://github.com/maycuatroi/evo-cli/actions/workflows/main.yml)
27
+
28
+ Awesome evo_cli created by maycuatroi
29
+
30
+ ## Install it from PyPI
31
+
32
+ ```bash
33
+ pip install evo_cli
34
+ ```
35
+
36
+ ### Available Commands
37
+
38
+ #### SSH Setup
39
+
40
+ Set up SSH with key-based authentication:
41
+
42
+ ```bash
43
+ evo setupssh
44
+ ```
45
+
46
+ Options:
47
+ - `-H, --host` - SSH server hostname or IP address
48
+ - `-u, --user` - SSH username
49
+ - `-p, --password` - SSH password (not recommended, use interactive mode instead)
50
+ - `-i, --identity` - Path to existing identity file to use
51
+ - `--help-examples` - Show usage examples
52
+
53
+ #### Miniconda Installation
54
+
55
+ Install Miniconda with cross-platform support:
56
+
57
+ ```bash
58
+ evo miniconda
59
+ ```
60
+
61
+ Options:
62
+ - `-p, --prefix` - Installation directory (default: ~/miniconda3 or %USERPROFILE%\miniconda3)
63
+ - `-f, --force` - Force reinstallation even if Miniconda is already installed
64
+ - `--help-examples` - Show usage examples
65
+
@@ -0,0 +1,12 @@
1
+ evo_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ evo_cli/__main__.py,sha256=7gjzkdgmHtmiJQKpltZpZ-t26bsBlgXlTzkCIjR0fnk,140
3
+ evo_cli/base.py,sha256=kHzHVhx4SyKp7GETrpa_QpuYnhX2zGxtkaa0xkwBXNo,323
4
+ evo_cli/cli.py,sha256=0TneNa6JypuCDiDuGg7zeCmfeXBbN0euGOz1jG1egTM,3071
5
+ evo_cli/miniconda_setup.py,sha256=HmhHJqomZHzpwBgciyxu3wM5C-gHTNbA6T8dUmI48GY,7074
6
+ evo_cli/ssh_setup.py,sha256=ii2ii0us0em9aqlVPZmJAC3jPfNEPQFYHwUYUv3_Y0w,7904
7
+ evo_cli-0.1.2.dist-info/LICENSE,sha256=awOCsWJ58m_2kBQwBUGWejVqZm6wuRtCL2hi9rfa0X4,1211
8
+ evo_cli-0.1.2.dist-info/METADATA,sha256=55xN-R6xR1Uj-iCNVK-gF0nyPR2ieIzMMJJCdAVCXiU,1831
9
+ evo_cli-0.1.2.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
10
+ evo_cli-0.1.2.dist-info/entry_points.txt,sha256=KAho_YevnWKWXCxu0LKp7nIFQtMbqWoxQ8_tvDauojs,51
11
+ evo_cli-0.1.2.dist-info/top_level.txt,sha256=oZVCrBYcBYaYGLMqkmnBxt_ZPVDb_shL54Q6dgX5fPk,8
12
+ evo_cli-0.1.2.dist-info/RECORD,,
@@ -1,84 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: evo-cli
3
- Version: 0.1.1
4
- Summary: Awesome evo_cli created by maycuatroi
5
- Home-page: https://github.com/maycuatroi/evo-cli/
6
- Author: maycuatroi
7
- License: UNKNOWN
8
- Platform: UNKNOWN
9
- Description-Content-Type: text/markdown
10
- License-File: LICENSE
11
- Requires-Dist: paramiko>=2.7.0
12
- Provides-Extra: test
13
- Requires-Dist: pytest; extra == "test"
14
- Requires-Dist: coverage; extra == "test"
15
- Requires-Dist: flake8; extra == "test"
16
- Requires-Dist: black; extra == "test"
17
- Requires-Dist: isort; extra == "test"
18
- Requires-Dist: pytest-cov; extra == "test"
19
- Requires-Dist: mypy; extra == "test"
20
- Requires-Dist: gitchangelog; extra == "test"
21
- Requires-Dist: mkdocs; extra == "test"
22
-
23
- # Evolution CLI (Develop by Dev And for Dev)
24
-
25
- [![codecov](https://codecov.io/gh/maycuatroi/evo-cli/branch/main/graph/badge.svg?token=evo-cli_token_here)](https://codecov.io/gh/maycuatroi/evo-cli)
26
- [![CI](https://github.com/maycuatroi/evo-cli/actions/workflows/main.yml/badge.svg)](https://github.com/maycuatroi/evo-cli/actions/workflows/main.yml)
27
-
28
- Awesome evo_cli created by maycuatroi
29
-
30
- ## Install it from PyPI
31
-
32
- ```bash
33
- pip install evo_cli
34
- ```
35
-
36
- ## Usage
37
-
38
- ```py
39
- from evo_cli import BaseClass
40
- from evo_cli import base_function
41
-
42
- BaseClass().base_method()
43
- base_function()
44
- ```
45
-
46
- ```bash
47
- $ python -m evo_cli
48
- #or
49
- $ evo_cli
50
- ```
51
-
52
- ## Development
53
-
54
- Read the [CONTRIBUTING.md](CONTRIBUTING.md) file.
55
-
56
- ## Automatic Release to PyPI
57
-
58
- This project is configured to automatically release to PyPI when changes are pushed to the main branch. The process:
59
-
60
- 1. Automatically bumps the version based on commit messages:
61
- - Commits with "BREAKING CHANGE" trigger a major version bump
62
- - Commits with "feat" trigger a minor version bump
63
- - All other commits trigger a patch version bump
64
-
65
- 2. Builds and publishes the package to PyPI
66
-
67
- 3. Creates a GitHub release with auto-generated release notes
68
-
69
- ### Setup Requirements
70
-
71
- To enable automatic PyPI releases, you need to:
72
-
73
- 1. Create a PyPI API token:
74
- - Go to https://pypi.org/manage/account/token/
75
- - Create a new token with scope "Entire account"
76
- - Copy the token value
77
-
78
- 2. Add the token to your GitHub repository secrets:
79
- - Go to your GitHub repository → Settings → Secrets and variables → Actions
80
- - Create a new repository secret named `PYPI_API_TOKEN`
81
- - Paste your PyPI token as the value
82
-
83
- After these steps, the automated release process will work whenever changes are pushed to the main branch.
84
-
@@ -1,11 +0,0 @@
1
- evo_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- evo_cli/__main__.py,sha256=7gjzkdgmHtmiJQKpltZpZ-t26bsBlgXlTzkCIjR0fnk,140
3
- evo_cli/base.py,sha256=kHzHVhx4SyKp7GETrpa_QpuYnhX2zGxtkaa0xkwBXNo,323
4
- evo_cli/cli.py,sha256=vFQDqDwTK7niNZ-z0PjmEnW7nmdDaB98bqDqeJSHvVg,2158
5
- evo_cli/ssh_setup.py,sha256=ii2ii0us0em9aqlVPZmJAC3jPfNEPQFYHwUYUv3_Y0w,7904
6
- evo_cli-0.1.1.dist-info/LICENSE,sha256=awOCsWJ58m_2kBQwBUGWejVqZm6wuRtCL2hi9rfa0X4,1211
7
- evo_cli-0.1.1.dist-info/METADATA,sha256=C3trszSelGZujb8g0O5a2y0nDOUefj6iY9W5wOrSuTQ,2426
8
- evo_cli-0.1.1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
9
- evo_cli-0.1.1.dist-info/entry_points.txt,sha256=KAho_YevnWKWXCxu0LKp7nIFQtMbqWoxQ8_tvDauojs,51
10
- evo_cli-0.1.1.dist-info/top_level.txt,sha256=oZVCrBYcBYaYGLMqkmnBxt_ZPVDb_shL54Q6dgX5fPk,8
11
- evo_cli-0.1.1.dist-info/RECORD,,