From b767f409f48c5b520b9060eb5f1624737c62e65c Mon Sep 17 00:00:00 2001 From: long2ice Date: Fri, 15 May 2020 13:25:28 +0800 Subject: [PATCH] rename to aerich --- .github/workflows/pypi.yml | 2 +- CHANGELOG.rst | 2 +- Makefile | 4 +- README.rst | 46 ++++++++++------------- {alice => aerich}/__init__.py | 0 {alice => aerich}/cli.py | 8 ++-- {alice => aerich}/ddl/__init__.py | 0 {alice => aerich}/ddl/mysql/__init__.py | 2 +- {alice => aerich}/exceptions.py | 0 {alice => aerich}/migrate.py | 8 ++-- {alice => aerich}/utils.py | 0 pyproject.toml | 4 +- requirements-dev.txt | 50 +++++++++++++++---------- setup.py | 10 ++--- tests/backends/mysql/__init__.py | 2 +- tests/backends/mysql/test_migrate.py | 2 +- 16 files changed, 72 insertions(+), 68 deletions(-) rename {alice => aerich}/__init__.py (100%) rename {alice => aerich}/cli.py (97%) rename {alice => aerich}/ddl/__init__.py (100%) rename {alice => aerich}/ddl/mysql/__init__.py (99%) rename {alice => aerich}/exceptions.py (100%) rename {alice => aerich}/migrate.py (98%) rename {alice => aerich}/utils.py (100%) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index efad5c5..45d6a1b 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -2,7 +2,7 @@ name: pypi on: push: paths: - - 'alice/__init__.py' + - 'aerich/__init__.py' - '.github/workflows/pypi.yml' jobs: build: diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1e3a322..fcdd7ce 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,4 +7,4 @@ ChangeLog === 0.1.1 ----- -- Now alice is basic worked. \ No newline at end of file +- Now aerich is basic worked. \ No newline at end of file diff --git a/Makefile b/Makefile index bf3603d..874d018 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ -checkfiles = alice/ tests/ +checkfiles = aerich/ tests/ black_opts = -l 100 -t py38 py_warn = PYTHONDEVMODE=1 help: - @echo "Alice development makefile" + @echo "Aerich development makefile" @echo @echo "usage: make " @echo "Targets:" diff --git a/README.rst b/README.rst index 1dfb5b6..13117c6 100644 --- a/README.rst +++ b/README.rst @@ -1,13 +1,13 @@ -===== -Alice -===== +====== +Aerich +====== -.. image:: https://img.shields.io/pypi/v/alice.svg?style=flat - :target: https://pypi.python.org/pypi/alice -.. image:: https://img.shields.io/github/license/long2ice/alice - :target: https://github.com/long2ice/alice -.. image:: https://github.com/long2ice/alice/workflows/pypi/badge.svg - :target: https://github.com/long2ice/alice/actions?query=workflow:pypi +.. image:: https://img.shields.io/pypi/v/aerich.svg?style=flat + :target: https://pypi.python.org/pypi/aerich +.. image:: https://img.shields.io/github/license/long2ice/aerich + :target: https://github.com/long2ice/aerich +.. image:: https://github.com/long2ice/aerich/workflows/pypi/badge.svg + :target: https://github.com/long2ice/aerich/actions?query=workflow:pypi Introduction ============ @@ -19,26 +19,20 @@ This project aim to be a best migrations tool for Tortoise-ORM and which written Install ======= -Just install from pypi (**INVALID**): +Just install from pypi: .. code-block:: shell - $ pip install alice - -So bad that pypi project name is occupied, you can only install from source: - -.. code-block:: shell - - $ pip install git+https://github.com/long2ice/alice.git + $ pip install aerich Quick Start =========== .. code-block:: shell - $ alice -h + $ aerich -h - Usage: alice [OPTIONS] COMMAND [ARGS]... + Usage: aerich [OPTIONS] COMMAND [ARGS]... Options: --config TEXT Tortoise-ORM config module, will auto read config dict variable @@ -65,7 +59,7 @@ Init schema and migrate location .. code-block:: shell - $ alice --config tests.backends.mysql init + $ aerich --config tests.backends.mysql init Success create migrate location ./migrations/models Success init for app "models" @@ -75,7 +69,7 @@ Update models and make migrate .. code-block:: shell - $ alice --config tests.backends.mysql migrate --name drop_column + $ aerich --config tests.backends.mysql migrate --name drop_column Success migrate 1_202029051520102929_drop_column.json @@ -86,7 +80,7 @@ Upgrade to latest version .. code-block:: shell - $ alice --config tests.backends.mysql upgrade + $ aerich --config tests.backends.mysql upgrade Success upgrade 1_202029051520102929_drop_column.json @@ -97,7 +91,7 @@ Downgrade to previous version .. code-block:: shell - $ alice --config tests.backends.mysql downgrade + $ aerich --config tests.backends.mysql downgrade Success downgrade 1_202029051520102929_drop_column.json @@ -108,7 +102,7 @@ Show history .. code-block:: shell - $ alice --config tests.backends.mysql history + $ aerich --config tests.backends.mysql history 1_202029051520102929_drop_column.json @@ -117,10 +111,10 @@ Show heads to be migrated .. code-block:: shell - $ alice --config tests.backends.mysql heads + $ aerich --config tests.backends.mysql heads 1_202029051520102929_drop_column.json License ======= -This project is licensed under the `MIT `_ License. +This project is licensed under the `MIT `_ License. diff --git a/alice/__init__.py b/aerich/__init__.py similarity index 100% rename from alice/__init__.py rename to aerich/__init__.py diff --git a/alice/cli.py b/aerich/cli.py similarity index 97% rename from alice/cli.py rename to aerich/cli.py index 9f815b4..6ae35d6 100644 --- a/alice/cli.py +++ b/aerich/cli.py @@ -8,8 +8,8 @@ import asyncclick as click from asyncclick import BadOptionUsage, Context, UsageError from tortoise import Tortoise, generate_schema_for_client -from alice.migrate import Migrate -from alice.utils import get_app_connection +from aerich.migrate import Migrate +from aerich.utils import get_app_connection class Color(str, Enum): @@ -145,9 +145,7 @@ def history(ctx): click.secho(version, fg=Color.yellow) -@cli.command( - help="Init migrate location and generate schema, you must exec first." -) +@cli.command(help="Init migrate location and generate schema, you must exec first.") @click.option( "--safe", is_flag=True, diff --git a/alice/ddl/__init__.py b/aerich/ddl/__init__.py similarity index 100% rename from alice/ddl/__init__.py rename to aerich/ddl/__init__.py diff --git a/alice/ddl/mysql/__init__.py b/aerich/ddl/mysql/__init__.py similarity index 99% rename from alice/ddl/mysql/__init__.py rename to aerich/ddl/mysql/__init__.py index ffd0720..a2ea10c 100644 --- a/alice/ddl/mysql/__init__.py +++ b/aerich/ddl/mysql/__init__.py @@ -4,7 +4,7 @@ from tortoise import ForeignKeyFieldInstance, Model from tortoise.backends.mysql.schema_generator import MySQLSchemaGenerator from tortoise.fields import Field, JSONField, TextField, UUIDField -from alice.ddl import BaseDDL +from aerich.ddl import BaseDDL class MysqlDDL(BaseDDL): diff --git a/alice/exceptions.py b/aerich/exceptions.py similarity index 100% rename from alice/exceptions.py rename to aerich/exceptions.py diff --git a/alice/migrate.py b/aerich/migrate.py similarity index 98% rename from alice/migrate.py rename to aerich/migrate.py index 9d86bd2..acb6e00 100644 --- a/alice/migrate.py +++ b/aerich/migrate.py @@ -9,10 +9,10 @@ from tortoise import BackwardFKRelation, ForeignKeyFieldInstance, Model, Tortois from tortoise.backends.mysql.schema_generator import MySQLSchemaGenerator from tortoise.fields import Field -from alice.ddl import BaseDDL -from alice.ddl.mysql import MysqlDDL -from alice.exceptions import ConfigurationError -from alice.utils import get_app_connection +from aerich.ddl import BaseDDL +from aerich.ddl.mysql import MysqlDDL +from aerich.exceptions import ConfigurationError +from aerich.utils import get_app_connection class Migrate: diff --git a/alice/utils.py b/aerich/utils.py similarity index 100% rename from alice/utils.py rename to aerich/utils.py diff --git a/pyproject.toml b/pyproject.toml index 7950d0b..d065374 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] -name = "alice" -version = "0.1.0" +name = "aerich" +version = "0.1.1" description = "A database migrations tool for Tortoise ORM." authors = ["long2ice "] diff --git a/requirements-dev.txt b/requirements-dev.txt index 451b6b0..4caddd7 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,19 +1,31 @@ -# -# This file is autogenerated by pip-compile -# To update, run: -# -# make up -# -aiomysql==0.0.20 # via alice (setup.py) -aiosqlite==0.13.0 # via alice (setup.py) -anyio==1.3.0 # via alice (setup.py), asyncclick -async-generator==1.10 # via alice (setup.py), anyio -asyncclick==7.0.9 # via alice (setup.py) -cffi==1.14.0 # via alice (setup.py), cryptography -cryptography==2.9.2 # via alice (setup.py), pymysql -pycparser==2.20 # via alice (setup.py), cffi -pymysql==0.9.2 # via aiomysql, alice (setup.py) -pypika==0.37.6 # via alice (setup.py) -six==1.14.0 # via alice (setup.py), cryptography -sniffio==1.1.0 # via alice (setup.py), anyio -typing-extensions==3.7.4.2 # via alice (setup.py) +aiomysql==0.0.20 +aiosqlite==0.13.0 +anyio==1.3.0 +appdirs==1.4.4 +async-generator==1.10 +asyncclick==7.0.9 +asynctest==0.13.0 +attrs==19.3.0 +black==19.10b0 +cffi==1.14.0 +ciso8601==2.1.3; sys_platform != "win32" and implementation_name == "cpython" +click==7.1.2 +cryptography==2.9.2 +flake8==3.8.1 +iso8601==0.1.12; sys_platform == "win32" or implementation_name != "cpython" +isort==4.3.21 +mccabe==0.6.1 +pathspec==0.8.0 +pycodestyle==2.6.0 +pycparser==2.20 +pyflakes==2.2.0 +pymysql==0.9.2 +pypika==0.37.6 +regex==2020.5.14 +six==1.14.0 +sniffio==1.1.0 +taskipy==1.2.1 +toml==0.10.1 +-e git+https://github.com/tortoise/tortoise-orm.git@95c384a4742ee5980f8e4ae934bfdb0d8137bb40#egg=tortoise-orm +typed-ast==1.4.1 +typing-extensions==3.7.4.2 diff --git a/setup.py b/setup.py index f15cc4c..5ae806f 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import find_packages, setup def version(): - ver_str_line = open('alice/__init__.py', 'rt').read() + ver_str_line = open('aerich/__init__.py', 'rt').read() mob = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", ver_str_line, re.M) if not mob: raise RuntimeError("Unable to find version string") @@ -20,20 +20,20 @@ def requirements(): setup( - name='alice', + name='aerich', version=version(), description='A database migrations tool for Tortoise-ORM.', author='long2ice', long_description_content_type='text/x-rst', long_description=long_description, author_email='long2ice@gmail.com', - url='https://github.com/long2ice/alice', + url='https://github.com/long2ice/aerich', license='MIT License', - packages=find_packages(include=['alice*']), + packages=find_packages(include=['aerich*']), include_package_data=True, zip_safe=True, entry_points={ - 'console_scripts': ['alice = alice.cli:main'], + 'console_scripts': ['aerich = aerich.cli:main'], }, platforms='any', keywords=( diff --git a/tests/backends/mysql/__init__.py b/tests/backends/mysql/__init__.py index 4527a6e..c25edb5 100644 --- a/tests/backends/mysql/__init__.py +++ b/tests/backends/mysql/__init__.py @@ -1,7 +1,7 @@ from asynctest import TestCase from tortoise import Tortoise -from alice.ddl.mysql import MysqlDDL +from aerich.ddl.mysql import MysqlDDL TORTOISE_ORM = { "connections": {"default": "mysql://root:123456@127.0.0.1:3306/test",}, diff --git a/tests/backends/mysql/test_migrate.py b/tests/backends/mysql/test_migrate.py index 0ef0217..0741700 100644 --- a/tests/backends/mysql/test_migrate.py +++ b/tests/backends/mysql/test_migrate.py @@ -1,7 +1,7 @@ from asynctest import TestCase from tortoise import Tortoise -from alice.migrate import Migrate +from aerich.migrate import Migrate from tests.backends.mysql import TORTOISE_ORM