Skip to content

v1.1 RC #47

Merged
merged 60 commits into from
Aug 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
e634be1
Remove old ECNQueue module
benne238 Jun 28, 2021
2648c8e
Add pyparsing to requirements
benne238 Jun 28, 2021
425b41a
Add ParseError to parser module
benne238 Jun 28, 2021
dc11658
Move Item.__get_formatted_date to webqueue2api.parser.utils and renam…
benne238 Jun 28, 2021
12407b0
Refactor to use new format_date_string function
benne238 Jun 28, 2021
7ee915f
replaced old parser and imported new pyparsing parser in the item class
benne238 Jun 28, 2021
5738191
Fixed bug where the end of the string was not matched
benne238 Jun 28, 2021
c7e0d0a
created function to append the initial message headers to the parsed …
benne238 Jun 29, 2021
0f69c18
modifed __add_initial_message_headers to output the expected format f…
benne238 Jun 29, 2021
42bb135
Moved the content attribute in item to be defined after all the other…
benne238 Jun 29, 2021
e7e7687
add_intitial_message_headers function call from the parseSections fun…
benne238 Jun 29, 2021
b701cda
Revert "add_intitial_message_headers function call from the parseSect…
benne238 Jun 29, 2021
3951832
return initial message section with appropriate headers
benne238 Jun 29, 2021
b9d4945
formatted function names to camel case
benne238 Jun 29, 2021
de2dd76
add function call to __get_sorted_sections to sort the parsed item se…
benne238 Jun 29, 2021
4dfb974
add assignment parsing to item.py
benne238 Jun 29, 2021
d858c0c
modified repy_from_user_end_delimiter to not include an ending newline
benne238 Jun 30, 2021
56798fb
added a condition that checks for an ending reply from user delimiter…
benne238 Jun 30, 2021
f61860e
fixed error message for header information not seperated from content…
benne238 Jun 30, 2021
8289ae7
Add logic to return an error_parse if a header is not formatted corre…
benne238 Jun 30, 2021
f5e5619
moved the email.policy configuration from the parser.py module to the…
benne238 Jun 30, 2021
595b1be
modified action end delimiter and modified the expected value error m…
benne238 Jun 30, 2021
66b65d7
modified the status rule to expect only a single line delimiter and m…
benne238 Jun 30, 2021
5fbc373
modified the edit rule to expect only a single line delimiter and mad…
benne238 Jun 30, 2021
a3fafba
modified the reply to user rule to expect only a single line delimite…
benne238 Jun 30, 2021
1d0358c
added pp.LineStart() to explicity look for reply_from_user delimiter …
benne238 Jun 30, 2021
f7114c2
Added logic to raise a parser error with the appropriate information …
benne238 Jul 1, 2021
a84d8e7
Made expected message relevent: the datetime string doesn't need to b…
benne238 Jul 1, 2021
5383f8f
added docstring to __get_assignments
benne238 Jul 1, 2021
23abdf3
added docstring to __parse_sections
benne238 Jul 1, 2021
c9d04e5
Made initial message rule more similar to the edit, reply-to, and sta…
benne238 Jul 2, 2021
90ba300
import multiprocessing package in queue.py
benne238 Jul 12, 2021
d8e722b
Added logic to parse multiple items at once in a given queue using th…
benne238 Jul 12, 2021
5a30f2d
Added code to wait until all of the items are loaded before returning…
benne238 Jul 12, 2021
55cb9ad
Modified load_queues function in queue.py to accept *args (strings th…
benne238 Jul 12, 2021
81e28e5
created a custom class that allows subprocesses to spawn other subpro…
benne238 Jul 12, 2021
ab565ec
added logic to parse multiple queues with multiparsing using the the …
benne238 Jul 12, 2021
60254aa
modified logic to avoid directly reading lock file contents due to po…
benne238 Jul 12, 2021
3ec46b8
Added basic logic to check if the webqueue2api_config file exists in …
benne238 Jul 14, 2021
7dc383b
Logic to overwrite the queue_directory if the configuration file cont…
benne238 Jul 14, 2021
b11d2a8
Logic to overwrite the queues_to_ignore if it exists in the configura…
benne238 Jul 14, 2021
e8115fc
Added logic to overwrite the environment variable if it exists in the…
benne238 Jul 14, 2021
0a30503
Added logic to overwrite the jwt_secret_key if the variable exists in…
benne238 Jul 14, 2021
6c6c990
Add docs about section parsing
campb303 Jul 28, 2021
a3387af
Add wildcard delimiter to webqueue2api Package directory for parser docs
campb303 Jul 28, 2021
58bf454
Merge pull request #40 from ECN/enhancement-lock-file-change
campb303 Aug 2, 2021
84cb7b4
Remove unused datetime import
campb303 Aug 2, 2021
80cc1cb
Correct __add_initial_message_headers doc block
campb303 Aug 2, 2021
5e07895
Cleanup __get_sorted_sections
campb303 Aug 2, 2021
206ed36
Rename reply to user delimiter
campb303 Aug 2, 2021
5c10453
Merge pull request #41 from ECN/feature-rewrite-parser-in-formal-grammar
campb303 Aug 2, 2021
49ad6e8
Docs cleanup
campb303 Aug 2, 2021
c88dc30
Merge pull request #45 from ECN/feature-implement-multiparsing-when-l…
campb303 Aug 2, 2021
462182d
Simplify config overrides and change config ext
campb303 Aug 2, 2021
1600b7c
Fix config environment reference
campb303 Aug 2, 2021
0c4523f
Remove testing config and rename config ext
campb303 Aug 2, 2021
f4f874e
Merge pull request #46 from ECN/feature-implement-config-file-overrid…
campb303 Aug 2, 2021
1ca7251
Add basic validation for parser settings in config file
campb303 Aug 3, 2021
c73052c
Update docs
campb303 Aug 3, 2021
44e97cf
Rebuild docs
campb303 Aug 3, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions docs-src/webqueue2api Package/Configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
The configuration of webqueue2api can be managed in two different ways:

- At launch with a configuration file in the same directory as the virtual environment
- At runtime by modifying the `webqueue2api.config` symbol directly

## Configuration File
On import, a [ConfigParser INI formatted file](https://docs.python.org/3/library/configparser.html#supported-ini-file-structure) is read for configuartion options. This file must be located in the same directory as the virtual environment folder and must be named `webqueue2api_config.ini`.

!!! example "A Full Config File"
```ini
[parser]
# Absolute path to directory containing queue data.
# Default: /home/pier/e/queue/Mail
queue_directory = /etc/queue-cli/queues

# List of queues to ignore. (Comma and space ", " delimited.)
# Default: archives, drafts, inbox, coral
queues_to_ignore = dogs, cats, particularly_pugs

[api]
# Runtime configuration for secure production or convenient development settings.
# Valid options are: prod | dev
# Default: prod
environment = dev

# Token used to encrypt JWT payloads.
# Default: webqueue2api.api.config.generate_random_string
jwt_secret_key = uV0liG9$YgcGE7J!
```

## Changing Settings at Runtime
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")
```
25 changes: 25 additions & 0 deletions docs-src/webqueue2api Package/Getting Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,31 @@ The webqueue2api Package has the following structure:

## Basic Usage

!!! example "Load all queues."
```python
import webqueue2api
all_queues = webqueue2api.load_queues()
for queue in all_queues:
print(f"{queue.name} has {len(queue.items)} items."
```
```python
# Expected Output
"tech has 72 items"
"ce has 38 items"
...
```

!!! example "Load some queues."
```python
import webqueue2api
all_queues = webqueue2api.load_queues("che", "tech", "ce")
print( len( all_queues ) )
```
```python
# Expected Output
3
```

!!! example "Load a queue and get the number of items in it."
```python
import webqueue2api
Expand Down
19 changes: 1 addition & 18 deletions docs-src/webqueue2api Package/Package Structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,4 @@ 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")
```
- `parser`: Contains parers for a Queue and an Item as well as utilities and custom errors.
Loading