Skip to content

Commit

Permalink
Version bump to 0.3.0 (#419)
Browse files Browse the repository at this point in the history
* Extend collection test to validate member item URI (#398)

* Adding DELETE operation to drone collection

* English typos

* Maintaining examples synchronized

* Add crud test for nested objects and refactor other tests (#399)

* Use HydraStatus and HydraError to return status response

* Add a helper function to apply filtering.

* Add helper function to create IriTemplates.

* Use iri_template generator and attach generated iri_template to the colection response.

* Implement searching

* Add support for pagination of search results.

* Add function to include mappings for properties of nested classes in IriTemplate

* Add support for search over nested property values

* Add tests for IriTemplates generated by hydrus.

* Add test for searching mechanism(get_collection())

* Refactor by adding functions for parameter parsing and calculating page limit and offset

* Refactor code by removing redundant check based on value of path variable

* Add exception handling for invalid parameters

* Add mechanism to support client-controlled pagination (#409)

* Add helper function to attach pagination related mappings to the IriTemplate
* Add an exception to handle incomaptible parameters
* Add mechanism to handle client-guided pagination
* Refactor code and add exception for out of range offset value.
* Add tests for client controlled pagination.
* Debug test_pep8.py and make codebase pep8 compatible.

* Update hydrus with latest changes made at core (#411)

* Update hydrus to use updated core and adapt code accordingly.

* Update tests and add test for readable properties.

* Bump version to 0.2.6

* Refactor crud.insert and create new file for other helper functions.

* Add basic socket connection functionality to hydrus.

* Add socketio update event for synchronization.

* Add an endpoint for modification-table-diff.

* Refactor some code and add inline comments.

* Rename new_job_id field in response to job_id.

* Add support to propagate multiple_delete modifications.

* Add sync functionality for PUT and refactor code.

* Add a thread to do routine cleanup of modification records.

* Refactor 'modification-table endpoint' code.

* Add tests for sync updates and modification-table.

* Send an empty response with status-code 204 for outdated clients.

* Use socketio event to send modification-table-diff.

* Add reconnect event and extend tests.

* Refactor and add comments.

* Remove uuid and timestamp, and use incremental ids instead.

* Use incremental job_id instead of timestamp to clean stale records.

* Remove unused imports.

* Use HydraLink to improve handling of nested object props.

* Add links as GraphIII triples instead of GraphIIT triples.

* Add link_prop to assist insertion of linked properties as GraphIII.

* Adapt test for nested fields defined with hydra:Link.

* Refactor insertion of GraphIII triples for link properties.

* Add explicit type check for link properties.

* Use latest hydra-python-core from the master branch.

* Version bump to 0.3.0

* Update hydra-python-core branch to master
  • Loading branch information
xadahiya authored Aug 16, 2019
1 parent de2ae1e commit ec565d1
Show file tree
Hide file tree
Showing 17 changed files with 1,133 additions and 446 deletions.
25 changes: 16 additions & 9 deletions cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from sqlalchemy.orm import sessionmaker, scoped_session

from hydrus.app_factory import app_factory
from hydrus.socketio_factory import create_socket
from hydrus.utils import (set_session, set_doc, set_hydrus_server_url,
set_token, set_api_name, set_authentication,
set_page_size, set_pagination)
Expand All @@ -10,6 +11,7 @@
from hydrus.data.db_models import Base
from hydrus.data.user import add_user
from hydrus.data.exceptions import UserExists
from hydrus.data.stale_records_cleanup import remove_stale_modification_records
from gevent.pywsgi import WSGIServer
from hydra_openapi_parser.openapi_parser import parse
from hydrus.samples.hydra_doc_sample import doc as api_document
Expand All @@ -27,7 +29,7 @@
help="The API name.", type=str)
@click.option("--auth/--no-auth", default=True,
help="Set authentication to True or False.")
@click.option("--dburl", default="sqlite:///:memory:",
@click.option("--dburl", default="sqlite:///database.db",
help="Set database url", type=str)
@click.option("--hydradoc", "-d", default=None,
help="Location to HydraDocumentation (JSON-LD) of server.",
Expand All @@ -42,10 +44,13 @@
help="Toggle token based user authentication.")
@click.option("--serverurl", default="http://localhost",
help="Set server url", type=str)
@click.option("--stale_records_removal_interval", default=900,
help="Interval period between removal of stale modification records.",
type=int)
@click.argument("serve", required=True)
def startserver(adduser: Tuple, api: str, auth: bool, dburl: str, pagination: bool,
hydradoc: str, port: int, pagesize: int, serverurl: str, token: bool,
serve: None) -> None:
stale_records_removal_interval: int, serve: None) -> None:
"""
Python Hydrus CLI
Expand Down Expand Up @@ -82,8 +87,8 @@ def startserver(adduser: Tuple, api: str, auth: bool, dburl: str, pagination: bo

click.echo("Setting up the database")
# Create a connection to the database you want to use
engine = create_engine(DB_URL)

engine = create_engine(DB_URL, connect_args={'check_same_thread': False})
Base.metadata.drop_all(engine)
click.echo("Creating models")
# Add the required Models to the database
Base.metadata.create_all(engine)
Expand Down Expand Up @@ -159,6 +164,8 @@ def startserver(adduser: Tuple, api: str, auth: bool, dburl: str, pagination: bo
# Create a Hydrus app with the API name you want, default will be "api"
app = app_factory(API_NAME)
# Set the name of the API
# Create a socket for the app
socketio = create_socket(app, session)
click.echo("Starting the application")
with set_authentication(app, auth):
# Use authentication for all requests
Expand All @@ -174,17 +181,17 @@ def startserver(adduser: Tuple, api: str, auth: bool, dburl: str, pagination: bo
with set_pagination(app, pagination):
# Set page size of a collection view
with set_page_size(app, pagesize):
# Run a thread to remove stale modification records at some
# interval of time.
remove_stale_modification_records(
session, stale_records_removal_interval)
# Start the hydrus app
http_server = WSGIServer(('', port), app)
socketio.run(app, port=port)
click.echo("Server running at:")
click.echo(
"{}{}".format(
HYDRUS_SERVER_URL,
API_NAME))
try:
http_server.serve_forever()
except KeyboardInterrupt:
pass


if __name__ == "__main__":
Expand Down
Loading

0 comments on commit ec565d1

Please sign in to comment.