shipit-cli 0.15.0__tar.gz → 0.15.2__tar.gz
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.
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/PKG-INFO +1 -1
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/pyproject.toml +1 -1
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/cli.py +53 -26
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/providers/base.py +4 -4
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/providers/php.py +17 -2
- shipit_cli-0.15.2/src/shipit/version.py +5 -0
- shipit_cli-0.15.0/src/shipit/version.py +0 -5
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/.gitignore +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/README.md +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/__init__.py +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/assets/php/php.ini +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/assets/wordpress/install.sh +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/assets/wordpress/wp-config.php +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/builders/__init__.py +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/builders/base.py +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/builders/docker.py +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/builders/local.py +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/generator.py +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/procfile.py +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/providers/hugo.py +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/providers/jekyll.py +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/providers/laravel.py +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/providers/mkdocs.py +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/providers/node_static.py +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/providers/python.py +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/providers/registry.py +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/providers/staticfile.py +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/providers/wordpress.py +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/runners/__init__.py +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/runners/base.py +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/runners/local.py +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/runners/wasmer.py +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/shipit_types.py +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/ui.py +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/src/shipit/utils.py +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/tests/test_e2e.py +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/tests/test_generate_shipit_examples.py +0 -0
- {shipit_cli-0.15.0 → shipit_cli-0.15.2}/tests/test_version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: shipit-cli
|
|
3
|
-
Version: 0.15.
|
|
3
|
+
Version: 0.15.2
|
|
4
4
|
Summary: Shipit CLI is the best way to build, serve and deploy your projects anywhere.
|
|
5
5
|
Project-URL: homepage, https://wasmer.io
|
|
6
6
|
Project-URL: repository, https://github.com/wasmerio/shipit
|
|
@@ -153,9 +153,7 @@ class Ctx:
|
|
|
153
153
|
commands=commands,
|
|
154
154
|
prepare=prepare_steps,
|
|
155
155
|
workers=workers,
|
|
156
|
-
mounts=self.get_refs([mount.ref for mount in mounts])
|
|
157
|
-
if mounts
|
|
158
|
-
else None,
|
|
156
|
+
mounts=self.get_refs([mount.ref for mount in mounts]) if mounts else None,
|
|
159
157
|
volumes=self.get_refs([volume["ref"] for volume in volumes])
|
|
160
158
|
if volumes
|
|
161
159
|
else None,
|
|
@@ -206,8 +204,12 @@ class Ctx:
|
|
|
206
204
|
serve_path = self.runner.get_serve_mount_path(name)
|
|
207
205
|
mount = Mount(name, build_path, serve_path)
|
|
208
206
|
ref = self.add_mount(mount)
|
|
209
|
-
|
|
210
|
-
return CtxMount(
|
|
207
|
+
|
|
208
|
+
return CtxMount(
|
|
209
|
+
ref=ref,
|
|
210
|
+
path=str(build_path.absolute()),
|
|
211
|
+
serve_path=str(serve_path.absolute()),
|
|
212
|
+
)
|
|
211
213
|
|
|
212
214
|
def add_volume(self, volume: Volume) -> Optional[str]:
|
|
213
215
|
self.volumes.append(volume)
|
|
@@ -257,7 +259,7 @@ def evaluate_shipit(
|
|
|
257
259
|
raise ValueError(f"No serve definition found in {shipit_file}")
|
|
258
260
|
assert len(ctx.serves) <= 1, "Only one serve is allowed for now"
|
|
259
261
|
serve = next(iter(ctx.serves.values()))
|
|
260
|
-
|
|
262
|
+
|
|
261
263
|
# Now we apply the custom commands (start, after_deploy, build, install)
|
|
262
264
|
if provider_config.commands.start:
|
|
263
265
|
serve.commands["start"] = provider_config.commands.start
|
|
@@ -271,11 +273,23 @@ def evaluate_shipit(
|
|
|
271
273
|
has_done_install = False
|
|
272
274
|
for step in serve.build:
|
|
273
275
|
if isinstance(step, RunStep):
|
|
274
|
-
if
|
|
275
|
-
|
|
276
|
+
if (
|
|
277
|
+
step.group == "build"
|
|
278
|
+
and not has_done_build
|
|
279
|
+
and provider_config.commands.build
|
|
280
|
+
):
|
|
281
|
+
new_build.append(
|
|
282
|
+
RunStep(provider_config.commands.build, group="build")
|
|
283
|
+
)
|
|
276
284
|
has_done_build = True
|
|
277
|
-
elif
|
|
278
|
-
|
|
285
|
+
elif (
|
|
286
|
+
step.group == "install"
|
|
287
|
+
and not has_done_install
|
|
288
|
+
and provider_config.commands.install
|
|
289
|
+
):
|
|
290
|
+
new_build.append(
|
|
291
|
+
RunStep(provider_config.commands.install, group="install")
|
|
292
|
+
)
|
|
279
293
|
has_done_install = True
|
|
280
294
|
else:
|
|
281
295
|
new_build.append(step)
|
|
@@ -288,10 +302,14 @@ def evaluate_shipit(
|
|
|
288
302
|
serve.build = new_build
|
|
289
303
|
|
|
290
304
|
if serve.commands.get("start"):
|
|
291
|
-
serve.commands["start"] = serve.commands["start"].replace(
|
|
292
|
-
|
|
305
|
+
serve.commands["start"] = serve.commands["start"].replace(
|
|
306
|
+
"$PORT", str(provider_config.port or "8080")
|
|
307
|
+
)
|
|
308
|
+
|
|
293
309
|
if serve.commands.get("after_deploy"):
|
|
294
|
-
serve.commands["after_deploy"] = serve.commands["after_deploy"].replace(
|
|
310
|
+
serve.commands["after_deploy"] = serve.commands["after_deploy"].replace(
|
|
311
|
+
"$PORT", str(provider_config.port or "8080")
|
|
312
|
+
)
|
|
295
313
|
|
|
296
314
|
return ctx, serve
|
|
297
315
|
|
|
@@ -406,6 +424,9 @@ def auto(
|
|
|
406
424
|
help="The port to use (defaults to 8080).",
|
|
407
425
|
),
|
|
408
426
|
):
|
|
427
|
+
# We assume wasmer as an active flag if we pass wasmer deploy or wasmer deploy config
|
|
428
|
+
wasmer = wasmer or wasmer_deploy or (wasmer_deploy_config is not None)
|
|
429
|
+
|
|
409
430
|
if not path.exists():
|
|
410
431
|
raise Exception(f"The path {path} does not exist")
|
|
411
432
|
|
|
@@ -440,7 +461,7 @@ def auto(
|
|
|
440
461
|
install_command=install_command,
|
|
441
462
|
build_command=build_command,
|
|
442
463
|
start_command=start_command,
|
|
443
|
-
wasmer=
|
|
464
|
+
wasmer=wasmer,
|
|
444
465
|
docker=docker,
|
|
445
466
|
docker_client=docker_client,
|
|
446
467
|
skip_docker_if_safe_build=skip_docker_if_safe_build,
|
|
@@ -522,7 +543,9 @@ def generate(
|
|
|
522
543
|
if build_command:
|
|
523
544
|
base_config.commands.build = build_command
|
|
524
545
|
provider_cls = load_provider(path, base_config, use_provider=provider)
|
|
525
|
-
provider_config = load_provider_config(
|
|
546
|
+
provider_config = load_provider_config(
|
|
547
|
+
provider_cls, path, base_config, config=config
|
|
548
|
+
)
|
|
526
549
|
provider = provider_cls(path, provider_config)
|
|
527
550
|
content = generate_shipit(path, provider)
|
|
528
551
|
config_json = provider_config.model_dump_json(indent=2, exclude_defaults=True)
|
|
@@ -616,6 +639,9 @@ def serve(
|
|
|
616
639
|
help="Save the output of the Wasmer build to a json file",
|
|
617
640
|
),
|
|
618
641
|
) -> None:
|
|
642
|
+
# We assume wasmer as an active flag if we pass wasmer deploy or wasmer deploy config
|
|
643
|
+
wasmer = wasmer or wasmer_deploy or (wasmer_deploy_config is not None)
|
|
644
|
+
|
|
619
645
|
if not path.exists():
|
|
620
646
|
raise Exception(f"The path {path} does not exist")
|
|
621
647
|
|
|
@@ -626,8 +652,7 @@ def serve(
|
|
|
626
652
|
else:
|
|
627
653
|
build_backend = LocalBuildBackend(path, ASSETS_PATH)
|
|
628
654
|
|
|
629
|
-
|
|
630
|
-
if needs_wasmer:
|
|
655
|
+
if wasmer:
|
|
631
656
|
runner: Runner = WasmerRunner(
|
|
632
657
|
build_backend,
|
|
633
658
|
path,
|
|
@@ -783,7 +808,9 @@ def plan(
|
|
|
783
808
|
if serve_port:
|
|
784
809
|
base_config.port = serve_port
|
|
785
810
|
provider_cls = load_provider(path, base_config, use_provider=provider)
|
|
786
|
-
provider_config = load_provider_config(
|
|
811
|
+
provider_config = load_provider_config(
|
|
812
|
+
provider_cls, path, base_config, config=config
|
|
813
|
+
)
|
|
787
814
|
# provider_config = runner.prepare_config(provider_config)
|
|
788
815
|
ctx, serve = evaluate_shipit(shipit_file, build_backend, runner, provider_config)
|
|
789
816
|
|
|
@@ -811,9 +838,7 @@ def plan(
|
|
|
811
838
|
provider_config.commands.build = build_command
|
|
812
839
|
plan_output = {
|
|
813
840
|
"provider": provider_cls.name(),
|
|
814
|
-
"config": json.loads(
|
|
815
|
-
provider_config.model_dump_json(exclude_defaults=True)
|
|
816
|
-
),
|
|
841
|
+
"config": json.loads(provider_config.model_dump_json(exclude_defaults=True)),
|
|
817
842
|
"services": [
|
|
818
843
|
{"name": svc.name, "provider": svc.provider}
|
|
819
844
|
for svc in (serve.services or [])
|
|
@@ -936,11 +961,11 @@ def build(
|
|
|
936
961
|
base_config.port = serve_port
|
|
937
962
|
|
|
938
963
|
provider_cls = load_provider(path, base_config, use_provider=provider)
|
|
939
|
-
provider_config = load_provider_config(
|
|
940
|
-
|
|
941
|
-
ctx, serve = evaluate_shipit(
|
|
942
|
-
shipit_file, build_backend, runner, provider_config
|
|
964
|
+
provider_config = load_provider_config(
|
|
965
|
+
provider_cls, path, base_config, config=config
|
|
943
966
|
)
|
|
967
|
+
provider_config = runner.prepare_config(provider_config)
|
|
968
|
+
ctx, serve = evaluate_shipit(shipit_file, build_backend, runner, provider_config)
|
|
944
969
|
env = {
|
|
945
970
|
"PATH": "",
|
|
946
971
|
"COLORTERM": os.environ.get("COLORTERM", ""),
|
|
@@ -986,7 +1011,9 @@ def build(
|
|
|
986
1011
|
env_vars = dotenv_values(path / f".env.{env_name}")
|
|
987
1012
|
serve.env.update(env_vars)
|
|
988
1013
|
|
|
989
|
-
assert serve.commands.get("start"),
|
|
1014
|
+
assert serve.commands.get("start"), (
|
|
1015
|
+
"No start command could be found, please provide a start command"
|
|
1016
|
+
)
|
|
990
1017
|
|
|
991
1018
|
# Build and serve
|
|
992
1019
|
build_backend.build(serve.name, env, serve.mounts or [], serve.build)
|
|
@@ -2,8 +2,8 @@ from dataclasses import dataclass, field
|
|
|
2
2
|
from pathlib import Path
|
|
3
3
|
from typing import Any, Dict, List, Optional, Protocol, Literal
|
|
4
4
|
from shipit.procfile import Procfile
|
|
5
|
-
from pydantic import
|
|
6
|
-
from pydantic_settings import SettingsConfigDict
|
|
5
|
+
from pydantic import Field
|
|
6
|
+
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
@dataclass
|
|
@@ -12,7 +12,7 @@ class DetectResult:
|
|
|
12
12
|
score: int # Higher score wins when multiple providers match
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
class CustomCommands(
|
|
15
|
+
class CustomCommands(BaseSettings):
|
|
16
16
|
model_config = SettingsConfigDict(extra="ignore")
|
|
17
17
|
|
|
18
18
|
install: Optional[str] = None
|
|
@@ -46,7 +46,7 @@ class CustomCommands(BaseModel):
|
|
|
46
46
|
return self
|
|
47
47
|
|
|
48
48
|
|
|
49
|
-
class Config(
|
|
49
|
+
class Config(BaseSettings):
|
|
50
50
|
model_config = SettingsConfigDict(extra="ignore", env_prefix="SHIPIT_")
|
|
51
51
|
|
|
52
52
|
port: Optional[int] = 8080
|
|
@@ -19,6 +19,7 @@ class PhpConfig(Config):
|
|
|
19
19
|
model_config = SettingsConfigDict(extra="ignore", env_prefix="SHIPIT_")
|
|
20
20
|
|
|
21
21
|
use_composer: bool = False
|
|
22
|
+
composer_build_script: Optional[str] = None
|
|
22
23
|
php_version: Optional[str] = "8.3"
|
|
23
24
|
php_architecture: Optional[Literal["64-bit", "32-bit"]] = "64-bit"
|
|
24
25
|
|
|
@@ -38,7 +39,16 @@ class PhpProvider:
|
|
|
38
39
|
)
|
|
39
40
|
or False
|
|
40
41
|
)
|
|
41
|
-
|
|
42
|
+
composer_build_script = None
|
|
43
|
+
if use_composer:
|
|
44
|
+
composer_config = json.load(open(path / "composer.json"))
|
|
45
|
+
if "scripts" in composer_config:
|
|
46
|
+
assert isinstance(composer_config["scripts"], dict), "Scripts must be a dictionary"
|
|
47
|
+
composer_build_script = "post-update-cmd" if "post-update-cmd" in composer_config["scripts"] else None
|
|
48
|
+
if not composer_build_script and "post-install-cmd" in composer_config["scripts"]:
|
|
49
|
+
composer_build_script = "post-install-cmd"
|
|
50
|
+
config = PhpConfig(use_composer=use_composer, composer_build_script=composer_build_script, **base_config.model_dump())
|
|
51
|
+
return config
|
|
42
52
|
|
|
43
53
|
@classmethod
|
|
44
54
|
def name(cls) -> str:
|
|
@@ -97,10 +107,15 @@ class PhpProvider:
|
|
|
97
107
|
if self.config.use_composer:
|
|
98
108
|
steps.append('env(COMPOSER_HOME="/tmp", COMPOSER_FUND="0")')
|
|
99
109
|
steps.append(
|
|
100
|
-
'run("composer install --optimize-autoloader --no-scripts --no-interaction", inputs=["composer.json", "composer.lock"], outputs=["."], group="install")'
|
|
110
|
+
'run("composer install --optimize-autoloader --ignore-platform-reqs --no-scripts --no-interaction", inputs=["composer.json", "composer.lock"], outputs=["."], group="install")'
|
|
101
111
|
)
|
|
102
112
|
|
|
103
113
|
steps.append('copy(".", ".", ignore=[".git"])')
|
|
114
|
+
|
|
115
|
+
# Since we don't run the scripts during the install step, we need to run them after the build step
|
|
116
|
+
if self.config.use_composer and self.config.composer_build_script:
|
|
117
|
+
steps.append(f'run("composer run-script {self.config.composer_build_script}", outputs=["."], group="build")')
|
|
118
|
+
|
|
104
119
|
return steps
|
|
105
120
|
|
|
106
121
|
def prepare_steps(self) -> Optional[list[str]]:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|