Introduction to eyap
====================
The ``eyap`` package is an extended yapping and comment management
system written in python. The basic goal is to provide a high-level
comment management system which can be used with various back-ends.
Quick start
===========
The following example is from
```eyap/__init__.py`` <https://github.com/emin63/eyap/blob/master/eyap/__init__.py>`__:
With eyap, you can choose a backend to manage your comments. A key goal
of the eyap package is that you can write your code in a generic way and
easily switch the back-end. For example, you can use a simple file
back-end with something like like the following:
::
>>> import eyap, tempfile, os, shutil # Import some things used for demo.
>>> backend = 'file' # Use a simple file backend for demo.
>>> finfo = {'owner': 'emin63', 'realm': tempfile.mkdtemp(), 'topic': 'test'}
>>> comment_thread = eyap.Make.comment_thread('file', **finfo)
>>> comment_thread.add_comment('Testing things', allow_create=True)
>>> comment_thread.add_comment('is great!')
The code above will create a new comment thread and add a comment to it
while also creating the thread if it does not exist. Later, you could
access the thread via something like:
::
>>> print(str(comment_thread.lookup_comments())) # doctest: +ELLIPSIS
========================================
Subject: Testing things ...
Timestamp: ...
----------
Testing things
========================================
Subject: is great! ...
Timestamp: ...
----------
is great!
The main reason for the existence of something like eyap is so that you
could use pretty much the same exact code with a different backend. For
example, using ‘github’ instead of ‘file’ and setting realm/owner to the
organization/repo in github while providing a valid user/token for
github access will post or read an issue from github.
::
>>> ginfo = {'owner': 'emin63', 'realm': 'eyap', 'topic': 'Describe usage'}
>>> g_thread = eyap.Make.comment_thread('github', **ginfo)
>>> print(str(g_thread.lookup_comments())) # doctest: +ELLIPSIS
========================================
Subject: We need a simple description of how to u ...
Timestamp: 2017-07-19T22:26:51Z
----------
We need a simple description of how to use eyap.
========================================
Subject: Start with top-level README.md ...
Timestamp: 2017-07-19T22:22:56Z
----------
Start with top-level README.md
========================================
Subject: All done! ...
Timestamp: 2017-07-19T22:26:51Z
----------
All done!
Note that in the above, we only read from github since we did not
provide any username or password. If you had a username and token or
password, you could post comments to github as well.
Plesae do *NOT* post to above issue; use your own repo for tests. :)
Finally, we cleanup the file based backend since we don’t need it
anymore.
::
>>> shutil.rmtree(finfo['realm']) # Remove the directory to cleanup test.
>>> os.path.exists(finfo['realm']) # Verify we cleaned up.
False
Back ends
=========
We currently have the following back-ends available:
``file``: A simple file-based back-end. ``github``: Reading/writing
comments to github issues. ``redis``: Use redis to store comments. You
will have to install redis and redis-py (e.g., with
``pip install redis``) for this to work.
Pull requests are welcome to add more back-ends.
Raw data
{
"_id": null,
"home_page": "http://github.com/emin63/eyap",
"name": "eyap",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "comment management",
"author": "Emin Martinian",
"author_email": "emin.martinian@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/31/03/4943d7358046b9e235265df508c2166e213c90299a2d46ed3106724422f5/eyap-0.9.7.tar.gz",
"platform": null,
"description": "Introduction to eyap\n====================\n\nThe ``eyap`` package is an extended yapping and comment management\nsystem written in python. The basic goal is to provide a high-level\ncomment management system which can be used with various back-ends.\n\nQuick start\n===========\n\nThe following example is from\n```eyap/__init__.py`` <https://github.com/emin63/eyap/blob/master/eyap/__init__.py>`__:\n\nWith eyap, you can choose a backend to manage your comments. A key goal\nof the eyap package is that you can write your code in a generic way and\neasily switch the back-end. For example, you can use a simple file\nback-end with something like like the following:\n\n::\n\n\n >>> import eyap, tempfile, os, shutil # Import some things used for demo.\n >>> backend = 'file' # Use a simple file backend for demo.\n >>> finfo = {'owner': 'emin63', 'realm': tempfile.mkdtemp(), 'topic': 'test'}\n >>> comment_thread = eyap.Make.comment_thread('file', **finfo)\n >>> comment_thread.add_comment('Testing things', allow_create=True)\n >>> comment_thread.add_comment('is great!')\n\nThe code above will create a new comment thread and add a comment to it\nwhile also creating the thread if it does not exist. Later, you could\naccess the thread via something like:\n\n::\n\n >>> print(str(comment_thread.lookup_comments())) # doctest: +ELLIPSIS\n ========================================\n Subject: Testing things ...\n Timestamp: ...\n ----------\n Testing things\n ========================================\n Subject: is great! ...\n Timestamp: ...\n ----------\n is great!\n\nThe main reason for the existence of something like eyap is so that you\ncould use pretty much the same exact code with a different backend. For\nexample, using \u2018github\u2019 instead of \u2018file\u2019 and setting realm/owner to the\norganization/repo in github while providing a valid user/token for\ngithub access will post or read an issue from github.\n\n::\n\n\n >>> ginfo = {'owner': 'emin63', 'realm': 'eyap', 'topic': 'Describe usage'}\n >>> g_thread = eyap.Make.comment_thread('github', **ginfo)\n >>> print(str(g_thread.lookup_comments())) # doctest: +ELLIPSIS\n ========================================\n Subject: We need a simple description of how to u ...\n Timestamp: 2017-07-19T22:26:51Z\n ----------\n We need a simple description of how to use eyap.\n ========================================\n Subject: Start with top-level README.md ...\n Timestamp: 2017-07-19T22:22:56Z\n ----------\n Start with top-level README.md\n ========================================\n Subject: All done! ...\n Timestamp: 2017-07-19T22:26:51Z\n ----------\n All done!\n\nNote that in the above, we only read from github since we did not\nprovide any username or password. If you had a username and token or\npassword, you could post comments to github as well.\n\nPlesae do *NOT* post to above issue; use your own repo for tests. :)\n\nFinally, we cleanup the file based backend since we don\u2019t need it\nanymore.\n\n::\n\n\n >>> shutil.rmtree(finfo['realm']) # Remove the directory to cleanup test.\n >>> os.path.exists(finfo['realm']) # Verify we cleaned up.\n False\n\nBack ends\n=========\n\nWe currently have the following back-ends available:\n\n``file``: A simple file-based back-end. ``github``: Reading/writing\ncomments to github issues. ``redis``: Use redis to store comments. You\nwill have to install redis and redis-py (e.g., with\n``pip install redis``) for this to work.\n\nPull requests are welcome to add more back-ends.\n",
"bugtrack_url": null,
"license": "custom",
"summary": "Tools for extending yapping and comment management",
"version": "0.9.7",
"project_urls": {
"Homepage": "http://github.com/emin63/eyap"
},
"split_keywords": [
"comment",
"management"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "31034943d7358046b9e235265df508c2166e213c90299a2d46ed3106724422f5",
"md5": "361ba4a897b9892098404c3ae5332b23",
"sha256": "034251b94cb2b0cac067aa97649f0a151e8241c13fdfc6ece45eee61907e7864"
},
"downloads": -1,
"filename": "eyap-0.9.7.tar.gz",
"has_sig": false,
"md5_digest": "361ba4a897b9892098404c3ae5332b23",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 19581,
"upload_time": "2024-01-17T18:53:26",
"upload_time_iso_8601": "2024-01-17T18:53:26.389466Z",
"url": "https://files.pythonhosted.org/packages/31/03/4943d7358046b9e235265df508c2166e213c90299a2d46ed3106724422f5/eyap-0.9.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-17 18:53:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "emin63",
"github_project": "eyap",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "eyap"
}