From 8a0deb448e768ecdecc8e06fc7c9b9de889071e2 Mon Sep 17 00:00:00 2001 From: Elijah West Date: Wed, 17 Jan 2018 19:16:49 -0700 Subject: [PATCH 01/14] Implemented Eager Loading for samplingfeaturedataset query. --- odm2api/ODM2/services/readService.py | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/odm2api/ODM2/services/readService.py b/odm2api/ODM2/services/readService.py index a7ed9f9..df87049 100644 --- a/odm2api/ODM2/services/readService.py +++ b/odm2api/ODM2/services/readService.py @@ -37,6 +37,7 @@ import pandas as pd from sqlalchemy import distinct, exists +from sqlalchemy.orm import lazyload, joinedload, contains_eager, eagerload, defer, deferred, subqueryload __author__ = 'sreeder' @@ -78,7 +79,6 @@ class SamplingFeatureDataSet(): def __init__(self, samplingfeature, datasetresults, relatedfeatures): sf = samplingfeature - self.SamplingFeature = sf self.SamplingFeatureID = sf.SamplingFeatureID self.SamplingFeatureUUID = sf.SamplingFeatureUUID self.SamplingFeatureTypeCV = sf.SamplingFeatureTypeCV @@ -955,10 +955,24 @@ def getSamplingFeatureDatasets(self, ids=None, codes=None, uuids=None, dstype=No sfds=[] for sf in sf_list: - q = self._session.query(DataSetsResults)\ - .join(Results)\ - .join(FeatureActions)\ - .filter(FeatureActions.SamplingFeatureID == sf.SamplingFeatureID) + # q = self._session.query(DataSetsResults)\ + # .options(subqueryload(DataSetsResults.ResultObj)\ + # .subqueryload(Results.FeatureActionObj)\ + # .load_only(FeatureActions.SamplingFeatureID))\ + # .filter(FeatureActions.SamplingFeatureID == sf.SamplingFeatureID) + + q = self._session.query(DataSetsResults) \ + .join(DataSetsResults.ResultObj)\ + .join(Results.FeatureActionObj)\ + .filter(FeatureActions.SamplingFeatureID == sf.SamplingFeatureID)\ + .options(contains_eager(DataSetsResults.ResultObj).contains_eager(Results.FeatureActionObj)\ + .load_only(FeatureActions.SamplingFeatureID)) + + # q = self._session.query(DataSetsResults)\ + # .join(Results)\ + # .join(FeatureActions)\ + # .filter(FeatureActions.SamplingFeatureID == sf.SamplingFeatureID) + if dstype: q = q.filter_by(DatasetTypeCV=dstype) From 16b679420c50692a8b7a33c69f8a3972e4a084b8 Mon Sep 17 00:00:00 2001 From: Elijah West Date: Fri, 19 Jan 2018 13:00:57 -0700 Subject: [PATCH 02/14] Removed commented old code. --- odm2api/ODM2/services/readService.py | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/odm2api/ODM2/services/readService.py b/odm2api/ODM2/services/readService.py index df87049..a657772 100644 --- a/odm2api/ODM2/services/readService.py +++ b/odm2api/ODM2/services/readService.py @@ -946,7 +946,7 @@ def getSamplingFeatureDatasets(self, ids=None, codes=None, uuids=None, dstype=No sf_query = sf_query.filter(SamplingFeatures.SamplingFeatureCode.in_(codes)) if uuids: sf_query = sf_query.filter(SamplingFeatures.SamplingFeatureUUID.in_(uuids)) - +w sf_list = [] for sf in sf_query.all(): sf_list.append(sf) @@ -955,12 +955,7 @@ def getSamplingFeatureDatasets(self, ids=None, codes=None, uuids=None, dstype=No sfds=[] for sf in sf_list: - # q = self._session.query(DataSetsResults)\ - # .options(subqueryload(DataSetsResults.ResultObj)\ - # .subqueryload(Results.FeatureActionObj)\ - # .load_only(FeatureActions.SamplingFeatureID))\ - # .filter(FeatureActions.SamplingFeatureID == sf.SamplingFeatureID) - + #Eager loading the data. q = self._session.query(DataSetsResults) \ .join(DataSetsResults.ResultObj)\ .join(Results.FeatureActionObj)\ @@ -968,12 +963,6 @@ def getSamplingFeatureDatasets(self, ids=None, codes=None, uuids=None, dstype=No .options(contains_eager(DataSetsResults.ResultObj).contains_eager(Results.FeatureActionObj)\ .load_only(FeatureActions.SamplingFeatureID)) - # q = self._session.query(DataSetsResults)\ - # .join(Results)\ - # .join(FeatureActions)\ - # .filter(FeatureActions.SamplingFeatureID == sf.SamplingFeatureID) - - if dstype: q = q.filter_by(DatasetTypeCV=dstype) From 93c2427bf50567b1b3e5560a51e8d560b19905b2 Mon Sep 17 00:00:00 2001 From: Elijah West Date: Fri, 19 Jan 2018 14:17:25 -0700 Subject: [PATCH 03/14] Had a stray character, removed it as well as some useless imports --- odm2api/ODM2/services/readService.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/odm2api/ODM2/services/readService.py b/odm2api/ODM2/services/readService.py index a657772..8b5278a 100644 --- a/odm2api/ODM2/services/readService.py +++ b/odm2api/ODM2/services/readService.py @@ -37,7 +37,7 @@ import pandas as pd from sqlalchemy import distinct, exists -from sqlalchemy.orm import lazyload, joinedload, contains_eager, eagerload, defer, deferred, subqueryload +from sqlalchemy.orm import joinedload, contains_eager, eagerload, defer, deferred, subqueryload __author__ = 'sreeder' @@ -946,7 +946,7 @@ def getSamplingFeatureDatasets(self, ids=None, codes=None, uuids=None, dstype=No sf_query = sf_query.filter(SamplingFeatures.SamplingFeatureCode.in_(codes)) if uuids: sf_query = sf_query.filter(SamplingFeatures.SamplingFeatureUUID.in_(uuids)) -w + sf_list = [] for sf in sf_query.all(): sf_list.append(sf) From 441890e59237006b96af8b287af98cc11cdc2c59 Mon Sep 17 00:00:00 2001 From: lsetiawan Date: Fri, 19 Jan 2018 15:01:34 -0800 Subject: [PATCH 04/14] Remove allow flake8 failure for python 2.7 --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5b99a41..eaa8e8b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,8 +39,6 @@ matrix: - python: 3.6 env: TEST_TARGET=docs allow_failures: - - python: 2.7 - env: TEST_TARGET=coding_standards - python: 3.6 env: TEST_TARGET=default From 9c1a7dce66bae99ec888fe91d1b37e560f12c246 Mon Sep 17 00:00:00 2001 From: lsetiawan Date: Mon, 22 Jan 2018 14:46:13 -0800 Subject: [PATCH 05/14] Cleaup code to meet PEP8 --- odm2api/ODM2/services/readService.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/odm2api/ODM2/services/readService.py b/odm2api/ODM2/services/readService.py index 5d757c7..a7d4e4f 100644 --- a/odm2api/ODM2/services/readService.py +++ b/odm2api/ODM2/services/readService.py @@ -39,7 +39,7 @@ import pandas as pd from sqlalchemy import distinct, exists -from sqlalchemy.orm import joinedload, contains_eager, eagerload, defer, deferred, subqueryload +from sqlalchemy.orm import contains_eager __author__ = 'sreeder' @@ -1020,13 +1020,14 @@ def getSamplingFeatureDatasets(self, ids=None, codes=None, uuids=None, dstype=No sfds = [] for sf in sf_list: - #Eager loading the data. - q = self._session.query(DataSetsResults) \ + # Eager loading the data. + q = self._session.query(DataSetsResults)\ .join(DataSetsResults.ResultObj)\ .join(Results.FeatureActionObj)\ .filter(FeatureActions.SamplingFeatureID == sf.SamplingFeatureID)\ - .options(contains_eager(DataSetsResults.ResultObj).contains_eager(Results.FeatureActionObj)\ - .load_only(FeatureActions.SamplingFeatureID)) + .options(contains_eager(DataSetsResults.ResultObj) + .contains_eager(Results.FeatureActionObj) + .load_only(FeatureActions.SamplingFeatureID)) if dstype: q = q.filter_by(DatasetTypeCV=dstype) From 08b8c07b80f0526f86b4517a7a06e494370f24fd Mon Sep 17 00:00:00 2001 From: lsetiawan Date: Fri, 16 Feb 2018 12:22:05 -0800 Subject: [PATCH 06/14] Refactor ODM2 --- odm2api/ODM2/__init__.py | 8 -------- odm2api/__init__.py | 3 ++- odm2api/{ODM2 => }/models.py | 0 odm2api/{ODM2 => }/services/__init__.py | 0 odm2api/{ODM2 => }/services/createService.py | 0 odm2api/{ODM2 => }/services/deleteService.py | 0 odm2api/{ODM2 => }/services/readService.py | 0 odm2api/{ODM2 => }/services/updateService.py | 0 8 files changed, 2 insertions(+), 9 deletions(-) delete mode 100644 odm2api/ODM2/__init__.py rename odm2api/{ODM2 => }/models.py (100%) rename odm2api/{ODM2 => }/services/__init__.py (100%) rename odm2api/{ODM2 => }/services/createService.py (100%) rename odm2api/{ODM2 => }/services/deleteService.py (100%) rename odm2api/{ODM2 => }/services/readService.py (100%) rename odm2api/{ODM2 => }/services/updateService.py (100%) diff --git a/odm2api/ODM2/__init__.py b/odm2api/ODM2/__init__.py deleted file mode 100644 index 96c3005..0000000 --- a/odm2api/ODM2/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -from __future__ import (absolute_import, division, print_function) - -from odm2api.base import modelBase, serviceBase - -__all__ = [ - 'serviceBase', - 'modelBase', -] diff --git a/odm2api/__init__.py b/odm2api/__init__.py index 830dc2e..ce6da51 100644 --- a/odm2api/__init__.py +++ b/odm2api/__init__.py @@ -1,12 +1,13 @@ from __future__ import (absolute_import, division, print_function) from odm2api.ODMconnection import SessionFactory, dbconnection -from odm2api.base import serviceBase +from odm2api.base import serviceBase, modelBase __all__ = [ 'SessionFactory', 'dbconnection', 'serviceBase', + 'modelBase' ] from ._version import get_versions diff --git a/odm2api/ODM2/models.py b/odm2api/models.py similarity index 100% rename from odm2api/ODM2/models.py rename to odm2api/models.py diff --git a/odm2api/ODM2/services/__init__.py b/odm2api/services/__init__.py similarity index 100% rename from odm2api/ODM2/services/__init__.py rename to odm2api/services/__init__.py diff --git a/odm2api/ODM2/services/createService.py b/odm2api/services/createService.py similarity index 100% rename from odm2api/ODM2/services/createService.py rename to odm2api/services/createService.py diff --git a/odm2api/ODM2/services/deleteService.py b/odm2api/services/deleteService.py similarity index 100% rename from odm2api/ODM2/services/deleteService.py rename to odm2api/services/deleteService.py diff --git a/odm2api/ODM2/services/readService.py b/odm2api/services/readService.py similarity index 100% rename from odm2api/ODM2/services/readService.py rename to odm2api/services/readService.py diff --git a/odm2api/ODM2/services/updateService.py b/odm2api/services/updateService.py similarity index 100% rename from odm2api/ODM2/services/updateService.py rename to odm2api/services/updateService.py From 67f208c4c3f0f30a8d30fa9ee9cfc9ef6f5b5fc2 Mon Sep 17 00:00:00 2001 From: lsetiawan Date: Fri, 16 Feb 2018 12:25:48 -0800 Subject: [PATCH 07/14] Make new ODM2 to use the refractored ODM2 --- odm2api/ODM2/__init__.py | 8 ++++++++ odm2api/ODM2/models.py | 9 +++++++++ odm2api/ODM2/services/__init__.py | 15 +++++++++++++++ odm2api/ODM2/services/createService.py | 19 +++++++++++++++++++ odm2api/ODM2/services/deleteService.py | 21 +++++++++++++++++++++ odm2api/ODM2/services/readService.py | 19 +++++++++++++++++++ odm2api/ODM2/services/updateService.py | 18 ++++++++++++++++++ odm2api/ODMconnection.py | 2 +- odm2api/services/__init__.py | 8 ++++---- odm2api/services/createService.py | 4 ++-- odm2api/services/deleteService.py | 4 ++-- odm2api/services/readService.py | 4 ++-- odm2api/services/updateService.py | 4 ++-- 13 files changed, 122 insertions(+), 13 deletions(-) create mode 100644 odm2api/ODM2/__init__.py create mode 100644 odm2api/ODM2/models.py create mode 100644 odm2api/ODM2/services/__init__.py create mode 100644 odm2api/ODM2/services/createService.py create mode 100644 odm2api/ODM2/services/deleteService.py create mode 100644 odm2api/ODM2/services/readService.py create mode 100644 odm2api/ODM2/services/updateService.py diff --git a/odm2api/ODM2/__init__.py b/odm2api/ODM2/__init__.py new file mode 100644 index 0000000..96c3005 --- /dev/null +++ b/odm2api/ODM2/__init__.py @@ -0,0 +1,8 @@ +from __future__ import (absolute_import, division, print_function) + +from odm2api.base import modelBase, serviceBase + +__all__ = [ + 'serviceBase', + 'modelBase', +] diff --git a/odm2api/ODM2/models.py b/odm2api/ODM2/models.py new file mode 100644 index 0000000..0e6445e --- /dev/null +++ b/odm2api/ODM2/models.py @@ -0,0 +1,9 @@ +from __future__ import (absolute_import, division, print_function) + +import warnings + +from odm2api.models import * # noqa + +warnings.warn('The module odm2api.ODM2.models will be deprecated. ' + 'Please use odm2api.models instead.', + FutureWarning, stacklevel=2) diff --git a/odm2api/ODM2/services/__init__.py b/odm2api/ODM2/services/__init__.py new file mode 100644 index 0000000..ecdd49a --- /dev/null +++ b/odm2api/ODM2/services/__init__.py @@ -0,0 +1,15 @@ +from __future__ import (absolute_import, division, print_function) + +from odm2api.ODM2.services.createService import CreateODM2 +from odm2api.ODM2.services.deleteService import DeleteODM2 +from odm2api.ODM2.services.readService import ReadODM2 +from odm2api.ODM2.services.updateService import UpdateODM2 + +__author__ = 'jmeline' + +__all__ = [ + 'CreateODM2', + 'DeleteODM2', + 'ReadODM2', + 'UpdateODM2' +] diff --git a/odm2api/ODM2/services/createService.py b/odm2api/ODM2/services/createService.py new file mode 100644 index 0000000..158a14c --- /dev/null +++ b/odm2api/ODM2/services/createService.py @@ -0,0 +1,19 @@ +from __future__ import (absolute_import, division, print_function) + +import warnings + +from odm2api.services import CreateODM2 as newClass + +warnings.warn('The module odm2api.ODM2.services.createService will be deprecated. ' + 'Please use odm2api.services.createService instead.', + FutureWarning, stacklevel=2) + + +__author__ = 'sreeder' + + +def CreateODM2(*args, **kwargs): + warnings.warn('The class odm2api.ODM2.services.readService.CreateODM2 will be deprecated. ' + 'Please use odm2api.services.readService.CreateODM2 instead.', + FutureWarning, stacklevel=2) + return newClass(*args, **kwargs) diff --git a/odm2api/ODM2/services/deleteService.py b/odm2api/ODM2/services/deleteService.py new file mode 100644 index 0000000..ff5a06a --- /dev/null +++ b/odm2api/ODM2/services/deleteService.py @@ -0,0 +1,21 @@ +from __future__ import (absolute_import, division, print_function) + +import warnings + +from odm2api.services.deleteService import DeleteODM2 as newClass + +warnings.warn('The module odm2api.ODM2.services.deleteService will be deprecated. ' + 'Please use odm2api.services.deleteService instead.', + FutureWarning, stacklevel=2) + + +__author__ = 'jmeline' + +# Annotations + + +def DeleteODM2(*args, **kwargs): + warnings.warn('The class odm2api.ODM2.services.readService.DeleteODM2 will be deprecated. ' + 'Please use odm2api.services.readService.DeleteODM2 instead.', + FutureWarning, stacklevel=2) + return newClass(*args, **kwargs) diff --git a/odm2api/ODM2/services/readService.py b/odm2api/ODM2/services/readService.py new file mode 100644 index 0000000..177f784 --- /dev/null +++ b/odm2api/ODM2/services/readService.py @@ -0,0 +1,19 @@ +from __future__ import (absolute_import, division, print_function) + +import warnings + +from odm2api.services.readService import ReadODM2 as newClass + +warnings.warn('The module odm2api.ODM2.services.readService will be deprecated. ' + 'Please use odm2api.services.readService instead.', + FutureWarning, stacklevel=2) + + +__author__ = 'sreeder' + + +def ReadODM2(*args, **kwargs): + warnings.warn('The class odm2api.ODM2.services.readService.ReadODM2 will be deprecated. ' + 'Please use odm2api.services.readService.ReadODM2 instead.', + FutureWarning, stacklevel=2) + return newClass(*args, **kwargs) diff --git a/odm2api/ODM2/services/updateService.py b/odm2api/ODM2/services/updateService.py new file mode 100644 index 0000000..6b70c82 --- /dev/null +++ b/odm2api/ODM2/services/updateService.py @@ -0,0 +1,18 @@ +from __future__ import (absolute_import, division, print_function) + +import warnings + +from odm2api.services import UpdateODM2 as newClass + +warnings.warn('The module odm2api.ODM2.services.updateService will be deprecated. ' + 'Please use odm2api.services.updateService instead.', + FutureWarning, stacklevel=2) + +__author__ = 'jmeline' + + +def UpdateODM2(*args, **kwargs): + warnings.warn('The class odm2api.ODM2.services.readService.CreateODM2 will be deprecated. ' + 'Please use odm2api.services.readService.CreateODM2 instead.', + FutureWarning, stacklevel=2) + return newClass(*args, **kwargs) diff --git a/odm2api/ODMconnection.py b/odm2api/ODMconnection.py index c3c1833..1a10b74 100644 --- a/odm2api/ODMconnection.py +++ b/odm2api/ODMconnection.py @@ -7,7 +7,7 @@ except ImportError: from urllib.parse import quote_plus -from odm2api.ODM2.models import setSchema +from odm2api.models import setSchema from sqlalchemy import create_engine from sqlalchemy.orm import scoped_session, sessionmaker diff --git a/odm2api/services/__init__.py b/odm2api/services/__init__.py index ecdd49a..620afca 100644 --- a/odm2api/services/__init__.py +++ b/odm2api/services/__init__.py @@ -1,9 +1,9 @@ from __future__ import (absolute_import, division, print_function) -from odm2api.ODM2.services.createService import CreateODM2 -from odm2api.ODM2.services.deleteService import DeleteODM2 -from odm2api.ODM2.services.readService import ReadODM2 -from odm2api.ODM2.services.updateService import UpdateODM2 +from odm2api.services.createService import CreateODM2 +from odm2api.services.deleteService import DeleteODM2 +from odm2api.services.readService import ReadODM2 +from odm2api.services.updateService import UpdateODM2 __author__ = 'jmeline' diff --git a/odm2api/services/createService.py b/odm2api/services/createService.py index 1fceb2f..3bae275 100644 --- a/odm2api/services/createService.py +++ b/odm2api/services/createService.py @@ -2,8 +2,8 @@ import uuid -from odm2api.ODM2 import serviceBase -from odm2api.ODM2.models import TimeSeriesResultValues +from odm2api import serviceBase +from odm2api.models import TimeSeriesResultValues __author__ = 'sreeder' diff --git a/odm2api/services/deleteService.py b/odm2api/services/deleteService.py index 43f944a..0f76d9c 100644 --- a/odm2api/services/deleteService.py +++ b/odm2api/services/deleteService.py @@ -1,7 +1,7 @@ from __future__ import (absolute_import, division, print_function) -from odm2api.ODM2 import serviceBase -from odm2api.ODM2.models import TimeSeriesResultValues +from odm2api import serviceBase +from odm2api.models import TimeSeriesResultValues __author__ = 'jmeline' diff --git a/odm2api/services/readService.py b/odm2api/services/readService.py index a7d4e4f..e93a712 100644 --- a/odm2api/services/readService.py +++ b/odm2api/services/readService.py @@ -2,8 +2,8 @@ import warnings -from odm2api.ODM2 import serviceBase -from odm2api.ODM2.models import ( +from odm2api import serviceBase +from odm2api.models import ( ActionAnnotations, ActionDirectives, ActionExtensionPropertyValues, Actions, Affiliations, Annotations, AuthorLists, CVActionType, CVAggregationStatistic, CVAnnotationType, CVCensorCode, CVDataQualityType, CVDataSetType, CVDirectiveType, diff --git a/odm2api/services/updateService.py b/odm2api/services/updateService.py index 87e77b8..e7a46e4 100644 --- a/odm2api/services/updateService.py +++ b/odm2api/services/updateService.py @@ -4,8 +4,8 @@ from datetime import datetime -from odm2api.ODM2 import serviceBase -from odm2api.ODM2.models import (Actions, Results) +from odm2api import serviceBase +from odm2api.models import (Actions, Results) # ################################################################################ From 23891b274691e09d50759d9863b5193d36413291 Mon Sep 17 00:00:00 2001 From: lsetiawan Date: Fri, 16 Feb 2018 12:51:05 -0800 Subject: [PATCH 08/14] Fix import flake8 error --- odm2api/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/odm2api/__init__.py b/odm2api/__init__.py index ce6da51..fbb8991 100644 --- a/odm2api/__init__.py +++ b/odm2api/__init__.py @@ -1,13 +1,13 @@ from __future__ import (absolute_import, division, print_function) from odm2api.ODMconnection import SessionFactory, dbconnection -from odm2api.base import serviceBase, modelBase +from odm2api.base import modelBase, serviceBase __all__ = [ 'SessionFactory', 'dbconnection', + 'modelBase', 'serviceBase', - 'modelBase' ] from ._version import get_versions From 74d20280e2d3d4f9c7f1bc847a2dca680e747539 Mon Sep 17 00:00:00 2001 From: lsetiawan Date: Mon, 26 Feb 2018 13:08:44 -0800 Subject: [PATCH 09/14] Update README DOCS --- README.md | 51 +++++++++++++++++++++++---------------------------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 19ec59c..fd0de8e 100644 --- a/README.md +++ b/README.md @@ -38,17 +38,17 @@ source activate myenv # On MacOSX or Linux but they haven't been tested thoroughly. -### Latest release, from ODM2 anaconda.org channel +### Latest release, from conda-forge anaconda.org channel The [latest `odm2api` release](https://github.com/ODM2/ODM2PythonAPI/releases) is available on the -[ODM2 anaconda.org channel](https://anaconda.org/odm2/odm2api) +[conda-forge anaconda.org channel](https://anaconda.org/conda-forge/odm2api) for all major OS paltforms (linux, OSX, win32/win64). To install it on an existing conda environment: ``` -conda install -c odm2 odm2api +conda install -c conda-forge odm2api ``` All dependencies are installed, @@ -57,33 +57,28 @@ including Pandas and its dependencies (numpy, etc). To create a new environment "myenv" with the `odm2api` package: ``` -conda create -n myenv -c odm2 python=2.7 odm2api +conda create -n myenv -c conda-forge python=2.7 odm2api ``` -### Installing the development version from the `master` branch on github - -**Note from 4/26/2016:** These instructions may be slightly outdated. -Follow these directions for installing the bleeding edge GitHub master branch, -mainly for development and testing purposes. - -To create a new environment "myenv" with `odm2api`, -first download the conda environment file -[condaenvironment_1.yml](https://raw.githubusercontent.com/ODM2/ODM2PythonAPI/master/condaenvironment_1.yml). -Go to the directory where `condaenvironment_1.yml` was downloaded. -Then, on a terminal shell: - -```bash -conda env create -n myenv --file py2_conda_environment.yml -``` - -Activate the new environment, then install `odm2api` into the environment: - -```bash -activate myenv # On Windows -source activate myenv # On MacOSX or Linux - -pip install --process-dependency-links git+https://github.com/ODM2/ODM2PythonAPI.git -``` +### Installing the development version from the `development` branch on github + +Note: We follow the [Gitflow workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow) for development. + +1. Download both `requirements.txt` and `requirements-dev.txt`. + ``` bash + wget https://raw.githubusercontent.com/ODM2/ODM2PythonAPI/master/requirements.txt + wget https://raw.githubusercontent.com/ODM2/ODM2PythonAPI/master/requirements-dev.txt + ``` + +2. Create conda environment from the two text files. + ```bash + conda create -n odm2api_dev -c conda-forge python=2.7 --file requirements.txt --file requirements-dev.txt + ``` + +3. Install the latest commit from the development branch + ```bash + pip install git+https://github.com/ODM2/ODM2PythonAPI.git@development#egg=odm2api + ``` ## Credits From abca232cc123131ce8f1ed3c3662aa99175121ee Mon Sep 17 00:00:00 2001 From: lsetiawan Date: Tue, 27 Feb 2018 08:59:46 -0800 Subject: [PATCH 10/14] Remove flake-print --- requirements-dev.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 71bb791..6abb495 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -4,7 +4,6 @@ flake8-builtins flake8-comprehensions flake8-import-order flake8-mutable -flake8-print flake8-quotes mock nbsphinx From 8501ad83e7ec08108c2005d0d57ff9e668d89036 Mon Sep 17 00:00:00 2001 From: Landung Setiawan Date: Tue, 27 Feb 2018 09:11:53 -0800 Subject: [PATCH 11/14] Update README.md --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fd0de8e..0bd9666 100644 --- a/README.md +++ b/README.md @@ -70,10 +70,20 @@ Note: We follow the [Gitflow workflow](https://www.atlassian.com/git/tutorials/c wget https://raw.githubusercontent.com/ODM2/ODM2PythonAPI/master/requirements-dev.txt ``` -2. Create conda environment from the two text files. +2. Create conda environment `odm2api_dev` from the two `requirements*` text files. ```bash conda create -n odm2api_dev -c conda-forge python=2.7 --file requirements.txt --file requirements-dev.txt ``` + +3. Activate conda environment. + - MacOSX/Linux: + ```bash + source activate odm2api_dev + ``` + - Windows: + ``` + activate odm2api_dev + ``` 3. Install the latest commit from the development branch ```bash From 50d0db4d49593e1920e31b6d2b635ed07b5aef12 Mon Sep 17 00:00:00 2001 From: Landung Setiawan Date: Tue, 27 Feb 2018 09:13:20 -0800 Subject: [PATCH 12/14] Update README change number. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0bd9666..32a1dff 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ Note: We follow the [Gitflow workflow](https://www.atlassian.com/git/tutorials/c activate odm2api_dev ``` -3. Install the latest commit from the development branch +4. Install the latest commit from the development branch ```bash pip install git+https://github.com/ODM2/ODM2PythonAPI.git@development#egg=odm2api ``` From 59115f5bdb3dc6476c633de0abd4d4dae80b9783 Mon Sep 17 00:00:00 2001 From: Landung Setiawan Date: Tue, 27 Feb 2018 09:40:42 -0800 Subject: [PATCH 13/14] Update installing.rst --- docs/source/installing.rst | 61 +++++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 21 deletions(-) diff --git a/docs/source/installing.rst b/docs/source/installing.rst index a135c24..4064f0f 100644 --- a/docs/source/installing.rst +++ b/docs/source/installing.rst @@ -12,7 +12,7 @@ OS X and Linux, it's something like To activate a conda environment, say, "myenv": -.. code:: bash +.. code-block:: bash activate myenv # On Windows source activate myenv # On MacOSX or Linux @@ -21,17 +21,17 @@ To activate a conda environment, say, "myenv": changes have been made to support Python 3.x, but they haven't been tested thoroughly. -Latest release, from ODM2 anaconda.org channel +Latest release, from conda-forge anaconda.org channel ---------------------------------------------- -The `latest release `__ is available -on the `ODM2 anaconda.org channel `__ +The `latest release `_ is available +on the `conda-forge anaconda.org channel `_ for all major OS platforms (linux, OS X, win32/win64). To install it on an existing conda environment: :: - conda install odm2api --channel odm2 + conda install -c conda-forge odm2api All dependencies are installed, including Pandas and its dependencies (numpy, etc). @@ -40,23 +40,42 @@ To create a new environment "myenv" with the ``odm2api`` package: :: - conda create -n myenv -c odm2 python=2.7 odm2api + conda create -n myenv -c conda-forge python=2.7 odm2api -Installing the development version +Installing the development version from the ``development`` branch on github ---------------------------------- -To create a new environment "myenv" with ``odm2api``, first clone the repository. -Then, on a terminal shell: - -.. code:: bash - - conda create --name myenv python=2.7 --file requirements.txt --file requirements-dev.txt -c odm2 - -Activate the new environment, then install ``odm2api`` into the -environment: - -.. code:: bash - - activate myenv # On Windows - source activate myenv # On OS X or Linux +Note: We follow the `Gitflow workflow `__ for development. + +1. Download both ``requirements.txt`` and ``requirements-dev.txt``. + + .. code-block:: bash + + wget https://raw.githubusercontent.com/ODM2/ODM2PythonAPI/master/requirements.txt + wget https://raw.githubusercontent.com/ODM2/ODM2PythonAPI/master/requirements-dev.txt + +2. Create conda environment ``odm2api_dev`` from the two ``requirements*`` text files. + + .. code-block:: bash + + conda create -n odm2api_dev -c conda-forge python=2.7 --file requirements.txt --file requirements-dev.txt + +3. Activate conda environment. + - MacOSX/Linux: + + .. code-block:: bash + + source activate odm2api_dev + + - Windows: + + .. code-block:: bash + + activate odm2api_dev + +4. Install the latest commit from the development branch + + .. code-block:: bash + + pip install git+https://github.com/ODM2/ODM2PythonAPI.git@development#egg=odm2api From 56e25ec31b4d510c997cb02012f7b399e35c12fe Mon Sep 17 00:00:00 2001 From: lsetiawan Date: Wed, 28 Feb 2018 09:56:36 -0800 Subject: [PATCH 14/14] Update sphinx docs about models, modules, and odm2models --- docs/source/models.rst | 26 +++++++++++++------------- docs/source/modules.rst | 8 ++++---- docs/source/odm2models.rst | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/source/models.rst b/docs/source/models.rst index bd5bb0a..aa23167 100644 --- a/docs/source/models.rst +++ b/docs/source/models.rst @@ -12,16 +12,16 @@ The following are entities in the `ODM2 Core Schema