Skip to content

Commit af63221

Browse files
committed
Fix no module found error. (#188) (#189)
1 parent 3595257 commit af63221

File tree

5 files changed

+10
-11
lines changed

5 files changed

+10
-11
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## 0.5
44

5+
### 0.5.7
6+
7+
- Fix no module found error. (#188) (#189)
8+
59
### 0.5.6
610

711
- Add `Command` class. (#148) (#141) (#123) (#106)

aerich/__init__.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
__version__ = "0.5.6"
2-
31
import os
42
from pathlib import Path
53
from typing import List
@@ -14,7 +12,6 @@
1412
from aerich.migrate import Migrate
1513
from aerich.models import Aerich
1614
from aerich.utils import (
17-
add_src_path,
1815
get_app_connection,
1916
get_app_connection_name,
2017
get_models_describe,
@@ -29,14 +26,11 @@ def __init__(
2926
tortoise_config: dict,
3027
app: str = "models",
3128
location: str = "./migrations",
32-
src_folder: str = ".",
3329
):
3430
self.tortoise_config = tortoise_config
3531
self.app = app
3632
self.location = location
37-
self.src_folder = src_folder
3833
Migrate.app = app
39-
add_src_path(src_folder)
4034

4135
async def init(self):
4236
await Migrate.init(self.tortoise_config, self.app, self.location)

aerich/cli.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
from aerich.exceptions import DowngradeError
1313
from aerich.utils import add_src_path, get_tortoise_config
1414

15-
from . import Command, __version__
15+
from . import Command
1616
from .enums import Color
17+
from .version import __version__
1718

1819
parser = ConfigParser()
1920

@@ -70,11 +71,10 @@ async def cli(ctx: Context, config, app, name):
7071
location = parser[name]["location"]
7172
tortoise_orm = parser[name]["tortoise_orm"]
7273
src_folder = parser[name].get("src_folder", CONFIG_DEFAULT_VALUES["src_folder"])
74+
add_src_path(src_folder)
7375
tortoise_config = get_tortoise_config(ctx, tortoise_orm)
7476
app = app or list(tortoise_config.get("apps").keys())[0]
75-
command = Command(
76-
tortoise_config=tortoise_config, app=app, location=location, src_folder=src_folder
77-
)
77+
command = Command(tortoise_config=tortoise_config, app=app, location=location)
7878
ctx.obj["command"] = command
7979
if invoked_subcommand != "init-db":
8080
if not Path(location, app).exists():

aerich/version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "0.5.7"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "aerich"
3-
version = "0.5.6"
3+
version = "0.5.7"
44
description = "A database migrations tool for Tortoise ORM."
55
authors = ["long2ice <[email protected]>"]
66
license = "Apache-2.0"

0 commit comments

Comments
 (0)