instant-python 0.7.0__py3-none-any.whl → 0.8.1__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.
@@ -1,5 +1,6 @@
1
1
  import subprocess
2
2
  from abc import ABC, abstractmethod
3
+ import sys
3
4
 
4
5
  from instant_python.configuration.dependency.dependency_configuration import DependencyConfiguration
5
6
 
@@ -7,6 +8,7 @@ from instant_python.configuration.dependency.dependency_configuration import Dep
7
8
  class DependencyManager(ABC):
8
9
  def __init__(self, project_directory: str) -> None:
9
10
  self._project_directory = project_directory
11
+ self._system_os = sys.platform
10
12
 
11
13
  @abstractmethod
12
14
  def setup_environment(self, python_version: str, dependencies: list[DependencyConfiguration]) -> None:
@@ -1,3 +1,4 @@
1
+ from pathlib import Path
1
2
  import subprocess
2
3
 
3
4
  from instant_python.configuration.dependency.dependency_configuration import DependencyConfiguration
@@ -8,7 +9,7 @@ from instant_python.dependency_manager.command_execution_error import CommandExe
8
9
  class PdmDependencyManager(DependencyManager):
9
10
  def __init__(self, project_directory: str) -> None:
10
11
  super().__init__(project_directory)
11
- self._pdm = "~/.local/bin/pdm"
12
+ self._pdm = self._set_pdm_executable_based_on_os()
12
13
 
13
14
  def setup_environment(self, python_version: str, dependencies: list[DependencyConfiguration]) -> None:
14
15
  try:
@@ -20,9 +21,21 @@ class PdmDependencyManager(DependencyManager):
20
21
 
21
22
  def _install(self) -> None:
22
23
  print(">>> Installing pdm...")
23
- self._run_command(command="curl -sSL https://pdm-project.org/install-pdm.py | python3 -")
24
+ self._run_command(command=self._get_installation_command_based_on_os())
24
25
  print(">>> pdm installed successfully")
25
26
 
27
+ def _set_pdm_executable_based_on_os(self):
28
+ return (
29
+ f"{str(Path.home() / 'AppData' / 'Roaming' / 'Python' / 'Scripts' / 'pdm.exe')}"
30
+ if self._system_os.startswith("win")
31
+ else "~/.local/bin/pdm"
32
+ )
33
+
34
+ def _get_installation_command_based_on_os(self) -> str:
35
+ if self._system_os.startswith("win"):
36
+ return 'powershell -ExecutionPolicy ByPass -c "irm https://pdm-project.org/install-pdm.py | py -"'
37
+ return "curl -sSL https://pdm-project.org/install-pdm.py | python3 -"
38
+
26
39
  def _install_python(self, version: str) -> None:
27
40
  print(f">>> Installing Python {version}...")
28
41
  self._run_command(command=f"{self._pdm} python install {version}")
@@ -34,6 +47,7 @@ class PdmDependencyManager(DependencyManager):
34
47
  for dependency in dependencies:
35
48
  command = self._build_dependency_install_command(dependency)
36
49
  self._run_command(command)
50
+ print(">>> Dependencies installed successfully")
37
51
 
38
52
  def _build_dependency_install_command(self, dependency: DependencyConfiguration) -> str:
39
53
  command = [f"{self._pdm} add"]
@@ -1,3 +1,4 @@
1
+ from pathlib import Path
1
2
  import subprocess
2
3
 
3
4
  from instant_python.configuration.dependency.dependency_configuration import DependencyConfiguration
@@ -8,7 +9,7 @@ from instant_python.dependency_manager.command_execution_error import CommandExe
8
9
  class UvDependencyManager(DependencyManager):
9
10
  def __init__(self, project_directory: str) -> None:
10
11
  super().__init__(project_directory)
11
- self._uv = "~/.local/bin/uv"
12
+ self._uv = self._set_uv_executable_based_on_os()
12
13
 
13
14
  def setup_environment(self, python_version: str, dependencies: list[DependencyConfiguration]) -> None:
14
15
  try:
@@ -20,8 +21,29 @@ class UvDependencyManager(DependencyManager):
20
21
 
