Skip to content

Commit

Permalink
Update command naming
Browse files Browse the repository at this point in the history
  • Loading branch information
desertaxle committed Mar 12, 2024
1 parent 7cb5fc9 commit e5a65b7
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 193 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pip install git+https://github.com/PrefectHQ/pmt.git
Generate new code for a `Deployment.build_from_flow` call:

```bash
pmt migrate build-from-flow path/to/script.py
pmt upgrade build-from-flow path/to/script.py
```

Running the above command on a script containing the following code:
Expand Down Expand Up @@ -115,13 +115,13 @@ To upgrade to the new deployment API, replace your original code with the update
To write the updated code to a file, use the `--output` flag:

```bash
pmt migrate build-from-flow path/to/script.py --output path/to/output.py
pmt upgrade build-from-flow path/to/script.py --output path/to/output.py
```

To update a file in place, you can provide the same path for the input and output:

```bash
pmt migrate build-from-flow path/to/script.py --output path/to/script.py
pmt upgrade build-from-flow path/to/script.py --output path/to/script.py
```

## Development
Expand Down
4 changes: 2 additions & 2 deletions pmt/cli/app.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import typer

from pmt.cli import migrate
from pmt.cli import upgrade


app = typer.Typer()
app.add_typer(migrate.app, name="migrate")
app.add_typer(upgrade.app, name="upgrade")


@app.callback()
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions pmt/transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
INFRA_ADDITIONAL_INFO = (
"When deploying flows with `flow.deploy`, work pools replace"
" infrastructure blocks as the source of infrastructure"
" configuration. To migrate from an infrastructure block to a"
" configuration. To upgrade from an infrastructure block to a"
" work pool, publish your infrastructure as a work pool by"
" calling the `.publish_as_work_pool()` method on your"
" infrastructure block.and pass the name of the new work pool"
Expand All @@ -23,7 +23,7 @@
)

NO_INFRA_ADDITIONAL_INFO = (
"Your `Deployment.build_from_flow` call was migrated to a"
"Your `Deployment.build_from_flow` call was upgraded to a"
" `flow.serve()` call because your script does not use an"
" infrastructure block. You can use `flow.serve` to create a"
" deployment for your flow and poll for and execute scheduled runs. To"
Expand Down
252 changes: 70 additions & 182 deletions poetry.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ prefect = "^2.14.11"
black = "^23.12.0"
astor = "^0.8.1"
rich = "^13.7.0"
greenlet = "^3.0.3"

[tool.poetry.group.dev.dependencies]
pytest = "^7.4.3"
Expand Down
8 changes: 4 additions & 4 deletions tests/cli/test_migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
"infra_slug_and_storage_slug",
],
)
def test_migrate_build_from_flow(base_scripts_folder, scripts_folder):
def test_upgrade_build_from_flow(base_scripts_folder, scripts_folder):
folder = base_scripts_folder / scripts_folder
start_path = folder / "start.py"
result = cli_runner.invoke(app, ["migrate", "build-from-flow", str(start_path)])
result = cli_runner.invoke(app, ["upgrade", "build-from-flow", str(start_path)])
assert result.exit_code == 0
assert (
f"Refer to the output below to see how to update your code in {start_path}"
Expand All @@ -43,15 +43,15 @@ def test_migrate_build_from_flow(base_scripts_folder, scripts_folder):
"infra_slug_and_storage_slug",
],
)
def test_migrate_build_from_flow_with_output(
def test_upgrade_build_from_flow_with_output(
tmp_path, base_scripts_folder, scripts_folder
):
folder = base_scripts_folder / scripts_folder
start_path = folder / "start.py"
result = cli_runner.invoke(
app,
[
"migrate",
"upgrade",
"build-from-flow",
str(start_path),
"-o",
Expand Down

0 comments on commit e5a65b7

Please sign in to comment.