Skip to content

Commit

Permalink
Add Package Structure docs and configuration usage example
Browse files Browse the repository at this point in the history
  • Loading branch information
campb303 committed Jul 1, 2021
1 parent aa145e1 commit 14e9148
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
25 changes: 25 additions & 0 deletions docs-src/webqueue2api Package/Package Structure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Hierarchy

The webqueue2api Package consists of four packages in total:

- `webqueue2api`: The root packages. This contains both the `api` and the `parser` packages as well as global configuration.
- `api`: Contains a [Flask](https://flask.palletsprojects.com/) app that can be used with any WSGI server to host the webqueue2 API and utilities such as authentication code.
- `resources`: Contains [Flask-RESTful](https://flask-restful.readthedocs.io/en/latest/) resources for the webqueue2 API.
- `parser`: Contains parers for a Queue and an Item as well as utilities and custom errors.

## Configuration
Each package contains package level configuration objects (see: [dataclasses on PyPI](https://pypi.org/project/dataclasses/)) in `config.py` files. All of the configurations are combined into the top level `webqueue2api.config` symbol.

These configuration objects store default values for each package. Default values can be changed by editing these objects directly or by editing the object values before their use.

!!! example "Changing the parser's queue directory by editing object values."
```python
import webqueue2api

# Load Queue from default directory
ce_queue = Queue("ce")

# load Queue from modified directory
webqueue2api.config.parser.queue_directory = "/absolute/path"
other_queue = Queue("other")
```
3 changes: 2 additions & 1 deletion docs-src/webqueue2api Package/awesome-pages.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# YAML Configuration for Awesome Pages mkdocs Plugin
# See: https://github.com/lukasgeiter/mkdocs-awesome-pages-plugin
nav:
- ...
- Getting Started.md
- Package Structure.md

0 comments on commit 14e9148

Please sign in to comment.