shipit-cli 0.12.0__py3-none-any.whl → 0.13.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.
- shipit/cli.py +87 -15
- shipit/version.py +2 -2
- {shipit_cli-0.12.0.dist-info → shipit_cli-0.13.0.dist-info}/METADATA +1 -1
- {shipit_cli-0.12.0.dist-info → shipit_cli-0.13.0.dist-info}/RECORD +6 -6
- {shipit_cli-0.12.0.dist-info → shipit_cli-0.13.0.dist-info}/WHEEL +0 -0
- {shipit_cli-0.12.0.dist-info → shipit_cli-0.13.0.dist-info}/entry_points.txt +0 -0
shipit/cli.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import tempfile
|
|
2
|
+
import hashlib
|
|
2
3
|
import requests
|
|
3
4
|
import os
|
|
4
5
|
import shlex
|
|
@@ -1138,6 +1139,28 @@ class WasmerBuilder:
|
|
|
1138
1139
|
*(extra_args or []), _out=write_stdout, _err=write_stderr, _env=os.environ
|
|
1139
1140
|
)
|
|
1140
1141
|
|
|
1142
|
+
def deploy_config(self, config_path: Path) -> None:
|
|
1143
|
+
package_webc_path = self.wasmer_dir_path / "package.webc"
|
|
1144
|
+
app_yaml_path = self.wasmer_dir_path / "app.yaml"
|
|
1145
|
+
package_webc_path.parent.mkdir(parents=True, exist_ok=True)
|
|
1146
|
+
self.run_command(
|
|
1147
|
+
self.bin,
|
|
1148
|
+
["package", "build", self.wasmer_dir_path, "--out", package_webc_path],
|
|
1149
|
+
)
|
|
1150
|
+
config_path.write_text(
|
|
1151
|
+
json.dumps(
|
|
1152
|
+
{
|
|
1153
|
+
"app_yaml_path": str(app_yaml_path.absolute()),
|
|
1154
|
+
"package_webc_path": str(package_webc_path.absolute()),
|
|
1155
|
+
"package_webc_size": package_webc_path.stat().st_size,
|
|
1156
|
+
"package_webc_sha256": hashlib.sha256(
|
|
1157
|
+
package_webc_path.read_bytes()
|
|
1158
|
+
).hexdigest(),
|
|
1159
|
+
}
|
|
1160
|
+
)
|
|
1161
|
+
)
|
|
1162
|
+
console.print(f"\n[bold]Saved deploy config to {config_path}[/bold]")
|
|
1163
|
+
|
|
1141
1164
|
def deploy(
|
|
1142
1165
|
self, app_owner: Optional[str] = None, app_name: Optional[str] = None
|
|
1143
1166
|
) -> str:
|
|
@@ -1446,10 +1469,18 @@ def auto(
|
|
|
1446
1469
|
None,
|
|
1447
1470
|
help="The path to the Shipit file (defaults to Shipit in the provided path).",
|
|
1448
1471
|
),
|
|
1472
|
+
temp_shipit: bool = typer.Option(
|
|
1473
|
+
False,
|
|
1474
|
+
help="Use a temporary Shipit file in the system temporary directory.",
|
|
1475
|
+
),
|
|
1449
1476
|
wasmer_deploy: Optional[bool] = typer.Option(
|
|
1450
1477
|
False,
|
|
1451
1478
|
help="Deploy the project to Wasmer.",
|
|
1452
1479
|
),
|
|
1480
|
+
wasmer_deploy_config: Optional[Path] = typer.Option(
|
|
1481
|
+
None,
|
|
1482
|
+
help="Save the output of the Wasmer build to a json file",
|
|
1483
|
+
),
|
|
1453
1484
|
wasmer_token: Optional[str] = typer.Option(
|
|
1454
1485
|
None,
|
|
1455
1486
|
help="Wasmer token.",
|
|
@@ -1494,11 +1525,20 @@ def auto(
|
|
|
1494
1525
|
if not path.exists():
|
|
1495
1526
|
raise Exception(f"The path {path} does not exist")
|
|
1496
1527
|
|
|
1528
|
+
if temp_shipit:
|
|
1529
|
+
if shipit_path:
|
|
1530
|
+
raise Exception("Cannot use both --temp-shipit and --shipit-path")
|
|
1531
|
+
temp_shipit = tempfile.NamedTemporaryFile(
|
|
1532
|
+
delete=False, delete_on_close=False, prefix="Shipit"
|
|
1533
|
+
)
|
|
1534
|
+
shipit_path = Path(temp_shipit.name)
|
|
1535
|
+
|
|
1497
1536
|
if not regenerate:
|
|
1498
1537
|
if shipit_path and not shipit_path.exists():
|
|
1499
1538
|
regenerate = True
|
|
1500
1539
|
elif not (path / "Shipit").exists():
|
|
1501
1540
|
regenerate = True
|
|
1541
|
+
|
|
1502
1542
|
if regenerate:
|
|
1503
1543
|
generate(
|
|
1504
1544
|
path,
|
|
@@ -1523,7 +1563,7 @@ def auto(
|
|
|
1523
1563
|
skip_prepare=skip_prepare,
|
|
1524
1564
|
env_name=env_name,
|
|
1525
1565
|
)
|
|
1526
|
-
if start or wasmer_deploy:
|
|
1566
|
+
if start or wasmer_deploy or wasmer_deploy_config:
|
|
1527
1567
|
serve(
|
|
1528
1568
|
path,
|
|
1529
1569
|
wasmer=wasmer,
|
|
@@ -1536,6 +1576,7 @@ def auto(
|
|
|
1536
1576
|
wasmer_deploy=wasmer_deploy,
|
|
1537
1577
|
wasmer_app_owner=wasmer_app_owner,
|
|
1538
1578
|
wasmer_app_name=wasmer_app_name,
|
|
1579
|
+
wasmer_deploy_config=wasmer_deploy_config,
|
|
1539
1580
|
)
|
|
1540
1581
|
# deploy(path)
|
|
1541
1582
|
|
|
@@ -1552,6 +1593,7 @@ def generate(
|
|
|
1552
1593
|
"-o",
|
|
1553
1594
|
"--out",
|
|
1554
1595
|
"--output",
|
|
1596
|
+
"--shipit-path",
|
|
1555
1597
|
help="Output path (defaults to the Shipit file in the provided path).",
|
|
1556
1598
|
),
|
|
1557
1599
|
use_procfile: bool = typer.Option(
|
|
@@ -1676,6 +1718,10 @@ def serve(
|
|
|
1676
1718
|
None,
|
|
1677
1719
|
help="Name of the Wasmer app.",
|
|
1678
1720
|
),
|
|
1721
|
+
wasmer_deploy_config: Optional[Path] = typer.Option(
|
|
1722
|
+
None,
|
|
1723
|
+
help="Save the output of the Wasmer build to a json file",
|
|
1724
|
+
),
|
|
1679
1725
|
) -> None:
|
|
1680
1726
|
if not path.exists():
|
|
1681
1727
|
raise Exception(f"The path {path} does not exist")
|
|
@@ -1685,18 +1731,17 @@ def serve(
|
|
|
1685
1731
|
builder = DockerBuilder(path, docker_client)
|
|
1686
1732
|
else:
|
|
1687
1733
|
builder = LocalBuilder(path)
|
|
1688
|
-
if wasmer or wasmer_deploy:
|
|
1734
|
+
if wasmer or wasmer_deploy or wasmer_deploy_config:
|
|
1689
1735
|
builder = WasmerBuilder(
|
|
1690
1736
|
builder, path, registry=wasmer_registry, token=wasmer_token, bin=wasmer_bin
|
|
1691
1737
|
)
|
|
1692
|
-
if start:
|
|
1693
|
-
builder.run_serve_command("start")
|
|
1694
1738
|
|
|
1695
|
-
if
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1739
|
+
if wasmer_deploy_config:
|
|
1740
|
+
builder.deploy_config(wasmer_deploy_config)
|
|
1741
|
+
elif wasmer_deploy:
|
|
1742
|
+
builder.deploy(app_owner=wasmer_app_owner, app_name=wasmer_app_name)
|
|
1743
|
+
elif start:
|
|
1744
|
+
builder.run_serve_command("start")
|
|
1700
1745
|
|
|
1701
1746
|
|
|
1702
1747
|
@app.command(name="plan")
|
|
@@ -1713,6 +1758,14 @@ def plan(
|
|
|
1713
1758
|
"--output",
|
|
1714
1759
|
help="Output path of the plan (defaults to stdout).",
|
|
1715
1760
|
),
|
|
1761
|
+
temp_shipit: bool = typer.Option(
|
|
1762
|
+
False,
|
|
1763
|
+
help="Use a temporary Shipit file in the system temporary directory.",
|
|
1764
|
+
),
|
|
1765
|
+
regenerate: bool = typer.Option(
|
|
1766
|
+
False,
|
|
1767
|
+
help="Regenerate the Shipit file.",
|
|
1768
|
+
),
|
|
1716
1769
|
shipit_path: Optional[Path] = typer.Option(
|
|
1717
1770
|
None,
|
|
1718
1771
|
help="The path to the Shipit file (defaults to Shipit in the provided path).",
|
|
@@ -1765,10 +1818,24 @@ def plan(
|
|
|
1765
1818
|
if not path.exists():
|
|
1766
1819
|
raise Exception(f"The path {path} does not exist")
|
|
1767
1820
|
|
|
1768
|
-
if
|
|
1821
|
+
if temp_shipit:
|
|
1822
|
+
if shipit_path:
|
|
1823
|
+
raise Exception("Cannot use both --temp-shipit and --shipit-path")
|
|
1824
|
+
temp_shipit = tempfile.NamedTemporaryFile(
|
|
1825
|
+
delete=False, delete_on_close=False, prefix="Shipit"
|
|
1826
|
+
)
|
|
1827
|
+
shipit_path = Path(temp_shipit.name)
|
|
1828
|
+
|
|
1829
|
+
if not regenerate:
|
|
1830
|
+
if shipit_path and not shipit_path.exists():
|
|
1831
|
+
regenerate = True
|
|
1832
|
+
elif not (path / "Shipit").exists():
|
|
1833
|
+
regenerate = True
|
|
1834
|
+
|
|
1835
|
+
if regenerate:
|
|
1769
1836
|
generate(
|
|
1770
1837
|
path,
|
|
1771
|
-
out=
|
|
1838
|
+
out=shipit_path,
|
|
1772
1839
|
use_procfile=use_procfile,
|
|
1773
1840
|
install_command=install_command,
|
|
1774
1841
|
build_command=build_command,
|
|
@@ -1843,7 +1910,7 @@ def plan(
|
|
|
1843
1910
|
out.write_text(json_output)
|
|
1844
1911
|
console.print(f"[bold]Plan saved to {out.absolute()}[/bold]")
|
|
1845
1912
|
else:
|
|
1846
|
-
sys.stdout.write(json_output+ "\n")
|
|
1913
|
+
sys.stdout.write(json_output + "\n")
|
|
1847
1914
|
sys.stdout.flush()
|
|
1848
1915
|
|
|
1849
1916
|
|
|
@@ -1964,11 +2031,16 @@ def get_shipit_path(path: Path, shipit_path: Optional[Path] = None) -> Path:
|
|
|
1964
2031
|
if shipit_path is None:
|
|
1965
2032
|
shipit_path = path / "Shipit"
|
|
1966
2033
|
if not shipit_path.exists():
|
|
1967
|
-
raise Exception(
|
|
2034
|
+
raise Exception(
|
|
2035
|
+
f"Shipit file not found at {shipit_path}. Run `shipit generate {path}` to create it."
|
|
2036
|
+
)
|
|
1968
2037
|
elif not shipit_path.exists():
|
|
1969
|
-
raise Exception(
|
|
2038
|
+
raise Exception(
|
|
2039
|
+
f"Shipit file not found at {shipit_path}. Run `shipit generate {path} -o {shipit_path}` to create it."
|
|
2040
|
+
)
|
|
1970
2041
|
return shipit_path
|
|
1971
2042
|
|
|
2043
|
+
|
|
1972
2044
|
def main() -> None:
|
|
1973
2045
|
args = sys.argv[1:]
|
|
1974
2046
|
# If no subcommand or first token looks like option/path → default to "build"
|
shipit/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: shipit-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.13.0
|
|
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
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
shipit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
shipit/cli.py,sha256=
|
|
2
|
+
shipit/cli.py,sha256=WGXqd5WGBhCj-xQDUa0eOURhGKNq5uXYWoNl2GsHaUA,71082
|
|
3
3
|
shipit/generator.py,sha256=t9EwdpwhXFJ4OVynDdEtW68yj5KS61cK7uqrvawfCz4,7151
|
|
4
4
|
shipit/procfile.py,sha256=GlfdwzFUr0GWGKaaiXlLKNFInWaRNMy_wN14UEyU_5Q,2974
|
|
5
|
-
shipit/version.py,sha256=
|
|
5
|
+
shipit/version.py,sha256=FgBZ4tsPrpCbr8Q0dhH2MkvuZwFMVQSoRkwcWU6LW0E,97
|
|
6
6
|
shipit/assets/php/php.ini,sha256=SaR3wvssSROtxTY_CQ5-BspM_47_I971V5X2dsqe8sU,2579
|
|
7
7
|
shipit/assets/wordpress/install.sh,sha256=5RWYleXFdrRCfmRSUkt4zJSgjLqeTi9sgNObKK4qD2c,2840
|
|
8
8
|
shipit/assets/wordpress/wp-config.php,sha256=q7KHB_TyLrodXzbg8EEPm42XWDIevtwL6wk3L0kbVrs,4809
|
|
@@ -16,7 +16,7 @@ shipit/providers/python.py,sha256=IqCSwE6kvN9bwrC44RYG8_c8drmEzlsm6F_C2re2Dz8,21
|
|
|
16
16
|
shipit/providers/registry.py,sha256=KBgMCwRZEFECdMpIoMn6ytL-FLc_NkTTdtHgVbHx5Jc,670
|
|
17
17
|
shipit/providers/staticfile.py,sha256=s4hXoelvI2cvSa2sp714QxbD_Q6yQlXdR8azvpbUNFA,2737
|
|
18
18
|
shipit/providers/wordpress.py,sha256=jLv5U4AcbfyeNq-ZSq6boJIBirwvJEwclG1a6JtB5q0,3230
|
|
19
|
-
shipit_cli-0.
|
|
20
|
-
shipit_cli-0.
|
|
21
|
-
shipit_cli-0.
|
|
22
|
-
shipit_cli-0.
|
|
19
|
+
shipit_cli-0.13.0.dist-info/METADATA,sha256=FIK2-wsHWQLgo6EDSws_hEiQ9FMJ_YsnYk7nqAB1TTU,616
|
|
20
|
+
shipit_cli-0.13.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
21
|
+
shipit_cli-0.13.0.dist-info/entry_points.txt,sha256=7AE1NjSrHaSDfbfsRRO50KKnHFTbB0Imsccd1WynzAQ,72
|
|
22
|
+
shipit_cli-0.13.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|