Skip to content

Commit

Permalink
Release 0.1.9 (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
pyprogrammerblog committed Sep 17, 2022
1 parent 07e6eb4 commit 0bf48f5
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 36 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=====================

0.1.9 (2022-09-17)
-------------------

- Documentation.


0.1.8 (2022-09-17)
-------------------

Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,27 @@ The available backends to store logs are **Mongo**, **Redis** and **SQL**.
Please read the [docs](https://progress-updater.readthedocs.io/en/latest/)
for further information.

Environment variables
-----------------------
Setting your backend with environment variables
--------------------------------------------------
You can set your backend by defining env vars.
The `PU__` prefix indicates that it belongs to `ProgressUpdater`.
```shell
# SQL
PU__SQL_DSN='postgresql+psycopg2://user:pass@postgres:5432/db'
PU__SQL_TABLE='logs'
...

# Redis
PU__REDIS_HOST='redis'
PU__REDIS_DB='1'
PU__REDIS_PASSWORD='pass'
...

# Mongo
PU__MONGO_CONNECTION='mongodb://user:pass@mongo:27017'
PU__MONGO_DB='db'
PU__MONGO_COLLECTION='logs'
...
```

And then when creating a `ProgressUpdater` object, the backend will be
Expand Down
9 changes: 5 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,25 +62,26 @@ The output is::
Backends
-------------------
The available backends to store logs are **Mongo**, **Redis** and **SQL**.
Please read the [docs](https://progress-updater.readthedocs.io/en/latest/)
for further information.

Environment variables
-----------------------
Setting your backend with environment variables
---------------------------------------------------
You can set your backend by defining env vars.
The `PU__` prefix indicates that it belongs to `ProgressUpdater`::

# SQL
PU__SQL_DSN='postgresql+psycopg2://user:pass@postgres:5432/db'
PU__SQL_TABLE='logs'
...
# Redis
PU__REDIS_HOST='redis'
PU__REDIS_DB='1'
PU__REDIS_PASSWORD='pass'
...
# Mongo
PU__MONGO_CONNECTION='mongodb://user:pass@mongo:27017'
PU__MONGO_DB='db'
PU__MONGO_COLLECTION='logs'
...


And then when creating a `ProgressUpdater` object, the backend will be
Expand Down
2 changes: 1 addition & 1 deletion docs/mongo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ Mongo Backend

.. automodule:: progress_updater.backends.mongo
:members: MongoLog
:exclude-members: mongo_collection, backend
:exclude-members: mongo_collection
40 changes: 12 additions & 28 deletions progress_updater/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@ class ProgressUpdater:
Example:
>>> from progress_updater import ProgressUpdater
>>> from progress_updater.backends import MongoSettings
>>>
>>> updater = ProgressUpdater(task_name="My Task")
>>> settings = MongoSettings(
>>> mongo_connection="mongodb://user:pass@mongo:27017",
>>> mongo_db="db",
>>> mongo_collection="logs",
>>> )
>>> updater = ProgressUpdater(task_name="My Task", settings=settings)
>>>
>>> with updater(block_name="First part") as updater:
>>> # doing things
Expand All @@ -31,32 +37,14 @@ class ProgressUpdater:
**Backends**
There are three backends available to save our logs.
1. **Mongo**. `MongoSettings`. Parameters are:
- mongo_connection: str. Connection string
- mongo_db:m str. DB Name
- mongo_collection: str. Collection name.
- mongo_extras: dict. See extra arguments in Pymongo.
2. **Redis**. `RedisSettings`. Parameters are:
- sql_dsn: str. SQLAlchemy connection string.
- sql_table:m str. SQL Table Name.
- sql_extras: dict. See extra arguments for SQLAlchemy.
3. **SQL**. `SQLSettings`. Parameters are:
- redis_host. str.
- redis_port. int.
- redis_db. int.
- redis_password. str.
- redis_extras. dict.
There are three backends available to save our logs,
**Mongo**, **Redis** and **SQL**.
**Settings.**
Different ways to pass settings to the `ProgressUpdater` with
priority order.
Different ways to pass settings to the `ProgressUpdater`.
**1. Passing settings** as parameters when creating a `ProgressUpdater`
object:
object like in the above example:
>>> from progress_updater import ProgressUpdater
>>> from progress_updater import ProgressUpdater
Expand All @@ -76,11 +64,7 @@ class ProgressUpdater:
>>> redis_settings = RedisSettings(
>>> redis_host="redis", redis_password="pass"
>>> )
>>>
>>> updater = ProgressUpdater(
>>> task_name="My Task",
>>> settings=mongo_settings
>>> )
**2. Environment variables**. Set you setting parameters in your
environment. The `PU__` prefix indicates that belongs to the
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "progress_updater"
version = "0.1.8"
version = "0.1.9"
description = "Progress Updater"
readme = "README.md"
license = "LICENSE"
Expand Down

0 comments on commit 0bf48f5

Please sign in to comment.