21
22
  def _install(self) -> None:
22
23
  print(">>> Installing uv...")
23
- self._run_command(command="curl -LsSf https://astral.sh/uv/install.sh | sh")
24
+ self._run_command(command=self._get_installation_command_based_on_os())
24
25
  print(">>> uv installed successfully")
26
+ if self._system_os.startswith("win"):
27
+ print(
28
+ ">>> Remember to add uv to your PATH environment variable. You can do this:\n"
29
+ " 1. Running the following command if you use cmd:\n"
30
+ " set Path=%Path%;%USERPROFILE%\\.local\\bin\n"
31
+ " 2. Running the following command if you use PowerShell:\n"
32
+ " $env:Path = '$env:USERPROFILE\\.local\\bin;$env:Path'\n"
33
+ " 3. Restarting your shell."
34
+ )
35
+
36
+ def _get_installation_command_based_on_os(self) -> str:
37
+ if self._system_os.startswith("win"):
38
+ return 'powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"'
39
+ return "curl -LsSf https://astral.sh/uv/install.sh | sh"
40
+
41
+ def _set_uv_executable_based_on_os(self):
42
+ return (
43
+ f"{str(Path.home() / '.local' / 'bin' / 'uv.exe')}"
44
+ if self._system_os.startswith("win")
45
+ else "~/.local/bin/uv"
46
+ )
25
47
 
26
48
  def _install_python(self, version: str) -> None:
27
49
  print(f">>> Installing Python {version}...")
@@ -34,6 +56,7 @@ class UvDependencyManager(DependencyManager):
34
56
  for dependency in dependencies:
35
57
  command = self._build_dependency_install_command(dependency)
36
58
  self._run_command(command)
59
+ print(">>> Dependencies installed successfully")
37
60
 
38
61
  def _build_dependency_install_command(self, dependency: DependencyConfiguration) -> str:
39
62
  command = [f"{self._uv} add"]
@@ -29,7 +29,7 @@ class GitConfigurer:
29
29
 
30
30
  def _make_initial_commit(self) -> None:
31
31
  self._run_command(command="git add .")
32
- self._run_command(command="git commit -m '🎉 chore: initial commit'")
32
+ self._run_command(command='git commit -m "🎉 chore: initial commit"')
33
33
 
34
34
  def _run_command(self, command: str) -> None:
