Skip to content

Commit 741de23

Browse files
committed
Add unified up command.
1 parent 429799b commit 741de23

File tree

7 files changed

+66
-18
lines changed

7 files changed

+66
-18
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* ++ Add 'ma' alias for 'makeapp' command.
77
* ++ Added virtual environment creation on project rollout.
88
* ++ CLI. Add 'publish' command.
9-
* ++ CLI. Added 'venv reset' command.
9+
* ++ CLI. Added 'up' command.
1010
* ++ CLI. Descriptions passed to 'change' command all go into a commit messages.
1111
* ** Added QA for Py 3.11, 3.12, 3.13.
1212
* ** Dropped QA for Py 3.7, 3.8, 3.9.

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ https://github.com/idlesign/makeapp
99

1010
## Description
1111

12-
*Simplifies Python application rollout and publishing.*
12+
*Simplifies routine Python application development processes.*
1313

1414
* Make a skeleton for your new application with one console command.
1515
* Automatically create a VCS repository for your application.
@@ -18,7 +18,7 @@ https://github.com/idlesign/makeapp
1818
* Put some skeleton default settings into a configuration file not to mess with command line switches anymore.
1919
* Easily add entries to your changelog.
2020
* Publish your application to remotes (VCS, PyPI) with a single command.
21-
21+
* Easily bootstrap your development environment.
2222

2323
## Application scaffolding
2424

@@ -73,6 +73,17 @@ This will automatically:
7373
* push sources to remote repository
7474
* upload application package to PyPI
7575

76+
77+
## Dev environment bootstrap
78+
79+
Or you just want to participate in the development of some other app.
80+
81+
Use `up` initialize the environment to develop that application.
82+
83+
``` bash
84+
ma up
85+
```
86+
7687
## Documentation
7788

7889
https://makeapp.readthedocs.io/

docs/040_development.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Developer tools
2+
3+
Makeapp gives you some tools to further facilitate the development process.
4+
5+
## Bootstrap virtual environment
6+
7+
When you've got an app sources and want to initialize the environment to develop the app
8+
use `up` command (inside the directory with `pyproject.toml`).
9+
10+
```bash
11+
ma up
12+
```
13+
14+
## Register the CLI application as a tool
15+
16+
If your application has a CLI (e.g. exposes `project.scripts`) you can register
17+
it as a tool. So that the command issued in terminal will invoke just the code you develop.
18+
19+
```bash
20+
ma up -t
21+
# or ma up --tool
22+
```
23+
24+
## Regenerate the environment
25+
26+
Sometimes something may go wrong with the virtual environment so that you may want
27+
to drop the old one altogether and create a new one. Use the following command:
28+
29+
```bash
30+
ma up -r
31+
# or ma up --reset
32+
```

docs/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Description
66

7-
*Simplifies Python application rollout and publishing.*
7+
*Simplifies routine Python application development processes.*
88

99
* Make a skeleton for your new application with one console command.
1010
* Automatically create a VCS repository for your application.
@@ -13,6 +13,7 @@
1313
* Put some skeleton default settings into a configuration file not to mess with command line switches anymore.
1414
* Easily add entries to your changelog.
1515
* Publish your application to remotes (VCS, PyPI) with single command.
16+
* Easily bootstrap your development environment.
1617

1718

1819
## Requirements

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "makeapp"
33
dynamic = ["version"]
4-
description = "Simplifies Python application rollout and publishing."
4+
description = "Simplifies routine Python application development processes."
55
authors = [
66
{ name = "Igor Starikov", email = "[email protected]" }
77
]

src/makeapp/apptools.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -501,10 +501,9 @@ def publish(self):
501501
self.vcs.push()
502502
DistHelper.upload()
503503

504-
def venv_init(self, *, reset: bool = False, register: bool = False):
505-
LOG.info(f'Initializing virtual environment [{reset=}, {register=}] ...')
504+
def venv_init(self, *, reset: bool = False, register_tool: bool = False):
505+
LOG.info(f'Initializing virtual environment [{reset=}, {register_tool=}] ...')
506506

507507
self.venv.initialize(reset=reset)
508508

509-
if register:
510-
self.venv.register_tool()
509+
register_tool and self.venv.register_tool()

src/makeapp/cli.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -195,16 +195,21 @@ def change(debug, description):
195195
click.secho('Done', fg='green')
196196

197197

198-
@entry_point.group()
199-
def venv():
200-
"""Virtual environment related commands."""
201-
202-
203-
@venv.command()
198+
@entry_point.command()
204199
@option_debug
205-
def reset(debug):
206-
"""Remove old virtual environment and generate a new one."""
207-
Project(log_level=logging.DEBUG if debug else logging.INFO).venv_init(reset=True)
200+
@click.option(
201+
'-t', '--tool',
202+
help='Register application CLI as a tool', is_flag=True
203+
)
204+
@click.option(
205+
'-r', '--reset',
206+
help='Remove virtual environment files before bootstrap', is_flag=True
207+
)
208+
def up(debug, tool, reset):
209+
"""Bootstrap environment for development."""
210+
project = Project(log_level=logging.DEBUG if debug else logging.INFO)
211+
project.venv_init(reset=reset, register_tool=tool)
212+
click.secho('Done', fg='green')
208213

209214

210215
def main():

0 commit comments

Comments
 (0)