-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
57 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from dosei_sdk.app import Dosei |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import os | ||
import sys | ||
|
||
from dosei_sdk import Dosei | ||
from dosei_sdk.importer import import_from_string, ImportFromStringError | ||
|
||
dosei_init = "dosei:dosei" | ||
|
||
# Add current dir to PYTHONPATH | ||
sys.path.insert(0, "") | ||
|
||
|
||
def run(func): | ||
if func: | ||
return Dosei.call_func(import_from_string(func)) | ||
try: | ||
app: Dosei = import_from_string(dosei_init) | ||
except ImportFromStringError: | ||
raise ImportFromStringError(f"Couldn't find a dosei.py file in \"{os.getcwd()}\"") | ||
if app.command is None: | ||
raise ImportFromStringError('Command "run" not found.') | ||
os.system(app.run) | ||
|
||
|
||
def export(): | ||
try: | ||
app: Dosei = import_from_string(dosei_init) | ||
return app.export() | ||
except ImportFromStringError: | ||
raise ImportFromStringError(f"Couldn't find a dosei.py file in \"{os.getcwd()}\"") |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,20 @@ | ||
[tool.poetry] | ||
name = "dosei" | ||
version = "0.0.18a9" | ||
name = "dosei-sdk" | ||
version = "0.0.18a10" | ||
description = "Dosei Python SDK" | ||
authors = ["Alvaro Molina <[email protected]>"] | ||
license = "Apache-2.0" | ||
readme = "README.md" | ||
|
||
[tool.poetry.scripts] | ||
dosei = 'dosei.main:cli' | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.11" | ||
fastapi = "^0.109.2" | ||
pytest-trio = "^0.8.0" | ||
croniter = "^2.0.1" | ||
pydantic = "^2.6.1" | ||
|
||
|
||
[tool.poetry.group.dev.dependencies] | ||
pytest-trio = "^0.8.0" | ||
fastapi = "^0.109.2" | ||
pytest = "^7.4.3" | ||
httpx = "^0.25.0" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from dosei import Dosei | ||
from dosei_sdk import Dosei | ||
|
||
dosei = Dosei() | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
import os | ||
from dosei import Dosei | ||
from dosei_sdk import Dosei | ||
|
||
port = os.getenv('PORT', 8080) | ||
dosei = Dosei( | ||
name="hello-world", | ||
command=f"uvicorn helloworld.main:app --host 0.0.0.0 --port {port}", | ||
dev=f"uvicorn helloworld.main:app --port {port} --reload", | ||
run=f"uvicorn helloworld.main:app --host 0.0.0.0 --port {port}", | ||
port=port | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
from dosei import Dosei | ||
from dosei.importer import import_from_string | ||
from dosei_sdk import Dosei | ||
from dosei_sdk.importer import import_from_string | ||
|
||
|
||
def test_fastapi(): | ||
app: Dosei = import_from_string("tests.fastapi.dosei_config:dosei") | ||
assert app.name == "hello-world" | ||
assert app.port == 8080 | ||
assert app.command == f"uvicorn helloworld.main:app --host 0.0.0.0 --port {app.port}" | ||
assert app.dev == f"uvicorn helloworld.main:app --port {app.port} --reload" | ||
assert app.run == f"uvicorn helloworld.main:app --host 0.0.0.0 --port {app.port}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.