Skip to content

Commit

Permalink
feat(project): added project metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksnell committed May 6, 2022
1 parent ac6a52e commit 3af1fe0
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ build
.pytest_cache
.DS_Store
.vscode
dist
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Banquet

> Development server for OpenAPI/Lambda Projects
NB This project is very early in development - milage may vary!

## Installing

Install and update using pip:

`pip install -U banquet`
9 changes: 5 additions & 4 deletions banquet/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ def __init__(self, conf, path=None):
self.handler = None
self._base = path
self.path = os.path.join(os.getcwd(), path)
self.summary = conf.get("summary")
self.gateway = conf.get("x-amazon-apigateway-integration")
self.handler_path = conf.get("x-handler")

self.load()
Expand All @@ -18,11 +16,14 @@ def load(self):
return

fp = None
source_path = os.path.join(self.path, self.handler_path, "index.py")

if not os.path.exists(source_path):
raise Exception(f"Handler could not be found: '{source_path}'")

try:
spec = importlib.util.spec_from_file_location(
self.handler_path,
os.path.join(self.path, self.handler_path, "index.py"),
self.handler_path, source_path
)
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)
Expand Down
6 changes: 5 additions & 1 deletion banquet/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ def run_server(addr, port, routes, spec, functions):
openapi_spec = build_spec_for_routes(routes)

else:
if spec is None or not os.path.exists(spec):
if spec is None:
logger.error(f"No OpenAPI Spec or Routes provided!")
sys.exit(1)

if not os.path.exists(spec):
logger.error(f"Unable to find OpenAPI Spec on path '{spec}'")
sys.exit(1)

Expand Down
21 changes: 21 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,27 @@ description = "CLI tool for working with OpenAPI and Lambda functions"
authors = ["Nick Snell <[email protected]>"]
license = "MIT"
readme = "README.md"
homepage = "https://github.com/boughtbymany/banquet"
repository = "https://github.com/boughtbymany/banquet"
documentation = "https://github.com/boughtbymany/banquet"
keywords = [
"OpenAPI",
"HTTP",
"Deverlopment Server",
"AWS Lambda"
]
classifiers = [
"Development Status :: 3 - Alpha",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
"Topic :: Software Development :: Build Tools",
"Topic :: Software Development :: Testing",
"Topic :: Utilities"
]

[tool.poetry.dependencies]
python = "^3.8"
Expand Down

0 comments on commit 3af1fe0

Please sign in to comment.