From 2888327e9edca05d50bc6d71bf68166ee0fabcfe Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 13 Nov 2018 12:28:20 -0800 Subject: more python client library tomfoolery --- python/.gitignore | 1 + python/README.md | 2 +- python/README_client.md | 1 + python/README_codegen.md | 148 ---------------------------------------- python/codegen_python_client.sh | 6 +- python/conftest.py | 3 + python/fatcat_client/README.md | 148 ++++++++++++++++++++++++++++++++++++++++ python/pytest.ini | 2 + python/setup.py | 10 +-- python/tox.ini | 8 +++ 10 files changed, 173 insertions(+), 156 deletions(-) create mode 120000 python/README_client.md delete mode 100644 python/README_codegen.md create mode 100644 python/conftest.py create mode 100644 python/fatcat_client/README.md create mode 100644 python/tox.ini diff --git a/python/.gitignore b/python/.gitignore index 286019ee..e2dae299 100644 --- a/python/.gitignore +++ b/python/.gitignore @@ -1,5 +1,6 @@ codegen-out/ build/ +dist/ *.egg-info *.json.gz !.coveragerc diff --git a/python/README.md b/python/README.md index 9ba6b990..8f252512 100644 --- a/python/README.md +++ b/python/README.md @@ -17,7 +17,7 @@ server on the same machine by default), use: An auto-generated python client library for the fatcat API lives under `./fatcat_client`. It includes entity model objects and functions to call all -API endpoints; see `./README_codegen.md` for details. +API endpoints; see `./README_client.md` for details. To re-generate swagger-codegen python client library (requires docker installed locally): diff --git a/python/README_client.md b/python/README_client.md new file mode 120000 index 00000000..192bd0de --- /dev/null +++ b/python/README_client.md @@ -0,0 +1 @@ +fatcat_client/README.md \ No newline at end of file diff --git a/python/README_codegen.md b/python/README_codegen.md deleted file mode 100644 index 0d072dde..00000000 --- a/python/README_codegen.md +++ /dev/null @@ -1,148 +0,0 @@ -# fatcat-client -A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata - -This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: - -- API version: 0.1.0 -- Package version: 1.0.0 -- Build package: io.swagger.codegen.languages.PythonClientCodegen - -## Requirements. - -Python 2.7 and 3.4+ - -## Installation & Usage -### pip install - -If the python package is hosted on Github, you can install directly from Github - -```sh -pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git -``` -(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`) - -Then import the package: -```python -import fatcat_client -``` - -### Setuptools - -Install via [Setuptools](http://pypi.python.org/pypi/setuptools). - -```sh -python setup.py install --user -``` -(or `sudo python setup.py install` to install the package for all users) - -Then import the package: -```python -import fatcat_client -``` - -## Getting Started - -Please follow the [installation procedure](#installation--usage) and then run the following: - -```python -from __future__ import print_function -import time -import fatcat_client -from fatcat_client.rest import ApiException -from pprint import pprint -# create an instance of the API class -api_instance = fatcat_client.DefaultApi() -id = 'id_example' # str | base32-encoded unique identifier - -try: - api_response = api_instance.accept_editgroup(id) - pprint(api_response) -except ApiException as e: - print("Exception when calling DefaultApi->accept_editgroup: %s\n" % e) - -``` - -## Documentation for API Endpoints - -All URIs are relative to *http://localhost/v0* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -*DefaultApi* | [**accept_editgroup**](docs/DefaultApi.md#accept_editgroup) | **POST** /editgroup/{id}/accept | -*DefaultApi* | [**create_container**](docs/DefaultApi.md#create_container) | **POST** /container | -*DefaultApi* | [**create_container_batch**](docs/DefaultApi.md#create_container_batch) | **POST** /container/batch | -*DefaultApi* | [**create_creator**](docs/DefaultApi.md#create_creator) | **POST** /creator | -*DefaultApi* | [**create_creator_batch**](docs/DefaultApi.md#create_creator_batch) | **POST** /creator/batch | -*DefaultApi* | [**create_editgroup**](docs/DefaultApi.md#create_editgroup) | **POST** /editgroup | -*DefaultApi* | [**create_file**](docs/DefaultApi.md#create_file) | **POST** /file | -*DefaultApi* | [**create_file_batch**](docs/DefaultApi.md#create_file_batch) | **POST** /file/batch | -*DefaultApi* | [**create_release**](docs/DefaultApi.md#create_release) | **POST** /release | -*DefaultApi* | [**create_release_batch**](docs/DefaultApi.md#create_release_batch) | **POST** /release/batch | -*DefaultApi* | [**create_work**](docs/DefaultApi.md#create_work) | **POST** /work | -*DefaultApi* | [**create_work_batch**](docs/DefaultApi.md#create_work_batch) | **POST** /work/batch | -*DefaultApi* | [**delete_container**](docs/DefaultApi.md#delete_container) | **DELETE** /container/{id} | -*DefaultApi* | [**delete_creator**](docs/DefaultApi.md#delete_creator) | **DELETE** /creator/{id} | -*DefaultApi* | [**delete_file**](docs/DefaultApi.md#delete_file) | **DELETE** /file/{id} | -*DefaultApi* | [**delete_release**](docs/DefaultApi.md#delete_release) | **DELETE** /release/{id} | -*DefaultApi* | [**delete_work**](docs/DefaultApi.md#delete_work) | **DELETE** /work/{id} | -*DefaultApi* | [**get_changelog**](docs/DefaultApi.md#get_changelog) | **GET** /changelog | -*DefaultApi* | [**get_changelog_entry**](docs/DefaultApi.md#get_changelog_entry) | **GET** /changelog/{id} | -*DefaultApi* | [**get_container**](docs/DefaultApi.md#get_container) | **GET** /container/{id} | -*DefaultApi* | [**get_container_history**](docs/DefaultApi.md#get_container_history) | **GET** /container/{id}/history | -*DefaultApi* | [**get_creator**](docs/DefaultApi.md#get_creator) | **GET** /creator/{id} | -*DefaultApi* | [**get_creator_history**](docs/DefaultApi.md#get_creator_history) | **GET** /creator/{id}/history | -*DefaultApi* | [**get_creator_releases**](docs/DefaultApi.md#get_creator_releases) | **GET** /creator/{id}/releases | -*DefaultApi* | [**get_editgroup**](docs/DefaultApi.md#get_editgroup) | **GET** /editgroup/{id} | -*DefaultApi* | [**get_editor**](docs/DefaultApi.md#get_editor) | **GET** /editor/{id} | -*DefaultApi* | [**get_editor_changelog**](docs/DefaultApi.md#get_editor_changelog) | **GET** /editor/{id}/changelog | -*DefaultApi* | [**get_file**](docs/DefaultApi.md#get_file) | **GET** /file/{id} | -*DefaultApi* | [**get_file_history**](docs/DefaultApi.md#get_file_history) | **GET** /file/{id}/history | -*DefaultApi* | [**get_release**](docs/DefaultApi.md#get_release) | **GET** /release/{id} | -*DefaultApi* | [**get_release_files**](docs/DefaultApi.md#get_release_files) | **GET** /release/{id}/files | -*DefaultApi* | [**get_release_history**](docs/DefaultApi.md#get_release_history) | **GET** /release/{id}/history | -*DefaultApi* | [**get_stats**](docs/DefaultApi.md#get_stats) | **GET** /stats | -*DefaultApi* | [**get_work**](docs/DefaultApi.md#get_work) | **GET** /work/{id} | -*DefaultApi* | [**get_work_history**](docs/DefaultApi.md#get_work_history) | **GET** /work/{id}/history | -*DefaultApi* | [**get_work_releases**](docs/DefaultApi.md#get_work_releases) | **GET** /work/{id}/releases | -*DefaultApi* | [**lookup_container**](docs/DefaultApi.md#lookup_container) | **GET** /container/lookup | -*DefaultApi* | [**lookup_creator**](docs/DefaultApi.md#lookup_creator) | **GET** /creator/lookup | -*DefaultApi* | [**lookup_file**](docs/DefaultApi.md#lookup_file) | **GET** /file/lookup | -*DefaultApi* | [**lookup_release**](docs/DefaultApi.md#lookup_release) | **GET** /release/lookup | -*DefaultApi* | [**update_container**](docs/DefaultApi.md#update_container) | **PUT** /container/{id} | -*DefaultApi* | [**update_creator**](docs/DefaultApi.md#update_creator) | **PUT** /creator/{id} | -*DefaultApi* | [**update_file**](docs/DefaultApi.md#update_file) | **PUT** /file/{id} | -*DefaultApi* | [**update_release**](docs/DefaultApi.md#update_release) | **PUT** /release/{id} | -*DefaultApi* | [**update_work**](docs/DefaultApi.md#update_work) | **PUT** /work/{id} | - - -## Documentation For Models - - - [ChangelogEntry](docs/ChangelogEntry.md) - - [ContainerEntity](docs/ContainerEntity.md) - - [CreatorEntity](docs/CreatorEntity.md) - - [Editgroup](docs/Editgroup.md) - - [EditgroupEdits](docs/EditgroupEdits.md) - - [Editor](docs/Editor.md) - - [EntityEdit](docs/EntityEdit.md) - - [EntityHistoryEntry](docs/EntityHistoryEntry.md) - - [ErrorResponse](docs/ErrorResponse.md) - - [FileEntity](docs/FileEntity.md) - - [FileEntityUrls](docs/FileEntityUrls.md) - - [ReleaseContrib](docs/ReleaseContrib.md) - - [ReleaseEntity](docs/ReleaseEntity.md) - - [ReleaseEntityAbstracts](docs/ReleaseEntityAbstracts.md) - - [ReleaseRef](docs/ReleaseRef.md) - - [StatsResponse](docs/StatsResponse.md) - - [Success](docs/Success.md) - - [WorkEntity](docs/WorkEntity.md) - - -## Documentation For Authorization - - All endpoints do not require authorization. - - -## Author - - - diff --git a/python/codegen_python_client.sh b/python/codegen_python_client.sh index 3344c214..7cc7aa63 100755 --- a/python/codegen_python_client.sh +++ b/python/codegen_python_client.sh @@ -22,6 +22,6 @@ mkdir -p fatcat_client mkdir -p tests/codegen_tests cp -r $OUTPUT/fatcat_client/* fatcat_client cp -r $OUTPUT/test/* tests/codegen_tests -cp $OUTPUT/README.md README_codegen.md -# safer than 'rm -rf $OUTPUT' -mv $OUTPUT /tmp +cp $OUTPUT/README.md fatcat_client/README.md +# ooo, this makes me nervous +rm -rf $OUTPUT diff --git a/python/conftest.py b/python/conftest.py new file mode 100644 index 00000000..aad02e76 --- /dev/null +++ b/python/conftest.py @@ -0,0 +1,3 @@ +import sys + +collect_ignore = ["setup.py"] diff --git a/python/fatcat_client/README.md b/python/fatcat_client/README.md new file mode 100644 index 00000000..0d072dde --- /dev/null +++ b/python/fatcat_client/README.md @@ -0,0 +1,148 @@ +# fatcat-client +A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata + +This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: + +- API version: 0.1.0 +- Package version: 1.0.0 +- Build package: io.swagger.codegen.languages.PythonClientCodegen + +## Requirements. + +Python 2.7 and 3.4+ + +## Installation & Usage +### pip install + +If the python package is hosted on Github, you can install directly from Github + +```sh +pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git +``` +(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`) + +Then import the package: +```python +import fatcat_client +``` + +### Setuptools + +Install via [Setuptools](http://pypi.python.org/pypi/setuptools). + +```sh +python setup.py install --user +``` +(or `sudo python setup.py install` to install the package for all users) + +Then import the package: +```python +import fatcat_client +``` + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```python +from __future__ import print_function +import time +import fatcat_client +from fatcat_client.rest import ApiException +from pprint import pprint +# create an instance of the API class +api_instance = fatcat_client.DefaultApi() +id = 'id_example' # str | base32-encoded unique identifier + +try: + api_response = api_instance.accept_editgroup(id) + pprint(api_response) +except ApiException as e: + print("Exception when calling DefaultApi->accept_editgroup: %s\n" % e) + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost/v0* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*DefaultApi* | [**accept_editgroup**](docs/DefaultApi.md#accept_editgroup) | **POST** /editgroup/{id}/accept | +*DefaultApi* | [**create_container**](docs/DefaultApi.md#create_container) | **POST** /container | +*DefaultApi* | [**create_container_batch**](docs/DefaultApi.md#create_container_batch) | **POST** /container/batch | +*DefaultApi* | [**create_creator**](docs/DefaultApi.md#create_creator) | **POST** /creator | +*DefaultApi* | [**create_creator_batch**](docs/DefaultApi.md#create_creator_batch) | **POST** /creator/batch | +*DefaultApi* | [**create_editgroup**](docs/DefaultApi.md#create_editgroup) | **POST** /editgroup | +*DefaultApi* | [**create_file**](docs/DefaultApi.md#create_file) | **POST** /file | +*DefaultApi* | [**create_file_batch**](docs/DefaultApi.md#create_file_batch) | **POST** /file/batch | +*DefaultApi* | [**create_release**](docs/DefaultApi.md#create_release) | **POST** /release | +*DefaultApi* | [**create_release_batch**](docs/DefaultApi.md#create_release_batch) | **POST** /release/batch | +*DefaultApi* | [**create_work**](docs/DefaultApi.md#create_work) | **POST** /work | +*DefaultApi* | [**create_work_batch**](docs/DefaultApi.md#create_work_batch) | **POST** /work/batch | +*DefaultApi* | [**delete_container**](docs/DefaultApi.md#delete_container) | **DELETE** /container/{id} | +*DefaultApi* | [**delete_creator**](docs/DefaultApi.md#delete_creator) | **DELETE** /creator/{id} | +*DefaultApi* | [**delete_file**](docs/DefaultApi.md#delete_file) | **DELETE** /file/{id} | +*DefaultApi* | [**delete_release**](docs/DefaultApi.md#delete_release) | **DELETE** /release/{id} | +*DefaultApi* | [**delete_work**](docs/DefaultApi.md#delete_work) | **DELETE** /work/{id} | +*DefaultApi* | [**get_changelog**](docs/DefaultApi.md#get_changelog) | **GET** /changelog | +*DefaultApi* | [**get_changelog_entry**](docs/DefaultApi.md#get_changelog_entry) | **GET** /changelog/{id} | +*DefaultApi* | [**get_container**](docs/DefaultApi.md#get_container) | **GET** /container/{id} | +*DefaultApi* | [**get_container_history**](docs/DefaultApi.md#get_container_history) | **GET** /container/{id}/history | +*DefaultApi* | [**get_creator**](docs/DefaultApi.md#get_creator) | **GET** /creator/{id} | +*DefaultApi* | [**get_creator_history**](docs/DefaultApi.md#get_creator_history) | **GET** /creator/{id}/history | +*DefaultApi* | [**get_creator_releases**](docs/DefaultApi.md#get_creator_releases) | **GET** /creator/{id}/releases | +*DefaultApi* | [**get_editgroup**](docs/DefaultApi.md#get_editgroup) | **GET** /editgroup/{id} | +*DefaultApi* | [**get_editor**](docs/DefaultApi.md#get_editor) | **GET** /editor/{id} | +*DefaultApi* | [**get_editor_changelog**](docs/DefaultApi.md#get_editor_changelog) | **GET** /editor/{id}/changelog | +*DefaultApi* | [**get_file**](docs/DefaultApi.md#get_file) | **GET** /file/{id} | +*DefaultApi* | [**get_file_history**](docs/DefaultApi.md#get_file_history) | **GET** /file/{id}/history | +*DefaultApi* | [**get_release**](docs/DefaultApi.md#get_release) | **GET** /release/{id} | +*DefaultApi* | [**get_release_files**](docs/DefaultApi.md#get_release_files) | **GET** /release/{id}/files | +*DefaultApi* | [**get_release_history**](docs/DefaultApi.md#get_release_history) | **GET** /release/{id}/history | +*DefaultApi* | [**get_stats**](docs/DefaultApi.md#get_stats) | **GET** /stats | +*DefaultApi* | [**get_work**](docs/DefaultApi.md#get_work) | **GET** /work/{id} | +*DefaultApi* | [**get_work_history**](docs/DefaultApi.md#get_work_history) | **GET** /work/{id}/history | +*DefaultApi* | [**get_work_releases**](docs/DefaultApi.md#get_work_releases) | **GET** /work/{id}/releases | +*DefaultApi* | [**lookup_container**](docs/DefaultApi.md#lookup_container) | **GET** /container/lookup | +*DefaultApi* | [**lookup_creator**](docs/DefaultApi.md#lookup_creator) | **GET** /creator/lookup | +*DefaultApi* | [**lookup_file**](docs/DefaultApi.md#lookup_file) | **GET** /file/lookup | +*DefaultApi* | [**lookup_release**](docs/DefaultApi.md#lookup_release) | **GET** /release/lookup | +*DefaultApi* | [**update_container**](docs/DefaultApi.md#update_container) | **PUT** /container/{id} | +*DefaultApi* | [**update_creator**](docs/DefaultApi.md#update_creator) | **PUT** /creator/{id} | +*DefaultApi* | [**update_file**](docs/DefaultApi.md#update_file) | **PUT** /file/{id} | +*DefaultApi* | [**update_release**](docs/DefaultApi.md#update_release) | **PUT** /release/{id} | +*DefaultApi* | [**update_work**](docs/DefaultApi.md#update_work) | **PUT** /work/{id} | + + +## Documentation For Models + + - [ChangelogEntry](docs/ChangelogEntry.md) + - [ContainerEntity](docs/ContainerEntity.md) + - [CreatorEntity](docs/CreatorEntity.md) + - [Editgroup](docs/Editgroup.md) + - [EditgroupEdits](docs/EditgroupEdits.md) + - [Editor](docs/Editor.md) + - [EntityEdit](docs/EntityEdit.md) + - [EntityHistoryEntry](docs/EntityHistoryEntry.md) + - [ErrorResponse](docs/ErrorResponse.md) + - [FileEntity](docs/FileEntity.md) + - [FileEntityUrls](docs/FileEntityUrls.md) + - [ReleaseContrib](docs/ReleaseContrib.md) + - [ReleaseEntity](docs/ReleaseEntity.md) + - [ReleaseEntityAbstracts](docs/ReleaseEntityAbstracts.md) + - [ReleaseRef](docs/ReleaseRef.md) + - [StatsResponse](docs/StatsResponse.md) + - [Success](docs/Success.md) + - [WorkEntity](docs/WorkEntity.md) + + +## Documentation For Authorization + + All endpoints do not require authorization. + + +## Author + + + diff --git a/python/pytest.ini b/python/pytest.ini index 0a5e9216..afdebabc 100644 --- a/python/pytest.ini +++ b/python/pytest.ini @@ -1,6 +1,8 @@ [pytest] +ignore = setup.py + # allow imports from files in current directory python_paths = . diff --git a/python/setup.py b/python/setup.py index 1e0ee7fb..00425b4a 100644 --- a/python/setup.py +++ b/python/setup.py @@ -47,7 +47,7 @@ here = os.path.abspath(os.path.dirname(__file__)) # Import the README and use it as the long-description. # Note: this will only work if 'README.md' is present in your MANIFEST.in file! try: - with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f: + with io.open(os.path.join(here, 'fatcat_client/README.md'), encoding='utf-8') as f: long_description = '\n' + f.read() except FileNotFoundError: long_description = DESCRIPTION @@ -104,7 +104,7 @@ setup( version=about['__version__'], description=DESCRIPTION, long_description=long_description, - #long_description_content_type='text/markdown', + long_description_content_type='text/markdown', keywords=["Swagger", "fatcat"], author=AUTHOR, author_email=EMAIL, @@ -124,9 +124,11 @@ setup( # Trove classifiers # Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers #'License :: OSI Approved :: MIT License', + 'Development Status :: 3 - Alpha', + 'Intended Audience :: Developers', 'Programming Language :: Python', - #'Programming Language :: Python :: 3', - #'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', #'Programming Language :: Python :: Implementation :: CPython', #'Programming Language :: Python :: Implementation :: PyPy' ], diff --git a/python/tox.ini b/python/tox.ini new file mode 100644 index 00000000..d4fc1d9d --- /dev/null +++ b/python/tox.ini @@ -0,0 +1,8 @@ +[tox] +envlist = py35 + +[testenv] +deps = pipenv +commands = + pipenv install --dev + pipenv run pytest -- cgit v1.2.3