{ "info": { "author": "Lu\u00eds Maia", "author_email": "luis.maia@xfel.eu", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Environment :: Web Environment", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Scientific/Engineering :: Information Analysis", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Metadata Catalogue Client\n=========================\n\nMyMdC is the Web App design for Data Management at European XFEL.\n\nThis library (metadata_client) is a client for the RESTful APIs exposed\nby the European XFEL Metadata Catalogue Web Application - myMdC\n(https://in.xfel.eu/metadata).\n\n*Repository:*\n\n- https://git.xfel.eu/gitlab/ITDM/metadata_client\n\n*Dependencies:*\n\n- oauthlib (https://pypi.python.org/pypi/oauthlib)\n- requests (https://github.com/kennethreitz/requests)\n- requests-oauthlib (https://github.com/requests/requests-oauthlib)\n- oauth2_xfel_client (https://git.xfel.eu/gitlab/ITDM/oauth2_xfel_client)\n\n\nInstallation\n------------\n\nPython project\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\n1. Install requirements, if never done before\n\n 1.1. For OS X distributions::\n\n sudo port install python35\n sudo port\n\n sudo port select --set python3 python35\n\n sudo port install py35-pip\n sudo port select --set pip pip35\n\n sudo port install py35-nose\n sudo port select --set nosetests nosetests-3.5\n\n pip install pycodestyle\n\n 1.2. For Linux distributions::\n\n sudo apt-get update\n sudo apt-get install python3.5\n\n\n2. Make metadata_client library available in your python environment\n\n 2.1. Install it via pip::\n\n # Install dependencies from local wheels files\n pip install --no-index --upgrade --find-links ./external_dependencies/*\n\n # Install dependencies from the pypi\n pip install -r requirements.txt\n\n Or as a normal python project (via .egg file)::\n\n python setup.py install\n python setup.py install --user\n\n Running this command the \"compiled\" `metadata_client-3.0.3-py3.4.egg` file\n is generated under the current Python installation site-packages folder.\n\n or. Install it as a normal python project (via Wheel)::\n\n python setup.py bdist_wheel\n\n Running this command 2 folders are generated under the current Python\n installation site-packages folder:\n\n - `metadata_client` with the sources;\n - `metadata_client-3.0.3.dist-info/` with Wheels configuration files.\n\n3. To identify your Python site-packages folder run::\n\n python -c \"from distutils.sysconfig import get_python_lib; print(get_python_lib())\"\n\n\nUsage\n-----\n\nTo use this project you need to import it.\n\nIf you want interact directly with API methods you should import `MetadataClientApi` class::\n\n from metadata_client.metadata_client_api import MetadataClientApi\n\nIf you want interact with Model classes you should import `MetadataClient` class::\n\n from metadata_client.metadata_client import MetadataClient\n\nOr import everything::\n\n import metadata_client\n\n1. Connection to the MdC (Metadata Catalog)::\n\n from metadata_client.metadata_client import MetadataClient\n\n # Necessary configuration variables to establish a connection\n user_id = '201ed15ff071a63e76cb0b91a1ab17b36d5f92d24b6df4497aa646e39c46a324'\n user_secret = 'a8ae80f5e96531f19bf2d2b6102f5a537196aca44a673ad36533310e07529757'\n user_email = 'luis.maia@xfel.eu'\n #\n metadata_web_app_url = 'https://in.xfel.eu/dev_metadata'\n token_url = 'https://in.xfel.eu/dev_metadata/oauth/token'\n refresh_url = 'https://in.xfel.eu/dev_metadata/oauth/token'\n auth_url = 'https://in.xfel.eu/dev_metadata/oauth/authorize'\n scope = ''\n base_api_url = 'https://in.xfel.eu/dev_metadata/api/'\n\n # Generate the connection\n client_conn = MetadataClient(client_id=user_id,\n client_secret=user_secret,\n user_email=user_email,\n token_url=token_url,\n refresh_url=refresh_url,\n auth_url=auth_url,\n scope=scope,\n base_api_url=base_api_url)\n\n2. Interaction with the MdC (Metadata Catalog):\n\n 2.1 Example data_group_types::\n\n all_group_types = MetadataClient.get_all_data_group_types(client_conn)\n\n all_group_types\n # >>> {'success': True,\n # 'data': [{'description': '', 'identifier': 'RAW', 'name': 'Raw', 'flg_available': True, 'id': 1},\n # {'description': '', 'identifier': 'CAL', 'name': 'Calibration', 'flg_available': True, 'id': 2},\n # {'description': '', 'identifier': 'PROC', 'name': 'Processed', 'flg_available': True, 'id': 3},\n # {'description': '', 'identifier': 'REDU', 'name': 'Reduced', 'flg_available': True, 'id': 4},\n # {'description': '', 'identifier': 'SIM', 'name': 'Simulation', 'flg_available': True, 'id': 5},\n # {'description': '', 'identifier': 'UNK', 'name': 'Unknown', 'flg_available': True, 'id': 6}],\n # 'app_info': {},\n # 'info': 'Got data_group_type successfully'}\n\n all_group_types['success']\n # >>> True\n\n all_group_types['data'][0]\n # >>> {'description': '', 'identifier': 'RAW', 'name': 'Raw', 'flg_available': True, 'id': 1}\n\n all_group_types['data'][0]['name']\n # >>> 'Raw'\n\n 2.2 Example instruments::\n\n all_xfel_instruments = MetadataClient.get_all_xfel_instruments(client_conn)\n\n >>> for instrument in all_xfel_instruments['data']:\n ... print('id = {0} | name = {1}'.format(instrument['id'], instrument['name']))\n ...\n # id = -1 | name = test-instrument\n # id = 1 | name = SPB/SFX SASE1\n # id = 2 | name = FXE SASE1\n # id = 3 | name = SQS SASE3\n # id = 4 | name = SCS SASE3\n # id = 5 | name = MID SASE2\n # id = 6 | name = HED SASE2\n # id = 7 | name = Hera South Detector Test Stand\n # id = 8 | name = SASE1 Test Stand\n # id = 9 | name = SASE2 Test Stand\n # id = 10 | name = SASE3 Test Stand\n\n 2.3 Get instrument active proposal::\n\n active_proposal = MetadataClient.get_active_proposal_by_instrument(client_conn, 1)\n\n 2.4 Register Run replica::\n\n # (e.g. proposal_number == 1234)\n # (e.g. proposal_number == 12)\n # (e.g. repository_identifier == 'XFEL_GPFS_OFFLINE_RAW_CC')\n\n resp = MetadataClient.register_run_replica(client_conn,\n proposal_number,\n run_number,\n repository_identifier)\n # resp = {'success': True,\n # 'info': 'Run replica registered successfully',\n # 'data': {'experiment_id': '-1',\n # 'sample_id': '-1',\n # 'run_id': '1588',\n # 'data_group_id': '777'},\n # 'app_info': {}}\n\n 2.5 Unregister Run replica::\n\n # (e.g. proposal_number == 1234)\n # (e.g. proposal_number == 12)\n # (e.g. repository_identifier == 'XFEL_GPFS_OFFLINE_RAW_CC')\n\n resp = MetadataClient.unregister_run_replica(client_conn,\n proposal_number,\n run_number,\n repository_identifier)\n # resp = {'success': True,\n # 'info': 'Run replica unregistered successfully',\n # 'data': {'data_group_id': '-1',\n # 'repository_id': '1',\n # 'flg_available': 'false'},\n # 'app_info': {}}\n\nFor additional examples, please take a look in the tests/ folder.\n\n\nDevelopment & Testing\n---------------------\n\nWhen developing, and before commit changes, please validate that:\n\n1. All tests continue passing successfully (to validate that run *nosetests*)::\n\n # Go to the source code directory\n cd metadata_client\n\n # Run all tests\n nosetests .\n\n # Run all tests and get information about coverage for all files inside metadata_client package\n pip install python-dateutil\n pip install nose-cov\n nosetests --with-cov --cover-erase --cover-inclusive --cov-report term-missing --cov metadata_client\n\n # Run all tests with xunit\n nosetests --where=./metadata_client/ --with-xunit --xunit-file=pythonTest.xml\n\n # If you don't want use nosetests you can simply run the test class\n python metadata_client/tests/metadata_client_test.py\n\n2. Code keeps respecting pycodestyle code conventions (to validate that run **pycodestyle**)::\n\n pycodestyle .\n\n3. To generate all the wheels files for the dependencies, execute::\n\n # Generate Wheels to its dependencies\n pip wheel --wheel-dir=./external_dependencies -r requirements.txt\n pip wheel --wheel-dir=./external_dependencies --find-links=./external_dependencies -r requirements.txt\n\n # Generate Wheels to itself and dependencies\n pip wheel --wheel-dir=./external_dependencies .\n pip wheel --wheel-dir=./external_dependencies --find-links=./external_dependencies .\n\nGuarantee that you have the desired versions in requirements.txt and setup.py files.\n\n\nRegistering library on https://pypi.org\n---------------------------------------\n\nTo register this python library, the following steps are necessary::\n\n # Install twine\n python -m pip install --upgrade twine\n\n # Generates egg file in the dist/ folder\n python setup.py install\n\n # Upload new version .egg and .whl files\n twine upload dist/*\n twine upload metadata_client-3.0.3-py3-none-any.whl\n\n # In case a teste is necessary, it is possible to test it against test.pypi.org\n twine upload --repository-url https://test.pypi.org/legacy/ dist/* --verbose", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://git.xfel.eu/gitlab/ITDM/metadata_client", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "metadata-client", "package_url": "https://pypi.org/project/metadata-client/", "platform": "any", "project_url": "https://pypi.org/project/metadata-client/", "project_urls": { "Homepage": "https://git.xfel.eu/gitlab/ITDM/metadata_client" }, "release_url": "https://pypi.org/project/metadata-client/3.0.3/", "requires_dist": null, "requires_python": "", "summary": "Python Client for European XFEL Metadata Catalogue Web App available at https://in.xfel.eu/metadata", "version": "3.0.3" }, "last_serial": 5717633, "releases": { "3.0.2": [ { "comment_text": "", "digests": { "md5": "c48ed4782d48e82edf6f2107ed75ce4f", "sha256": "23442d186ab586a280867d9bf2607cdb6d97b54cbc0a30820d6f62179bec8917" }, "downloads": -1, "filename": "metadata_client-3.0.2-py3.6.egg", "has_sig": false, "md5_digest": "c48ed4782d48e82edf6f2107ed75ce4f", "packagetype": "bdist_egg", "python_version": "3.6", "requires_python": null, "size": 239529, "upload_time": "2019-08-21T22:19:18", "url": "https://files.pythonhosted.org/packages/14/76/10ff4b533509886f35bd073f3afaa30f574c2008079a3f0c42275a22e52f/metadata_client-3.0.2-py3.6.egg" }, { "comment_text": "", "digests": { "md5": "a6765f112f84d96ca7619bbca4767f63", "sha256": "863992ae88eed4f14f27a956856969bd8711fe09f77d749f481a389820f61d7a" }, "downloads": -1, "filename": "metadata_client-3.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "a6765f112f84d96ca7619bbca4767f63", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 106793, "upload_time": "2019-08-22T20:59:06", "url": "https://files.pythonhosted.org/packages/f2/5d/1ba3b3efa71e7a23d096e6de1ab6b5230ef8b77fa3e363a42c7a62e82023/metadata_client-3.0.2-py3-none-any.whl" } ], "3.0.3": [ { "comment_text": "", "digests": { "md5": "50fc8bef1445bd314c4f768d9c83fa22", "sha256": "fa6fc6b5adef9374426b8adcf647e82210f87b260e9b9c047a721410c7f59b54" }, "downloads": -1, "filename": "metadata_client-3.0.3-py3.6.egg", "has_sig": false, "md5_digest": "50fc8bef1445bd314c4f768d9c83fa22", "packagetype": "bdist_egg", "python_version": "3.6", "requires_python": null, "size": 239450, "upload_time": "2019-08-22T22:08:52", "url": "https://files.pythonhosted.org/packages/e7/04/1d28ccca6cfeea40249b4530e3685f419fda5ffcb9d375fca0339f79ed81/metadata_client-3.0.3-py3.6.egg" }, { "comment_text": "", "digests": { "md5": "aca4ac8dff916d0d666daf3ae80a7c0d", "sha256": "a9926a27995de33864f3ea048f677f855a95ef71da4670e625b8e76b84eb6e85" }, "downloads": -1, "filename": "metadata_client-3.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "aca4ac8dff916d0d666daf3ae80a7c0d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 106796, "upload_time": "2019-08-22T22:09:20", "url": "https://files.pythonhosted.org/packages/60/89/571c8bf242d26a622d180b30e52ac011f974a310dcc8ecf0cc522ce691f9/metadata_client-3.0.3-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "50fc8bef1445bd314c4f768d9c83fa22", "sha256": "fa6fc6b5adef9374426b8adcf647e82210f87b260e9b9c047a721410c7f59b54" }, "downloads": -1, "filename": "metadata_client-3.0.3-py3.6.egg", "has_sig": false, "md5_digest": "50fc8bef1445bd314c4f768d9c83fa22", "packagetype": "bdist_egg", "python_version": "3.6", "requires_python": null, "size": 239450, "upload_time": "2019-08-22T22:08:52", "url": "https://files.pythonhosted.org/packages/e7/04/1d28ccca6cfeea40249b4530e3685f419fda5ffcb9d375fca0339f79ed81/metadata_client-3.0.3-py3.6.egg" }, { "comment_text": "", "digests": { "md5": "aca4ac8dff916d0d666daf3ae80a7c0d", "sha256": "a9926a27995de33864f3ea048f677f855a95ef71da4670e625b8e76b84eb6e85" }, "downloads": -1, "filename": "metadata_client-3.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "aca4ac8dff916d0d666daf3ae80a7c0d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 106796, "upload_time": "2019-08-22T22:09:20", "url": "https://files.pythonhosted.org/packages/60/89/571c8bf242d26a622d180b30e52ac011f974a310dcc8ecf0cc522ce691f9/metadata_client-3.0.3-py3-none-any.whl" } ] }