{ "info": { "author": "Peter Odding", "author_email": "peter@peterodding.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: Information Technology", "Intended Audience :: System Administrators", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Text Processing", "Topic :: Text Processing :: Indexing" ], "description": "gentag: Simple and powerful tagging for Python objects\n======================================================\n\n.. image:: https://travis-ci.org/xolox/python-gentag.svg?branch=master\n :target: https://travis-ci.org/xolox/python-gentag\n\n.. image:: https://coveralls.io/repos/xolox/python-gentag/badge.svg?branch=master\n :target: https://coveralls.io/r/xolox/python-gentag?branch=master\n\nThe Python package `gentag` provides simple and powerful tagging for arbitrary\nPython objects. After defining your tags and associated objects you can query\nfor the difference, intersection and union of tags to select specific objects.\nThe package is currently tested on cPython 2.6, 2.7, 3.4, 3.5, 3.6 and PyPy\n(2.7).\n\n.. contents::\n :local:\n\nStatus\n------\n\nWhile the ideas behind `gentag` have been floating around in my head since\n2012 I didn't publish this as a standalone Python package until 2018 which\nexplains why I'm publishing the initial version as a beta. Looking ahead\ntowards the future:\n\n- It may be that the current version serves my needs fine and at some point I\n decide to replace the 'beta' label with a 'stable' label without making any\n substantive changes.\n\n- Releasing `gentag` is one step in the direction of releasing another Python\n package that I've been thinking about for a very long time now and if I turn\n out to have trouble integrating `gentag` into that package I won't hesitate\n to make (potentially major) changes to `gentag`.\n\nInstallation\n------------\n\nThe `gentag` package is available on PyPI_ which means installation should be\nas simple as:\n\n.. code-block:: sh\n\n $ pip install gentag\n\nThere's actually a multitude of ways to install Python packages (e.g. the `per\nuser site-packages directory`_, `virtual environments`_ or just installing\nsystem wide) and I have no intention of getting into that discussion here, so\nif this intimidates you then read up on your options before returning to these\ninstructions ;-).\n\n.. _usage:\n\nUsage\n-----\n\nThe following sections give an overview of how to get started. For more details\nabout the Python API please refer to the API documentation available on `Read\nthe Docs`_.\n\n.. contents::\n :local:\n\nCreating a scope\n~~~~~~~~~~~~~~~~\n\nTo get started you have to create a Scope_ object:\n\n.. code-block:: python\n\n >>> from gentag import Scope\n >>> tags = Scope()\n\nThe purpose of Scope_ objects is to group together related tags into an\nevaluation context for tag expressions.\n\nDefining tags\n~~~~~~~~~~~~~\n\nScope_ instances allow you to define tags and associated objects:\n\n.. code-block:: python\n\n >>> tags.define('archiving', ['deb', 'tar', 'zip'])\n >>> tags.define('compression', ['bzip2', 'deb', 'gzip', 'lzma', 'zip'])\n >>> tags.define('encryption', ['gpg', 'luks', 'zip'])\n\n.. _querying tags:\n\nQuerying tags\n~~~~~~~~~~~~~\n\nOnce you've defined some tags and associated objects you can query them,\nfor example here we query for the union of two tags:\n\n.. code-block:: python\n\n >>> tags.evaluate('archiving | encryption')\n ['deb', 'gpg', 'luks', 'tar', 'zip']\n\nThese tag expressions can get arbitrarily complex:\n\n.. code-block:: python\n\n >>> tags.evaluate('(archiving | encryption) & compression')\n ['deb', 'zip']\n\nSupported operators\n+++++++++++++++++++\n\nThe following operators can be used to compose tags:\n\n======== ====================\nOperator Set operation\n======== ====================\n``&`` intersection\n``|`` union\n``-`` difference\n``^`` symmetric difference\n======== ====================\n\nThese operators create new Tag_ objects that can be composed further. Although\ntags composed at runtime in Python syntax don't have a name, it is possible\ndefine named composite tags using the `Scope.define()`_ method (see below).\n\nThe default tag\n+++++++++++++++\n\nThere's one special tag that is always available under the name 'all'. As you\nmight have guessed it provides access to a set with all tagged objects:\n\n.. code-block:: python\n\n >>> tags.evaluate('all')\n ['bzip2', 'deb', 'gpg', 'gzip', 'luks', 'lzma', 'tar', 'zip']\n\nThis can be useful to select all but a specific tag of objects:\n\n.. code-block:: python\n\n >>> tags.evaluate('all - encryption')\n ['bzip2', 'deb', 'gzip', 'lzma', 'tar']\n\nNamed composite tags\n~~~~~~~~~~~~~~~~~~~~\n\nThe expressions shown in the `querying tags`_ section above demonstrate that\ntags can be composed using set operators. You can also define a named tag based\non an expression:\n\n.. code-block:: python\n\n >>> tags.define('flexible', 'archiving & compression & encryption')\n\nSuch named composite tags can be evaluated like regular tags:\n\n.. code-block:: python\n\n >>> tags.evaluate('flexible')\n ['zip']\n\nYou can also nest composite tags inside other composite tags.\n\nHistory\n-------\n\nThe example in the usage_ section isn't actually very useful, this is partly\nbecause I didn't want a complicated subject matter to distract readers from\nusage instructions :-).\n\nThe actual use case that triggered the ideas behind `gentag` presented itself\nto me in 2012 when I wanted to query a database of more than 200 Linux server\nnames categorized by aspects such as:\n\n- The distributor id (a string like 'debian' or 'ubuntu').\n- The distribution codename (a string like 'trusty' or 'xenial').\n- The server's role (database, mailserver, webserver, etc).\n- The server's environment (production, development).\n\nThe easy selection of subsets of servers for my Python programs to operate on\nquickly evolved into my main interface for selecting groups of servers. Since\nthen I've wanted to use similar functionality in other places, but found it too\nmuch work to develop one-off solutions. This is how `gentag` was born.\n\nAbout the name\n~~~~~~~~~~~~~~\n\nThe name `gentag` stands for \"generative tags\", because the package allows new\ntags to be composed (generated) from existing tags. I'd like to thank my\ncolleague `Se\u00e1n Murphy `_ for coming up with\nthis name :-).\n\nContact\n-------\n\nThe latest version of `gentag` is available on PyPI_ and GitHub_. The\ndocumentation is hosted on `Read the Docs`_. For bug reports please create an\nissue on GitHub_. If you have questions, suggestions, etc. feel free to send me\nan e-mail at `peter@peterodding.com`_.\n\nLicense\n-------\n\nThis software is licensed under the `MIT license`_.\n\n\u00a9 2018 Peter Odding.\n\n.. External references:\n.. _GitHub: https://github.com/xolox/python-gentag\n.. _MIT license: http://en.wikipedia.org/wiki/MIT_License\n.. _per user site-packages directory: https://www.python.org/dev/peps/pep-0370/\n.. _peter@peterodding.com: peter@peterodding.com\n.. _PyPI: https://pypi.python.org/pypi/gentag\n.. _Python: https://www.python.org/\n.. _Read the Docs: https://gentag.readthedocs.org/en/latest/\n.. _Scope.define(): https://gentag.readthedocs.org/en/latest/#gentag.Scope.define\n.. _Scope: https://gentag.readthedocs.org/en/latest/#gentag.Scope\n.. _Tag: https://gentag.readthedocs.org/en/latest/#gentag.Tag\n.. _virtual environments: http://docs.python-guide.org/en/latest/dev/virtualenvs/\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/xolox/python-gentag", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "gentag", "package_url": "https://pypi.org/project/gentag/", "platform": "", "project_url": "https://pypi.org/project/gentag/", "project_urls": { "Homepage": "https://github.com/xolox/python-gentag" }, "release_url": "https://pypi.org/project/gentag/2.0/", "requires_dist": [ "humanfriendly (>=4.8)", "naturalsort (>=1.5.1)", "property-manager (>=2.2)", "six (>=1.11.0)", "verboselogs (>=1.7)" ], "requires_python": "", "summary": "Simple and powerful tagging for Python objects.", "version": "2.0" }, "last_serial": 3659114, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "95cfa7b39d6eac8b18f93a5b667302e0", "sha256": "1046c47b8ab5a84107a118743907c1358db893639288eb0b4a068c3b831588ea" }, "downloads": -1, "filename": "gentag-1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "95cfa7b39d6eac8b18f93a5b667302e0", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 14583, "upload_time": "2018-03-04T21:02:00", "url": "https://files.pythonhosted.org/packages/cc/d0/c5a2115eedb5303b78c4dac4f6b3fe9174c74b460dd2965243448d812e34/gentag-1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fc53945d9b8f46569fa9c5766d37c685", "sha256": "cc2d79793087acd24254a473635ef56097cbe76f7909cd39304befa47e91e48f" }, "downloads": -1, "filename": "gentag-1.0.tar.gz", "has_sig": false, "md5_digest": "fc53945d9b8f46569fa9c5766d37c685", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12020, "upload_time": "2018-03-04T21:02:02", "url": "https://files.pythonhosted.org/packages/e4/ba/5da827fc8c0eb9aa37798135bd2ed24a35193158483e7b4268431f1215b7/gentag-1.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "b97df79a6061920e50881c126ff145cc", "sha256": "be8cf9207f579c41f8877ed6826191e44517541f2ae6a586dc9e410cadcf98c1" }, "downloads": -1, "filename": "gentag-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b97df79a6061920e50881c126ff145cc", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 14614, "upload_time": "2018-03-04T21:25:27", "url": "https://files.pythonhosted.org/packages/0d/83/a1ca6164029f39cfce446e9573bac8bbbb8b1555231d8c863d123678d3fc/gentag-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3d8edfc81692b03679800eb2487c23cd", "sha256": "187394fdaf991e1f3f9b8de0573eb9a440b369c7796751612e5d700ac3403a01" }, "downloads": -1, "filename": "gentag-1.0.1.tar.gz", "has_sig": false, "md5_digest": "3d8edfc81692b03679800eb2487c23cd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13020, "upload_time": "2018-03-04T21:25:29", "url": "https://files.pythonhosted.org/packages/23/04/91213c629dff3b31bd3165ea25d07fd41e6d12b3e94f11060bc731715835/gentag-1.0.1.tar.gz" } ], "2.0": [ { "comment_text": "", "digests": { "md5": "77d12c70db5c435ee8e91d9cc6a99312", "sha256": "1a2359870bed274069e5f57b29685fa5acd792d13f09137709eadd05692ce00b" }, "downloads": -1, "filename": "gentag-2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "77d12c70db5c435ee8e91d9cc6a99312", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 14699, "upload_time": "2018-03-11T14:51:57", "url": "https://files.pythonhosted.org/packages/86/14/1f7524a1ad08fdf79bee0679717f52d169cc042621eb48f66b652dcf6a96/gentag-2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8c88fb5596ae461b70d6fd7ed0c609ee", "sha256": "0dbb197148d71a1dab604e8ce38097b2a4edd4f2489ffab50146b7b5ac562278" }, "downloads": -1, "filename": "gentag-2.0.tar.gz", "has_sig": false, "md5_digest": "8c88fb5596ae461b70d6fd7ed0c609ee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13108, "upload_time": "2018-03-11T14:51:59", "url": "https://files.pythonhosted.org/packages/75/9e/4605a6b4b06cb3051f0dc3e46933a8418ff71e30aef376bd8dad90e4dada/gentag-2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "77d12c70db5c435ee8e91d9cc6a99312", "sha256": "1a2359870bed274069e5f57b29685fa5acd792d13f09137709eadd05692ce00b" }, "downloads": -1, "filename": "gentag-2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "77d12c70db5c435ee8e91d9cc6a99312", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 14699, "upload_time": "2018-03-11T14:51:57", "url": "https://files.pythonhosted.org/packages/86/14/1f7524a1ad08fdf79bee0679717f52d169cc042621eb48f66b652dcf6a96/gentag-2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8c88fb5596ae461b70d6fd7ed0c609ee", "sha256": "0dbb197148d71a1dab604e8ce38097b2a4edd4f2489ffab50146b7b5ac562278" }, "downloads": -1, "filename": "gentag-2.0.tar.gz", "has_sig": false, "md5_digest": "8c88fb5596ae461b70d6fd7ed0c609ee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13108, "upload_time": "2018-03-11T14:51:59", "url": "https://files.pythonhosted.org/packages/75/9e/4605a6b4b06cb3051f0dc3e46933a8418ff71e30aef376bd8dad90e4dada/gentag-2.0.tar.gz" } ] }