shipit-cli 0.1.0__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.
@@ -0,0 +1,104 @@
1
+ from __future__ import annotations
2
+
3
+ from pathlib import Path
4
+ from typing import Dict, Optional
5
+
6
+ from .base import (
7
+ DetectResult,
8
+ DependencySpec,
9
+ Provider,
10
+ _exists,
11
+ )
12
+
13
+
14
+ class PythonProvider:
15
+ def name(self) -> str:
16
+ return "python"
17
+
18
+ def detect(self, path: Path) -> Optional[DetectResult]:
19
+ if _exists(path, "pyproject.toml", "requirements.txt"):
20
+ if _exists(path, "manage.py"):
21
+ return DetectResult(self.name(), 70)
22
+ return DetectResult(self.name(), 50)
23
+ return None
24
+
25
+ def initialize(self, path: Path) -> None:
26
+ pass
27
+
28
+ def serve_name(self, path: Path) -> str:
29
+ return path.name
30
+
31
+ def provider_kind(self, path: Path) -> str:
32
+ return "python"
33
+
34
+ def dependencies(self, path: Path) -> list[DependencySpec]:
35
+ if _exists(path, ".python-version"):
36
+ python_version = (path / ".python-version").read_text().strip()
37
+ else:
38
+ python_version = "3.13"
39
+
40
+ return [
41
+ DependencySpec(
42
+ "python",
43
+ env_var="SHIPIT_PYTHON_VERSION",
44
+ default_version=python_version,
45
+ use_in_build=True,
46
+ use_in_serve=True,
47
+ ),
48
+ DependencySpec(
49
+ "uv",
50
+ env_var="SHIPIT_UV_VERSION",
51
+ default_version="0.8.15",
52
+ use_in_build=True,
53
+ ),
54
+ ]
55
+
56
+ def declarations(self, path: Path) -> Optional[str]:
57
+ return (
58
+ "cross_platform = getenv(\"SHIPIT_PYTHON_CROSS_PLATFORM\")\n"
59
+ "python_extra_index_url = getenv(\"SHIPIT_PYTHON_EXTRA_INDEX_URL\")\n"
60
+ "python_cross_packages_serve_path = None\n"
61
+ "python_cross_packages_path = None\n"
62
+ "if cross_platform:\n"
63
+ " python_cross_packages_path = serve_mount(\"python-cross-packages\")\n"
64
+ " python_cross_packages_serve_path = f\"/.venv/lib/python{python_version}/site-packages\"\n"
65
+ "precompile_python = getenv(\"SHIPIT_PYTHON_PRECOMPILE\") in [\"true\", \"True\", \"TRUE\", \"1\", \"on\", \"yes\", \"y\", \"Y\", \"YES\", \"On\", \"ON\"]\n"
66
+ )
67
+
68
+ def build_steps(self, path: Path) -> list[str]:
69
+ return [
70
+ "run(f\"uv sync --compile --python python{python_version} --locked --no-managed-python\", inputs=[\"pyproject.toml\", \"uv.lock\"], outputs=[\".\"], group=\"install\")",
71
+ "run(f\"uv pip compile pyproject.toml --python-version={python_version} --universal --extra-index-url {python_extra_index_url} --index-url=https://pypi.org/simple --emit-index-url --only-binary :all: -o cross-requirements.txt\", inputs=[\"pyproject.toml\"], outputs=[\"cross-requirements.txt\"]) if cross_platform else None",
72
+ "run(f\"uvx pip install -r cross-requirements.txt --target {python_cross_packages_path} --platform {cross_platform} --only-binary=:all: --python-version={python_version} --compile\", outputs=[\".\"]) if cross_platform else None",
73
+ "run(\"rm cross-requirements.txt\") if cross_platform else None",
74
+ "path(\".venv/bin\")",
75
+ "copy(\".\", \".\", ignore=[\".venv\", \".git\", \"__pycache__\"])",
76
+ "run(\"rm -rf .venv\") if cross_platform else None",
77
+ ]
78
+
79
+ def prepare_steps(self, path: Path) -> Optional[list[str]]:
80
+ return [
81
+ 'run("echo \\\"Precompiling Python code...\\\"") if precompile_python and python_cross_packages_serve_path else None',
82
+ 'run(f"python -m compileall -o 2 {python_cross_packages_serve_path}") if precompile_python and python_cross_packages_serve_path else None',
83
+ 'run("echo \\\"Precompiling package code...\\\"") if precompile_python else None',
84
+ 'run("python -m compileall -o 2 .") if precompile_python else None',
85
+ ]
86
+
87
+ def commands(self, path: Path) -> Dict[str, str]:
88
+ if _exists(path, "manage.py"):
89
+ start_cmd = '"python manage.py runserver 0.0.0.0:8000"'
90
+ migrate_cmd = '"python manage.py migrate"'
91
+ return {"start": start_cmd, "after_deploy": migrate_cmd}
92
+ elif _exists(path, "main.py"):
93
+ start_cmd = '"python main.py"'
94
+ elif _exists(path, "src/main.py"):
95
+ start_cmd = '"python src/main.py"'
96
+ else:
97
+ start_cmd = '"python -c \'print(\\\"Hello, World!\\\")\'"'
98
+ return {"start": start_cmd}
99
+
100
+ def assets(self, path: Path) -> Optional[Dict[str, str]]:
101
+ return None
102
+
103
+ def mounts(self, path: Path) -> Optional[Dict[str, str]]:
104
+ return {"python_cross_packages_serve_path": "python_cross_packages_path"}
@@ -0,0 +1,26 @@
1
+ from __future__ import annotations
2
+
3
+ from .base import Provider
4
+ from .gatsby import GatsbyProvider
5
+ from .hugo import HugoProvider
6
+ from .laravel import LaravelProvider
7
+ from .mkdocs import MkdocsProvider
8
+ from .node_static import NodeStaticProvider
9
+ from .php import PhpProvider
10
+ from .python import PythonProvider
11
+ from .staticfile import StaticFileProvider
12
+
13
+
14
+ def providers() -> list[Provider]:
15
+ # Order matters: more specific providers first
16
+ return [
17
+ LaravelProvider(),
18
+ GatsbyProvider(),
19
+ HugoProvider(),
20
+ MkdocsProvider(),
21
+ PythonProvider(),
22
+ PhpProvider(),
23
+ NodeStaticProvider(),
24
+ StaticFileProvider(),
25
+ ]
26
+
@@ -0,0 +1,61 @@
1
+ from __future__ import annotations
2
+
3
+ from pathlib import Path
4
+ from typing import Dict, Optional
5
+
6
+ from .base import DetectResult, DependencySpec, Provider, _exists
7
+
8
+
9
+ class StaticFileProvider:
10
+ static_dir = "site"
11
+
12
+ def name(self) -> str:
13
+ return "staticfile"
14
+
15
+ def detect(self, path: Path) -> Optional[DetectResult]:
16
+ if _exists(path, "Staticfile"):
17
+ return DetectResult(self.name(), 50)
18
+ if _exists(path, "index.html") and not _exists(
19
+ path, "package.json", "pyproject.toml", "composer.json"
20
+ ):
21
+ return DetectResult(self.name(), 10)
22
+ return None
23
+
24
+ def initialize(self, path: Path) -> None:
25
+ pass
26
+
27
+ def serve_name(self, path: Path) -> str:
28
+ return path.name
29
+
30
+ def provider_kind(self, path: Path) -> str:
31
+ return "staticfile"
32
+
33
+ def dependencies(self, path: Path) -> list[DependencySpec]:
34
+ return [
35
+ DependencySpec(
36
+ "static-web-server",
37
+ env_var="SHIPIT_SWS_VERSION",
38
+ default_version="2.38.0",
39
+ use_in_serve=True,
40
+ )
41
+ ]
42
+
43
+ def build_steps(self, path: Path) -> list[str]:
44
+ return ['copy(".", ".", ignore=[".git"])']
45
+
46
+ def prepare_steps(self, path: Path) -> Optional[list[str]]:
47
+ return None
48
+
49
+ def declarations(self, path: Path) -> Optional[str]:
50
+ return None
51
+
52
+ def commands(self, path: Path) -> Dict[str, str]:
53
+ return {
54
+ "start": f'"static-web-server --root {{}} --log-level=info".format(buildpath("{self.static_dir}"))'
55
+ }
56
+
57
+ def assets(self, path: Path) -> Optional[Dict[str, str]]:
58
+ return None
59
+
60
+ def mounts(self, path: Path) -> Optional[Dict[str, str]]:
61
+ return None
shipit/version.py ADDED
@@ -0,0 +1,5 @@
1
+ __all__ = ["version", "version_info"]
2
+
3
+
4
+ version = "0.1.0"
5
+ version_info = (0, 1, 0, "final", 0)
@@ -0,0 +1,13 @@
1
+ Metadata-Version: 2.4
2
+ Name: shipit-cli
3
+ Version: 0.1.0
4
+ Summary: Add your description here
5
+ Project-URL: homepage, https://wasmer.io
6
+ Project-URL: repository, https://github.com/wasmerio/shipit
7
+ Project-URL: Changelog, https://github.com/wasmerio/shipit/changelog
8
+ Requires-Python: >=3.10
9
+ Requires-Dist: rich>=14.1.0
10
+ Requires-Dist: sh>=2.2.2
11
+ Requires-Dist: starlark-pyo3>=2025.1
12
+ Requires-Dist: tomlkit>=0.13.3
13
+ Requires-Dist: typer>=0.16.1
@@ -0,0 +1,19 @@
1
+ shipit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ shipit/cli.py,sha256=r0T-_IlEfB7goG_wzVO29mopdKsH3cy0QYgfS-3qHWQ,43205
3
+ shipit/generator.py,sha256=dEBH7T2OE6F96XM4oo0aaJfmAP2nTCt9gwD-ndP7it0,5013
4
+ shipit/version.py,sha256=Qz4YGriaQOa2gMqqNG4xaz98-TIaAUfaKx-N6AbcJeQ,95
5
+ shipit/assets/php/php.ini,sha256=f4irndAjB4GuuouEImRkNV22Q-yw1KqR-43jAMDw730,2531
6
+ shipit/providers/base.py,sha256=52_PAAShw9XKmxo3D6yyEq40c2NE5ctz9QnvTJQ4lFU,2212
7
+ shipit/providers/gatsby.py,sha256=pkdlIa4kAUwrDMFGryS1f7Gg8-0zDQzoaDxkBNgSlDg,2018
8
+ shipit/providers/hugo.py,sha256=UDIM2KvPcgJsiLn0mZ5Dejtuf09X3cnEQYkn-2KpZKI,1465
9
+ shipit/providers/laravel.py,sha256=nYvx1b4mqLNLPDFoWJIH6PXRNzLl2NSnSPna_eVnC_U,2640
10
+ shipit/providers/mkdocs.py,sha256=RHpQ75CiTr2GcPQNpIrPKePFR13NR5u6ZzAnCPIYAH4,2733
11
+ shipit/providers/node_static.py,sha256=JRyD5bBST8J3xFSO4Wvc5vZn2KitCxh9nKyFGMg0jAE,2163
12
+ shipit/providers/php.py,sha256=OAK9Sxdb_Fi6N04mEN_c1EtQlXYuJIuMks6x6MCOEKA,2491
13
+ shipit/providers/python.py,sha256=1C-ZI6rh3eTzL-hMEaJIf2Q-TynMywQdyDqIPadYSZM,4643
14
+ shipit/providers/registry.py,sha256=V6CAOK5gEX0RhWhr-lcAkvlwRuMom7YY2ZeAyRy1Eck,672
15
+ shipit/providers/staticfile.py,sha256=R4nOl_W6xbEXZ-uHZlZ5CQ2bdiIssiPslX0_O3PUrPU,1753
16
+ shipit_cli-0.1.0.dist-info/METADATA,sha256=fYMhoVQ-0oEvVP6Gilmw7vFYjMx9TAJgNpTsJaDAAmg,433
17
+ shipit_cli-0.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
18
+ shipit_cli-0.1.0.dist-info/entry_points.txt,sha256=NFwFn-PpVRChP5H0TO60J3pVq82DO4Pg3kjihPOrfI4,43
19
+ shipit_cli-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.27.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ shipit = shipit.cli:main