Skip to content

Commit

Permalink
Merge pull request #295 from seapagan/fix-standalone-issues
Browse files Browse the repository at this point in the history
Fix several issues with generating standalone projects
  • Loading branch information
seapagan committed Mar 4, 2024
2 parents edbe1ab + 2451973 commit 746a5bb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 13 additions & 2 deletions py_maker/pymaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,12 @@ def post_process(self) -> None:
proj_loc = (
self.location if self.location != "." else self.choices.project_dir
)
run_cmd = (
f"{self.location}"
if not self.choices.standalone
else "python main.py"
)

output = f"""
--> [green]Project created successfully.[/green]
Expand All @@ -233,7 +239,7 @@ def post_process(self) -> None:
3) Activate the virtual environment:
'poetry shell'
4) Run the application:
'{self.location}'
'{run_cmd}'
5) Code!
See the [bold][green]README.md[/green][/bold] file for more information.
Expand Down Expand Up @@ -313,11 +319,16 @@ def get_input(self) -> None:
if self.settings.github_username
else "<your GitHub username>"
)
repo_name = (
sanitize(self.choices.project_dir.name)
if self.choices.package_name == "-"
else self.choices.package_name
)
self.choices.repository = Prompt.ask(
"Repository URL?",
default=(
f"https://github.com/{github_username}/"
f"{re.sub(r'[_.]+', '-', self.choices.package_name)}"
f"{re.sub(r'[_.]+', '-', repo_name.lower())}"
),
)

Expand Down
4 changes: 4 additions & 0 deletions py_maker/template/pyproject.toml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ repository = "{{ repository }}"
# rename "{{ slug }}" below to change the executable name. You can also
# add more scripts if your package offers multiple commands.
{{ slug }} = "{{ package_name }}.main:app"

{% else%}
package-mode = false

{% endif %}

[tool.poetry.dependencies]
Expand Down

0 comments on commit 746a5bb

Please sign in to comment.