Skip to content

Commit

Permalink
0.0.18a8
Browse files Browse the repository at this point in the history
  • Loading branch information
Alw3ys committed Feb 6, 2024
1 parent 183c999 commit 81890af
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 119 deletions.
5 changes: 0 additions & 5 deletions dosei/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import os
from typing import List, Optional

from dosei_util import dosei_util
from croniter import croniter
from pydantic import BaseModel, field_validator

Expand Down Expand Up @@ -60,7 +59,3 @@ def is_func_async(func) -> bool:
def call_func(func):
is_async = Dosei.is_func_async(func)
return asyncio.run(func()) if is_async else func()

@staticmethod
def find_init(folder_path: str) -> str:
return dosei_util.find_framework_init("Dosei", folder_path)
24 changes: 6 additions & 18 deletions dosei/main.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import os
import sys

import click

from dosei import Dosei
from dosei.importer import import_from_string, ImportFromStringError

Expand All @@ -12,41 +10,31 @@
sys.path.insert(0, "")


@click.group()
def cli():
pass

def _run(func):
def run(func):
if func:
return Dosei.call_func(import_from_string(func))
try:
app: Dosei = import_from_string(dosei_config_init)
except ImportFromStringError:
raise click.ClickException(f"Couldn't find a dosei_config.py file in \"{os.getcwd()}\"")
raise ImportFromStringError(f"Couldn't find a dosei_config.py file in \"{os.getcwd()}\"")
if app.command is None:
raise click.ClickException('Command "run" not found.')
raise ImportFromStringError('Command "run" not found.')
os.system(app.command)

@cli.command()
@click.argument("func", required=False)
def run(func):
_run(func)

@cli.command()
def dev():
try:
app: Dosei = import_from_string(dosei_config_init)
except ImportFromStringError:
raise click.ClickException(f"Couldn't find a dosei_config.py file in \"{os.getcwd()}\"")
raise ImportFromStringError(f"Couldn't find a dosei_config.py file in \"{os.getcwd()}\"")
if app.dev is None:
raise click.ClickException('Command "dev" not found.')
raise ImportFromStringError('Command "dev" not found.')
os.system(app.dev)


@cli.command()
def export():
try:
app: Dosei = import_from_string(dosei_config_init)
return app.export()
except ImportFromStringError:
raise click.ClickException(f"Couldn't find a dosei_config.py file in \"{os.getcwd()}\"")
raise ImportFromStringError(f"Couldn't find a dosei_config.py file in \"{os.getcwd()}\"")
94 changes: 1 addition & 93 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "dosei"
version = "0.0.18a7"
version = "0.0.18a8"
description = "Dosei Python SDK"
authors = ["Alvaro Molina <[email protected]>"]
license = "Apache-2.0"
Expand All @@ -13,10 +13,8 @@ dosei = 'dosei.main:cli'
python = "^3.11"
fastapi = "^0.109.2"
pytest-trio = "^0.8.0"
click = "^8.1.7"
croniter = "^2.0.1"
pydantic = "^2.6.1"
dosei-util = "^0.0.13"


[tool.poetry.group.dev.dependencies]
Expand Down

0 comments on commit 81890af

Please sign in to comment.