Skip to content

Commit

Permalink
Doc update
Browse files Browse the repository at this point in the history
Add Mysql related usage, remove py34 circleci configuration.
  • Loading branch information
peter-wangxu committed Feb 20, 2022
1 parent bbf1f93 commit ed37d0a
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ workflows:
jobs:
- pep8
- py27
- py34
# - py34
- py35
- py36
- py37
Expand Down
47 changes: 44 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Join `persist-queue <https://join.slack

Requirements
------------
* Python 2.7 or Python 3.x.
* Python 2.7 or Python 3.x (refer to `Deprecation`_ for future plan)
* Full support for Linux.
* Windows support (with `Caution`_ if ``persistqueue.Queue`` is used).

Expand All @@ -53,7 +53,12 @@ Features
- Both filed based queues and sqlite3 based queues are supported
- Filed based queue: multiple serialization protocol support: pickle(default), msgpack, json


Deprecation
-----------
- `Python 3.4 release has reached end of life <https://www.python.org/downloads/release/python-3410/>`_ and
`DBUtils <https://webwareforpython.github.io/DBUtils/changelog.html>`_ ceased support for `Python 3.4`, `persist queue` drops the support for python 3.4 since version 0.8.0.
other queue implementations such as file based queue and sqlite3 based queue are still workable.
- `Python 2 was sunset on January 1, 2020 <https://www.python.org/doc/sunset-python-2/>`_, `persist-queue` will drop any Python 2 support in future version `1.0.0`, no new feature will be developed under Python 2.

Installation
------------
Expand All @@ -64,7 +69,7 @@ from pypi
.. code-block:: console
pip install persist-queue
# for msgpack support, use following command
# for msgpack and mysql support, use following command
pip install persist-queue[extra]
Expand Down Expand Up @@ -426,6 +431,42 @@ multi-thread usage for **Queue**
q.join() # block until all tasks are done
Example usage with a MySQL based queue
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

*Available since: v0.8.0*

.. code-block:: python
>>> import persistqueue
>>> db_conf = {
>>> "host": "127.0.0.1",
>>> "user": "user",
>>> "passwd": "passw0rd",
>>> "db_name": "testqueue",
>>> # "name": "",
>>> "port": 3306
>>> }
>>> q = persistqueue.MySQLQueue(name="testtable", **db_conf)
>>> q.put('str1')
>>> q.put('str2')
>>> q.put('str3')
>>> q.get()
'str1'
>>> del q
Close the console, and then recreate the queue:

.. code-block:: python
>>> import persistqueue
>>> q = persistqueue.MySQLQueue(name="testtable", **db_conf)
>>> q.get()
'str2'
>>>
**note**

Expand Down
7 changes: 7 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
services:
- mysql

environment:

matrix:
Expand Down Expand Up @@ -42,6 +45,10 @@ test_script:
# Note that you must use the environment variable %PYTHON% to refer to
# the interpreter you're using - Appveyor does not do anything special
# to put the Python evrsion you want to use on PATH.
- ps: |
$env:MYSQL_PWD="Password12!"
$cmd = '"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql" -e "create database testqueue;" --user=root'
iex "& $cmd"
- "%PYTHON%\\Scripts\\tox.exe"

#on_success:
Expand Down
2 changes: 1 addition & 1 deletion extra-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
msgpack>=0.5.6
PyMySQL
DBUtils<3.0.0 # since 3.0.0 no longer supports Python2.x
DBUtils<3.0.0 # since 3.0.0 no longer supports Python2.x
11 changes: 11 additions & 0 deletions persistqueue/tests/test_mysqlqueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@
# "name": "",
"port": 3306
}
# for appveyor (windows ci), not able to config use the default
# https://www.appveyor.com/docs/services-databases/#mysql
if sys.platform.startswith('win32'):
db_conf = {
"host": "127.0.0.1",
"user": "root",
"passwd": "Password12!",
"db_name": "testqueue",
# "name": "",
"port": 3306
}


class MySQLQueueTest(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ nose2>=0.6.5
coverage!=4.5
cov_core>=1.15.0
virtualenv>=15.1.0
cryptography # package only required for tests under mysql8.0
cryptography;sys_platform!="win32" # package only required for tests under mysql8.0&linux

0 comments on commit ed37d0a

Please sign in to comment.