Skip to content
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
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ mise run project --name "my-project" --description "My app" --author "Your Name"
| Deploy docs to GitHub Pages | `mise run docs` | |
| Setup dev environment | `mise run dev` | |
| Full setup from scratch | `mise run all` | |
| Initialize the project | `mise run init` | |

> Refer to `docs/README.md` for the full list of available targets. Add new targets to `mise.toml` as needed.

Expand Down
6 changes: 3 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ Click this button to create a new repository for your project, then clone the ne

[![Use this template]( https://img.shields.io/badge/Use%20this%20template-238636?style=for-the-badge)](https://github.com/amrabed/python/generate)

### Rename the project
After cloning the repository, rename the project by running:
### Initialize the project
After cloning the repository, initialize the project by running:
```bash
mise run project
mise run init
```
The script will interactively prompt you for the following details, with smart defaults based on your environment:

Expand Down
9 changes: 3 additions & 6 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,7 @@ description = "Run the app"
alias = "a"
run = "app"

[tasks.rename]
description = "Rename project (run once)"
alias = "r"
run = "rename"
[tasks.init]
description = "Initialize project (run once)"
run = "init"

[tasks.project]
alias = ["rename", "p"]
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies = [

[project.scripts]
app = "project.app:main"
rename = "scripts.rename:main"
init = "scripts.init:main"

[dependency-groups]
dev = [
Expand Down
10 changes: 5 additions & 5 deletions scripts/rename.py → scripts/init.py
Comment thread
amrabed marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ def main(name: str, description: str, author: str, email: str, github: str):
def toml_escape(s: str) -> str:
return s.replace("\\", "\\\\").replace('"', '\\"')

description = toml_escape(description)
author = toml_escape(author)
email = toml_escape(email)
escaped_description = toml_escape(description)
escaped_author = toml_escape(author)
escaped_email = toml_escape(email)

source = name.replace("-", "_").lower()

Expand Down Expand Up @@ -138,8 +138,8 @@ def print_field(label: str, value: str):
("pyproject.toml", r"^source = \[.*\]", f'source = ["{source}"]'),
("pyproject.toml", r'^app = "project\.app:main"', f'app = "{source}.app:main"'),
("pyproject.toml", r'^name = ".*"', f'name = "{source}"'),
("pyproject.toml", r'^description = ".*"', f'description = "{description}"'),
("pyproject.toml", r"^authors = \[.*\]", f'authors = ["{author} <{email}>"]'),
("pyproject.toml", r'^description = ".*"', f'description = "{escaped_description}"'),
("pyproject.toml", r"^authors = \[.*\]", f'authors = ["{escaped_author} <{escaped_email}>"]'),
("docs/README.md", r"^# .*", f"# {description}"),
(".github/CODEOWNERS", r"@.*", f"@{github}"),
(".github/FUNDING.yml", r"^github: \[.*\]", f"github: [{github}]"),
Expand Down