Skip to content

Commit

Permalink
Merge pull request #646 from writer/WF-123-fix-examples-versions
Browse files Browse the repository at this point in the history
fix(WF-123): template apps have incorrect version after generation
  • Loading branch information
ramedina86 authored Nov 27, 2024
2 parents ec53f21 + a8f42de commit 8774f9b
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 96 deletions.
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

0 comments on commit 8774f9b

Please sign in to comment.