35
35
  subprocess.run(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: instant-python
3
- Version: 0.7.0
3
+ Version: 0.8.1
4
4
  Summary: Instant boilerplate generation for Python projects
5
5
  Project-URL: documentation, https://dimanu-py.github.io/instant-python/
6
6
  Project-URL: repository, https://github.com/dimanu-py/instant-python/
@@ -210,6 +210,7 @@ License-File: LICENSE
210
210
  Classifier: Environment :: Console
211
211
  Classifier: Intended Audience :: Developers
212
212
  Classifier: Operating System :: MacOS
213
+ Classifier: Operating System :: Microsoft :: Windows
213
214
  Classifier: Operating System :: POSIX :: Linux
214
215
  Classifier: Operating System :: Unix
215
216
  Classifier: Topic :: Software Development :: Code Generators
@@ -46,15 +46,15 @@ instant_python/configuration/template/invalid_template_value.py,sha256=GIvrWwn3Z
46
46
  instant_python/configuration/template/template_configuration.py,sha256=4QN2VqDbwjOeISBp63g0YuKePccD9eyysoX9k6QA4UQ,2619
47
47
  instant_python/dependency_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
48
48
  instant_python/dependency_manager/command_execution_error.py,sha256=3vhincGDyx38NkUMZlcB_eRTaaF8ziZcKeX3kqnKqy8,511
49
- instant_python/dependency_manager/dependency_manager.py,sha256=_fsU5H7hy_F5xJQisXlqx3XFumZ3kblX8xF3GsunxkA,728
49
+ instant_python/dependency_manager/dependency_manager.py,sha256=-QfHcyO9A7EeItICPQWG8RO4sZ_zbjVQp7h9u8-2ph0,778
50
50
  instant_python/dependency_manager/dependency_manager_factory.py,sha256=WRP7LwPhoeFiAABAvfYFq4UhT3ibmc_6mASrPLm8Ok4,914
51
- instant_python/dependency_manager/pdm_dependency_manager.py,sha256=O5EjtA0QeBNU81nhFYfzzrqZnyB-hdodQ6F2R3HJqyM,2064
51
+ instant_python/dependency_manager/pdm_dependency_manager.py,sha256=JxtcSoKAgYLKs3ZYExI2pXxuDF8ZE1fUVySTWIT5Crs,2697
52
52
  instant_python/dependency_manager/unknown_dependency_manager_error.py,sha256=WYV3MGRgzHwJ5HwSOIPBowfIxadg_L6VdbNOKHRbNTE,396
53
- instant_python/dependency_manager/uv_dependency_manager.py,sha256=U9glowDvi0JA4MSoeGANKYeoeE5grTHSXdWj3Rw5GVw,2039
53
+ instant_python/dependency_manager/uv_dependency_manager.py,sha256=c_g3pyz8Q3A9-6IQiVwTIe0WNdlXUXnQ4j8-s8Ya_K8,3160
54
54
  instant_python/formatter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
55
  instant_python/formatter/project_formatter.py,sha256=EeAlb7_LA6ZaBLopzx3ZA1p3q-Fgi7gEi5sxzDkVWsU,506
56
56
  instant_python/git/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
57
- instant_python/git/git_configurer.py,sha256=Z6sQpvAk_BYB_eGzJuAomPY0nu2dPPxOsDh3dUPeuuA,1422
57
+ instant_python/git/git_configurer.py,sha256=a_dl5w3P6GlBebSKmgXh4v2K2DgRnOWhc-XGjzo1x4Y,1422
58
58
  instant_python/project_creator/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
59
  instant_python/project_creator/directory.py,sha256=gz8NgzOtvN29NS8saBCIuw7haHBWyezihf9jpiySaZ4,828
60
60
  instant_python/project_creator/file.py,sha256=JjklAGETVuHls5pbfAMAjBfWLcAJ5DuWRtJtgqfHQhw,1294
@@ -183,8 +183,8 @@ instant_python/templates/project_structure/domain_driven_design/test.yml.j2,sha2
183
183
  instant_python/templates/project_structure/standard_project/main_structure.yml.j2,sha256=Gy11qNOtTDzGgIbhDPmAUkipmjwJPHa33-_WL_xlR3U,1381
184
184
  instant_python/templates/project_structure/standard_project/source.yml.j2,sha256=8QdB1AY22BzHRCidNdEJ9a6PRzq9ZWRPKIpqyoD6tmE,1748
185
185
  instant_python/templates/project_structure/standard_project/test.yml.j2,sha256=NxzsDeBKYzNaR3t8BY2VOuyhzwlp3Pa49OQNDF78gas,381
186
- instant_python-0.7.0.dist-info/METADATA,sha256=xe10FPc5bRWfdm6kwwcJhBZxTwq1Phlc2cmtt8g73ew,17574
187
- instant_python-0.7.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
188
- instant_python-0.7.0.dist-info/entry_points.txt,sha256=EdBTj3b3N9Pa4oNzPLPivE_AnMcQIFsmRC3RsSkoLLA,47
189
- instant_python-0.7.0.dist-info/licenses/LICENSE,sha256=kf7wA-1IsqXkzXjlsG95sdQJtsqUON_lNXombfPlklo,11353
190
- instant_python-0.7.0.dist-info/RECORD,,
186
+ instant_python-0.8.1.dist-info/METADATA,sha256=jT6iuf8_jJ4N0EEa0D_F97Aiidm-O7Br12A1wJSQ5NY,17627
187
+ instant_python-0.8.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
188
+ instant_python-0.8.1.dist-info/entry_points.txt,sha256=EdBTj3b3N9Pa4oNzPLPivE_AnMcQIFsmRC3RsSkoLLA,47
189
+ instant_python-0.8.1.dist-info/licenses/LICENSE,sha256=kf7wA-1IsqXkzXjlsG95sdQJtsqUON_lNXombfPlklo,11353
190
+ instant_python-0.8.1.dist-info/RECORD,,