Skip to content

Commit 9f038a1

Browse files
Fix bugs in CLI and codegen (#1244)
1 parent 4bb8faa commit 9f038a1

File tree

11 files changed

+437
-422
lines changed

11 files changed

+437
-422
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,19 @@ The format is based on [Keep a Changelog], and this project adheres to [Semantic
66

77
Releases prior to 7.0 has been removed from this file to declutter search results; see the [archived copy](https://github.com/dipdup-io/dipdup/blob/8.0.0b5/CHANGELOG.md) for the full list.
88

9+
## [Unreleased]
10+
11+
### Added
12+
13+
- cli: Added `--name` option to `new` command to skip asking for the project name.
14+
15+
### Fixed
16+
17+
- cli: Fixed regression in `init` command behavior when run without flags.
18+
- cli: Fixed detecting package name in existing projects without `replay.yaml` file.
19+
- cli: Fixed `init` command processing the same paths multiple times.
20+
- cli: Fixed `init` command not respecting `--force` flag when generating default envfiles.
21+
922
## [8.3.2] - 2025-04-17
1023

1124
### Added

docs/7.references/1.cli.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,13 @@ Discord: <a class="reference external" href="https://discord.gg/aG
196196
<dl class="std option">
197197
<dt class="sig sig-object std" id="cmdoption-dipdup-init-0">
198198
<span id="cmdoption-dipdup-init-no-base"></span><span class="sig-name descname"><span class="pre">-b</span></span><span class="sig-prename descclassname"></span><span class="sig-prename descclassname"><span class="pre">,</span> </span><span class="sig-name descname"><span class="pre">--no-base</span></span><span class="sig-prename descclassname"></span></dt>
199-
<dd><p>Skip template base</p>
199+
<dd><p>Skip files from base template.</p>
200200
</dd></dl>
201201

202202
<dl class="std option">
203203
<dt class="sig sig-object std" id="cmdoption-dipdup-init-no-linter">
204204
<span class="sig-name descname"><span class="pre">--no-linter</span></span><span class="sig-prename descclassname"></span></dt>
205-
<dd><p>Skip linter and formatter.</p>
205+
<dd><p>Skip applying linter and formatter.</p>
206206
</dd></dl>
207207

208208
<p class="rubric">Arguments</p>
@@ -281,6 +281,12 @@ Discord: <a class="reference external" href="https://discord.gg/aG
281281
<dd><p>Use a specific template.</p>
282282
</dd></dl>
283283

284+
<dl class="std option">
285+
<dt class="sig sig-object std" id="cmdoption-dipdup-new-n">
286+
<span id="cmdoption-dipdup-new-name"></span><span class="sig-name descname"><span class="pre">-n</span></span><span class="sig-prename descclassname"></span><span class="sig-prename descclassname"><span class="pre">,</span> </span><span class="sig-name descname"><span class="pre">--name</span></span><span class="sig-prename descclassname"> <span class="pre">&lt;name&gt;</span></span></dt>
287+
<dd><p>Project name.</p>
288+
</dd></dl>
289+
284290
</section>
285291

286292

docs/9.release-notes/_8.0_changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
### Added
55

6+
- cli: Added `--name` option to `new` command to skip asking for the project name.
67
- cli: Added `--pre` flag to `self` group commands to install pre-release versions.
78
- cli: Added `--raw` option to `config export` command to dump config preserving the original structure.
89
- cli: Added `-C` option, a shorthand for `-c . -c configs/dipdup.<name>.yaml`.
@@ -25,9 +26,13 @@
2526
- cli: Don't save reports for successful test runs.
2627
- cli: Don't update existing installation in `self install` command unless asked to.
2728
- cli: Fixed `--pre` installer flag.
29+
- cli: Fixed `init` command not respecting `--force` flag when generating default envfiles.
30+
- cli: Fixed `init` command processing the same paths multiple times.
31+
- cli: Fixed detecting package name in existing projects without `replay.yaml` file.
2832
- cli: Fixed env files not being loaded in some commands.
2933
- cli: Fixed errors raised when the project package is invalid.
3034
- cli: Fixed progress estimation when there are indexes with `last_level` option set.
35+
- cli: Fixed regression in `init` command behavior when run without flags.
3136
- cli: Import some dependencies on demand to reduce memory footprint.
3237
- cli: Improved logging of indexer status.
3338
- config: Allow `sentry.dsn` to be empty string.

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ dependencies = [
5858
"async-lru~=2.0",
5959
"asyncpg~=0.29",
6060
"click~=8.1",
61-
"datamodel-code-generator~=0.26",
61+
# FIXME: 0.30 on macOS: tezos_storage.py:17:11: F821 Undefined name `bool_aliased
62+
"datamodel-code-generator==0.28.5", # pinned
6263
"eth-abi~=5.0",
6364
"lru-dict~=1.3",
6465
"mcp>=1.2.1",

requirements.txt

Lines changed: 122 additions & 120 deletions
Large diffs are not rendered by default.

src/dipdup/cli.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,8 @@ async def run(ctx: click.Context) -> None:
351351
@cli.command()
352352
@click.option('--force', '-f', is_flag=True, help='Overwrite existing types and ABIs.')
353353
@click.option('--base', '-b', is_flag=True, help='Include template base (default)')
354-
@click.option('--no-base', '-b', is_flag=True, help='Skip template base')
355-
@click.option('--no-linter', is_flag=True, help='Skip linter and formatter.')
354+
@click.option('--no-base', '-b', is_flag=True, help='Skip files from base template.')
355+
@click.option('--no-linter', is_flag=True, help='Skip applying linter and formatter.')
356356
@click.argument(
357357
'include',
358358
type=str,
@@ -385,7 +385,7 @@ async def init(
385385

386386
await dipdup.init(
387387
force=force,
388-
no_base=no_base or bool(include),
388+
no_base=no_base,
389389
no_linter=no_linter,
390390
include=set(include),
391391
)
@@ -560,7 +560,6 @@ async def mcp_run(ctx: click.Context) -> None:
560560

561561
import uvicorn
562562
from anyio import from_thread
563-
from mcp.server.sse import SseServerTransport
564563
from starlette.applications import Starlette
565564
from starlette.routing import Mount
566565
from starlette.routing import Route
@@ -573,6 +572,7 @@ async def mcp_run(ctx: click.Context) -> None:
573572
from dipdup.context import McpContext
574573
from dipdup.datasources.http import HttpDatasource
575574
from dipdup.dipdup import DipDup
575+
from mcp.server.sse import SseServerTransport
576576

577577
config: DipDupConfig = ctx.obj.config
578578
dipdup = DipDup(config)
@@ -955,13 +955,15 @@ async def schema_export(ctx: click.Context) -> None:
955955
help='Use values from a replay file.',
956956
)
957957
@click.option('--template', '-t', type=str, default=None, help='Use a specific template.')
958+
@click.option('--name', '-n', type=str, default=None, help='Project name.')
958959
@_cli_wrapper
959960
async def new(
960961
ctx: click.Context,
961962
quiet: bool,
962963
force: bool,
963964
replay: Path | None,
964965
template: str | None,
966+
name: str | None,
965967
) -> None:
966968
"""Create a new project interactively."""
967969

@@ -982,7 +984,7 @@ async def new(
982984
# NOTE: Collect answers from appropriate source
983985
try:
984986
if quiet:
985-
answers = get_default_answers()
987+
answers = get_default_answers(package=name)
986988
elif replay:
987989
answers = answers_from_replay(replay)
988990
else:

0 commit comments

Comments
 (0)