Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(WF-123): template apps have incorrect version after generation #646

Merged
merged 3 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions apps/ai-starter/pyproject.toml

This file was deleted.

15 changes: 0 additions & 15 deletions apps/default/pyproject.toml

This file was deleted.

15 changes: 0 additions & 15 deletions apps/hello/pyproject.toml

This file was deleted.

15 changes: 0 additions & 15 deletions apps/pdg-tutorial/pyproject.toml

This file was deleted.

15 changes: 0 additions & 15 deletions apps/quickstart/pyproject.toml

This file was deleted.

15 changes: 0 additions & 15 deletions apps/text-demo/pyproject.toml

This file was deleted.

6 changes: 6 additions & 0 deletions src/writer/command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import click

import writer.serve
from writer import VERSION
from writer.deploy import cloud, deploy

CONTEXT_SETTINGS = {'help_option_names': ['-h', '--help']}
Expand Down Expand Up @@ -95,6 +96,11 @@ def create_app(app_path: str, template_name: Optional[str], overwrite=False):
sys.exit(1)

shutil.copytree(template_path, app_path, dirs_exist_ok=True)
# create/update requirements.txt and add writer to it
requirements_path = os.path.join(app_path, "requirements.txt")
with open(requirements_path, "a") as f:
f.write(f"writer=={VERSION}\n")


if __name__ == "__main__":
main()
6 changes: 0 additions & 6 deletions tests/backend/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ def test_create_default():
assert os.path.exists('./my_app')
assert os.path.exists('./my_app/.wf')
assert os.path.exists('./my_app/main.py')
with open('./my_app/pyproject.toml') as f:
content = f.read()
assert content.find('name = "writer-framework-default"') != -1

def test_create_specific_template():
runner = CliRunner()
Expand All @@ -38,9 +35,6 @@ def test_create_specific_template():
assert os.path.exists('./my_app')
assert os.path.exists('./my_app/.wf')
assert os.path.exists('./my_app/main.py')
with open('./my_app/pyproject.toml') as f:
content = f.read()
assert content.find('name = "writer-framework-hello"') != -1


def test_run():
Expand Down