Skip to content

Refactor to module layout #32

Merged
merged 76 commits into from
Jun 21, 2021
Merged

Refactor to module layout #32

merged 76 commits into from
Jun 21, 2021

Conversation

campb303
Copy link
Collaborator

  • Refactored to package layout:
webqueue2api
├── __init__.py
├── api
│   ├── __init__.py
│   ├── app.py
│   ├── auth.py
│   ├── config.py
│   └── resources
│       ├── __init__.py
│       ├── item.py
│       ├── login.py
│       ├── queue.py
│       ├── queue_list.py
│       └── refresh_access_token.py
├── config.py
└── parser
    ├── __init__.py
    ├── config.py
    ├── errors.py
    ├── item.py
    └── queue.py
  • Centralized configuration management following a pattern of each package having its own config.py and the top level package has a composite config consisting of the other configurations. Example:
>>> import webqueue2api
>>> webqueue2api.config.parser.environment
"prod"
>>> webqueue2api.config.api.jwt_secret_key
"5wA!*6foTML^EF"
>>> webqueue2api.config.queue_directory = "/path/to/queues"
>>> webqueue2api.config.queue_directory
"/path/to/queues"
  • Added WSGI app export easy gunicorn support:
# Starts multi-threaded API server on localhost:8000
gunicorn webqueue2api.api:app
# Authenticate against API
curl -X POST \
    -H "Content-Type: application/json" \
    -d '{"username": "bob", "password": "super_secret"}'
  • Added custom errors to parser sub-package
  • Updated return codes for API (ex: return 404 when FileNotFoundError is raised)
  • Refactored to snake_case
  • Reimplemented headers_only loading and json_data serialization

campb303 and others added 30 commits February 22, 2021 13:31
Create installable package directory structure
@campb303 campb303 linked an issue Jun 21, 2021 that may be closed by this pull request
@campb303 campb303 merged commit 3762076 into staging Jun 21, 2021
@campb303 campb303 deleted the refactor-to-module-layout branch June 21, 2021 19:31
This was referenced Jun 29, 2021
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package Structure
2 participants