{ "info": { "author": "Sean Redmond", "author_email": "github-smr@sneakemail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python" ], "description": "\n# Marcalyx\n\n[![PyPi Version](https://badge.fury.io/py/marcalyx.svg)][pypi]\n[![Build Status](http://img.shields.io/travis/seanredmond/marcalyx.svg)][travis]\n\n[travis]: http://travis-ci.org/seanredmond/marcalyx\n[pypi]: https://pypi.org/project/marcalyx\n\n\nSimple python interface for reading\n[MARC-XML](https://www.loc.gov/standards/marcxml/)\n\n\n## Installation\n\n pip install marcalyx\n\n## Usage\n\nImport the package\n\n >>> import marcalyx\n\nMarcalyx works on `xml.etree.ElementTree.Element` objects (or compatible), so\nyou will need to parse the XML before passing it to a Marcalyx object. For\ninstance, given a file containing a single ``:\n\n >>> import xml.etree.ElementTree as ET\n\nor, using `lxml`:\n\n >>> import lxml.etree as ET\n\nthen:\n\n >>> tree = ET.parse('tests/xml/1027474578.xml')\n >>> record_element = tree.getroot()\n >>> marc = marcalyx.Record(record_element)\n\nIf the XML contains a `` of Records you would instead create a `marcalyx.Collection` object, from which you can get the records:\n\n >>> coll = marcalyx.Collection(collection_element)\n >>> marc = coll.records()[0]\n\n## Fields\n\nOnce you have a record, you can access the fields by tag (always use the 3-character string, for example, \"001\", \"010\", \"100\"):\n\n >>> marc.field(\"245\")\n [245 10$aKindred /$cOctavia E. Butler.]\n\nOr, more simply:\n\n >>> marc[\"245\"]\n [245 10$aKindred /$cOctavia E. Butler.]\n\nFields are always returned as an array when accessed by tag (but not necessarily from the convenience methods, below). Fields are either a ControlField:\n\n >>> type(m[\"008\"][0])\n \n\nOr a DataField:\n\n >>> type(m[\"245\"][0])\n \n\nAll fields have a `tag` and a `value`:\n\n >>> m[\"008\"][0].tag\n '008'\n >>> m[\"245\"][0].tag\n '245'\n >>> m[\"008\"][0].value\n '180306r20141979xxk g 000 j eng d'\n >>> m[\"245\"][0].value\n 'Kindred / Octavia E. Butler.'\n\nData fields have their two \"indicators\":\n\n >>> m[\"245\"][0].ind1\n '1'\n >>> m[\"245\"][0].ind2\n '0'\n\nAnd subfields, which can be accessed via the `subfield()` method, which returns an array:\n\n >>> m[\"245\"][0].subfield('a')\n [$aKindred /]\n\nAs with fields, you can get subfields via subscript:\n\n >>> m[\"245\"][0]['a']\n [$aKindred /]\n\nYou can use a tuple containing a field tag and subfield code as a subscript to\nget a flat list of all the subfields with that code (if any) of all the fields\nwith that tag (if any):\n\n >>> m[('650','a')]\n [$aAfrican American women, $aTime travel]\n\n## `value` vs. `str`\n\nThe string representation of a field is formatted in the conventional way, showing the indicators and subfields:\n\n >>> str(m[\"245\"][0])\n '245 10$aKindred /$cOctavia E. Butler.'\n\nThe `value` is formatted for display:\n\n >>> m[\"245\"][0].value\n 'Kindred / Octavia E. Butler.'\n\n## Subfields\n\nSubfields have codes, values, and string representations:\n\n >>> m[\"245\"][0].subfield(\"a\")[0].code\n 'a'\n >>> m[\"245\"][0].subfield(\"a\")[0].value\n 'Kindred /'\n >>> str(m[\"245\"][0].subfield(\"a\")[0])\n '$aKindred /'\n\n## Convenience methods\n\nThere are several methods to make it easier to get single fields or categories\nof fields. `mainEntry()` will return whichever of the 1XX fields the record has\n(as a `DataField`, not an array):\n\n >>> m.mainEntry()\n 100 1#$aButler, Octavia Estelle$d(1947-2006).$4aut\n\n`#titleStatement` gets the 245 field (again, as a `DataField` and not an array):\n\n >>> m.titleStatement()\n 245 10$aKindred /$cOctavia E. Butler.\n\nThere are also methods to get an array of each of the main categories of\nfields. Each of these returns an array of all the fields in the record of the\ngiven category:\n\n >>> marc.controlFields() # 00X\n >>> marc.codes() # 01X-09X\n >>> marc.titles() # 20X-24X\n >>> marc.edition() # 25X-28X\n >>> marc.description() # 3XX\n >>> marc.series() # 4XX\n >>> marc.notes() # 5XX\n >>> marc.subjects() # 6XX\n >>> marc.addedEntries() # 70X-75X\n >>> marc.linking() # 76X-78X\n >>> marc.seriesAdded() # 80X-83X\n >>> marc.holdings() # 841-88X\n\nSome common numbers have convenience methods:\n\n > record.lccn # 010$a, String or nil\n > record.isbns # 020$a, Array of Strings, or []\n > record.issns # 022$a, Array of Strings, or []\n\n## Leader\n\nYou can get the record leader:\n\n >>> marc.leader\n '00000cam a2200000Mi 4500'\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/seanredmond/marcalyx. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the Lccnorm project\u2019s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/seanredmond/marcalyx/blob/master/CODE_OF_CONDUCT.md).\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/seanredmond/marcalyx", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "marcalyx", "package_url": "https://pypi.org/project/marcalyx/", "platform": "", "project_url": "https://pypi.org/project/marcalyx/", "project_urls": { "Homepage": "https://github.com/seanredmond/marcalyx" }, "release_url": "https://pypi.org/project/marcalyx/1.0.2/", "requires_dist": [ "pytest ; extra == 'dev'" ], "requires_python": ">=2.7.0", "summary": "Simple python interface for reading MARC-XML", "version": "1.0.2" }, "last_serial": 4966465, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "24190ea55c56dea867c212d5ab725fb5", "sha256": "bf9bd06dc9d5f4119684dea17dd9f66e6363e21a1e1e2a443b4af995b9896ca9" }, "downloads": -1, "filename": "marcalyx-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "24190ea55c56dea867c212d5ab725fb5", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7.0", "size": 5220, "upload_time": "2018-11-27T04:51:08", "url": "https://files.pythonhosted.org/packages/16/53/c3696ae0ee9fcaf08e452e932ff0abc8fd67ac62fb24fb334f493c774b50/marcalyx-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ee6348139bb0920bf0bacd08e8d3ec94", "sha256": "ae9a3b0d1e84120c25bf63e027b2f2e88dcb377a71460cebca211d27d240fcdc" }, "downloads": -1, "filename": "marcalyx-1.0.0.tar.gz", "has_sig": false, "md5_digest": "ee6348139bb0920bf0bacd08e8d3ec94", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7.0", "size": 6075, "upload_time": "2018-11-27T04:51:10", "url": "https://files.pythonhosted.org/packages/8f/c7/e3fc7ae3f9892e98a5687a008975d10bbe3fbf3d9f584ef914bf9782a409/marcalyx-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "4e3084649006c2ff41c5a57b1d7ccb46", "sha256": "5b144cbf90f5eaaaf5f6c48b43c171a0a8579c2804647005e6d68a8d630dee23" }, "downloads": -1, "filename": "marcalyx-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "4e3084649006c2ff41c5a57b1d7ccb46", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7.0", "size": 5252, "upload_time": "2019-03-16T16:22:08", "url": "https://files.pythonhosted.org/packages/ae/3b/7fa10111f4930fc844b5f72f53bd75b48d0e9b440da948e72c1c9807fd57/marcalyx-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3489adec42a3847ec5ce2b5024e4a26d", "sha256": "6be2b458170255de466841f71ec44f70226e5ddd7be07c71472d67821864286b" }, "downloads": -1, "filename": "marcalyx-1.0.1.tar.gz", "has_sig": false, "md5_digest": "3489adec42a3847ec5ce2b5024e4a26d", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7.0", "size": 6125, "upload_time": "2019-03-16T16:22:10", "url": "https://files.pythonhosted.org/packages/5a/37/b8c5d18fdc87faf16c0fdc39205de1c288af6d5538ae1800dd4482039bcf/marcalyx-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "39563800371792603ead93e92b978217", "sha256": "226086dda558bd2c15e071de92874e42b3bb06d31bc05c93689c3ec6147f5520" }, "downloads": -1, "filename": "marcalyx-1.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "39563800371792603ead93e92b978217", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7.0", "size": 5440, "upload_time": "2019-03-21T03:45:05", "url": "https://files.pythonhosted.org/packages/19/a5/9d0906d19468eaa19cc39a8b9f418848899d40a93318ec9484600366797d/marcalyx-1.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "485254d0bf881af41dd056718797d0ed", "sha256": "fef670cc6e55ab75466d7b4198e0f2dc72746415d8101c24a10224161fc04671" }, "downloads": -1, "filename": "marcalyx-1.0.2.tar.gz", "has_sig": false, "md5_digest": "485254d0bf881af41dd056718797d0ed", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7.0", "size": 6395, "upload_time": "2019-03-21T03:45:06", "url": "https://files.pythonhosted.org/packages/38/ff/dc4bc75528414569dc2e1ceb629c1b977b0f4420474b6c1b00ada7b629dd/marcalyx-1.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "39563800371792603ead93e92b978217", "sha256": "226086dda558bd2c15e071de92874e42b3bb06d31bc05c93689c3ec6147f5520" }, "downloads": -1, "filename": "marcalyx-1.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "39563800371792603ead93e92b978217", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7.0", "size": 5440, "upload_time": "2019-03-21T03:45:05", "url": "https://files.pythonhosted.org/packages/19/a5/9d0906d19468eaa19cc39a8b9f418848899d40a93318ec9484600366797d/marcalyx-1.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "485254d0bf881af41dd056718797d0ed", "sha256": "fef670cc6e55ab75466d7b4198e0f2dc72746415d8101c24a10224161fc04671" }, "downloads": -1, "filename": "marcalyx-1.0.2.tar.gz", "has_sig": false, "md5_digest": "485254d0bf881af41dd056718797d0ed", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7.0", "size": 6395, "upload_time": "2019-03-21T03:45:06", "url": "https://files.pythonhosted.org/packages/38/ff/dc4bc75528414569dc2e1ceb629c1b977b0f4420474b6c1b00ada7b629dd/marcalyx-1.0.2.tar.gz" } ] }