Skip to content
This repository has been archived by the owner on Jan 24, 2018. It is now read-only.

Commit

Permalink
Hierarchical namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
dcolligan committed Nov 7, 2016
1 parent eda808e commit 54a55c1
Show file tree
Hide file tree
Showing 112 changed files with 491 additions and 412 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[flake8]
exclude = ga4gh/*_pb2.py,ga4gh/datamodel/obo_parser.py,docs,ez_setup.py
exclude = ga4gh/server/datamodel/obo_parser.py,docs,ez_setup.py
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ scripts/auth.yml
*.bak
*.db-shm
*.db-wal
ga4gh/_version.py
_version.py
tests/data/registry.db

# Below based off of https://gist.github.com/octocat/9257657
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ install:
- pip install pip --upgrade
# RDFLib requres html5lib; html5lib requires setuptools version 18.5 or above;
- pip install setuptools==25.1.0
- pip install ga4gh-common # need ga4gh_common.setup for sdist
- python setup.py sdist
- pip install dist/ga4gh*.tar.gz
# every installable in setup.py's entry_points should be tested here
Expand All @@ -33,7 +32,8 @@ script:
ga2sam_dev.py ga2vcf_dev.py repo_dev.py server_dev.py
setup.py
tests ga4gh scripts
- nosetests --with-coverage --cover-package ga4gh
- python -mnose tests
--with-coverage --cover-package ga4gh.server
--cover-inclusive --cover-min-percentage 80
--cover-branches --cover-erase
- make clean -C docs
Expand Down
7 changes: 6 additions & 1 deletion configtest_dev.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
"""
Simple shim for running the configuration testing program during development.
"""
import ga4gh.cli.configtest as cli_configtest
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import dev_glue # NOQA
import ga4gh.server.cli.configtest as cli_configtest

if __name__ == "__main__":
cli_configtest.configtest_main()
2 changes: 1 addition & 1 deletion convert_error_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import argparse

import ga4gh.exceptions as exceptions
import ga4gh.server.exceptions as exceptions


def parseArgs():
Expand Down
4 changes: 2 additions & 2 deletions deploy/application.wsgi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file is copied into place by the .whiskey/action_hooks/pre-build hook during Docker build

from ga4gh.frontend import app as application
import ga4gh.frontend as frontend
from ga4gh.server.frontend import app as application
import ga4gh.server.frontend as frontend
frontend.configure("/srv/ga4gh/config.py")
15 changes: 15 additions & 0 deletions dev_glue.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
Glue for running server code during development
Import this module before using any other module that imports ga4gh.server.
Otherwise, python will look for server in the installed ga4gh package.
See __path__ documentation at:
https://docs.python.org/2/tutorial/modules.html
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import ga4gh
ga4gh.__path__.insert(0, 'ga4gh')
9 changes: 7 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('..'))

# the following two lines are similar ones to those in dev_glue.py
# they enable python to find the ga4gh.server package
import ga4gh
ga4gh.__path__.insert(0, '../ga4gh')

import ga4gh.server

# -- General configuration ------------------------------------------------

Expand Down Expand Up @@ -62,9 +67,9 @@
# built documents.
#
# The short X.Y version.
version = ga4gh.__version__.split("+")[0]
version = ga4gh.server.__version__.split("+")[0]
# The full version, including alpha/beta/rc tags.
release = ga4gh.__version__
release = ga4gh.server.__version__

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
48 changes: 24 additions & 24 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ file path. This is the first command that must be issued
when creating a new GA4GH repository.

.. argparse::
:module: ga4gh.cli.repomanager
:module: ga4gh.server.cli.repomanager
:func: getRepoManagerParser
:prog: ga4gh_repo
:path: init
Expand All @@ -69,7 +69,7 @@ understand the structure of the repository that they are managing.
of this command should improve considerably in the near future.

.. argparse::
:module: ga4gh.cli.repomanager
:module: ga4gh.server.cli.repomanager
:func: getRepoManagerParser
:prog: ga4gh_repo
:path: list
Expand Down Expand Up @@ -99,7 +99,7 @@ well in their repository.
of this command should improve considerably in the near future.

.. argparse::
:module: ga4gh.cli.repomanager
:module: ga4gh.server.cli.repomanager
:func: getRepoManagerParser
:prog: ga4gh_repo
:path: verify
Expand All @@ -121,7 +121,7 @@ of ReadGroupSets, VariantSets, VariantAnnotationSets and FeatureSets. Each
dataset has a name, which is used to identify it in the repository manager.

.. argparse::
:module: ga4gh.cli.repomanager
:module: ga4gh.server.cli.repomanager
:func: getRepoManagerParser
:prog: ga4gh_repo
:path: add-dataset
Expand Down Expand Up @@ -149,7 +149,7 @@ number of metadata values (.e.g. ``ncbiTaxonId``) which can be set
using command line options.

.. argparse::
:module: ga4gh.cli.repomanager
:module: ga4gh.server.cli.repomanager
:func: getRepoManagerParser
:prog: ga4gh_repo
:path: add-referenceset
Expand All @@ -175,7 +175,7 @@ Adds a new biosample to the repository. The biosample argument is
a JSON document according to the GA4GH JSON schema.

.. argparse::
:module: ga4gh.cli.repomanager
:module: ga4gh.server.cli.repomanager
:func: getRepoManagerParser
:prog: ga4gh_repo
:path: add-biosample
Expand All @@ -198,7 +198,7 @@ Adds a new individual to the repository. The individual argument is
a JSON document following the GA4GH JSON schema.

.. argparse::
:module: ga4gh.cli.repomanager
:module: ga4gh.server.cli.repomanager
:func: getRepoManagerParser
:prog: ga4gh_repo
:path: add-individual
Expand All @@ -224,7 +224,7 @@ to ontology IDs. Sequence ontology definitions can be downloaded from
the `Sequence Ontology site <https://github.com/The-Sequence-Ontology/SO-Ontologies>`_.

.. argparse::
:module: ga4gh.cli.repomanager
:module: ga4gh.server.cli.repomanager
:func: getRepoManagerParser
:prog: ga4gh_repo
:path: add-ontology
Expand Down Expand Up @@ -254,7 +254,7 @@ provided using the ``-I`` option.
.. todo:: Document adding VariantAnnotationSets using the -a option.

.. argparse::
:module: ga4gh.cli.repomanager
:module: ga4gh.server.cli.repomanager
:func: getRepoManagerParser
:prog: ga4gh_repo
:path: add-variantset
Expand Down Expand Up @@ -324,7 +324,7 @@ then the readgroup set will be associated with it automatically. If it does not
name of the reference set using the ``--referenceSetName`` option.

.. argparse::
:module: ga4gh.cli.repomanager
:module: ga4gh.server.cli.repomanager
:func: getRepoManagerParser
:prog: ga4gh_repo
:path: add-readgroupset
Expand Down Expand Up @@ -372,7 +372,7 @@ init-rnaquantificationset
Initializes a rnaquantification set.

.. argparse::
:module: ga4gh.cli.repomanager
:module: ga4gh.server.cli.repomanager
:func: getRepoManagerParser
:prog: ga4gh_repo
:path: init-rnaquantificationset
Expand All @@ -393,7 +393,7 @@ init-rnaquantificationset
Initializes a rnaquantification set.

.. argparse::
:module: ga4gh.cli.repomanager
:module: ga4gh.server.cli.repomanager
:func: getRepoManagerParser
:prog: ga4gh_repo
:path: init-rnaquantificationset
Expand All @@ -416,7 +416,7 @@ Adds a rnaquantification to a RNA quantification set.
RNA quantification formats supported are currently kallisto and RSEM.

.. argparse::
:module: ga4gh.cli.repomanager
:module: ga4gh.server.cli.repomanager
:func: getRepoManagerParser
:prog: ga4gh_repo
:path: add-rnaquantification
Expand All @@ -443,7 +443,7 @@ When the desired RNA quantification have been added to the set, use this command
to add them to the registry.

.. argparse::
:module: ga4gh.cli.repomanager
:module: ga4gh.server.cli.repomanager
:func: getRepoManagerParser
:prog: ga4gh_repo
:path: add-rnaquantificationset
Expand All @@ -469,7 +469,7 @@ Clinical Genomics Knowledge Base http://nif-crawler.neuinfo.org/monarch/ttl/cgd.
published by the Monarch project, is the supported format for Evidence.

.. argparse::
:module: ga4gh.cli.repomanager
:module: ga4gh.server.cli.repomanager
:func: getRepoManagerParser
:prog: ga4gh_repo
:path: add-phenotypeassociationset
Expand All @@ -491,7 +491,7 @@ Removes a dataset from the repository and recursively removes all
objects (ReadGroupSets, VariantSets, etc) within this dataset.

.. argparse::
:module: ga4gh.cli.repomanager
:module: ga4gh.server.cli.repomanager
:func: getRepoManagerParser
:prog: ga4gh_repo
:path: remove-dataset
Expand All @@ -515,7 +515,7 @@ to remove a reference set that is referenced by other objects in the
repository will result in an error.

.. argparse::
:module: ga4gh.cli.repomanager
:module: ga4gh.server.cli.repomanager
:func: getRepoManagerParser
:prog: ga4gh_repo
:path: remove-referenceset
Expand All @@ -537,7 +537,7 @@ remove-biosample
Removes a biosample from the repository.

.. argparse::
:module: ga4gh.cli.repomanager
:module: ga4gh.server.cli.repomanager
:func: getRepoManagerParser
:prog: ga4gh_repo
:path: remove-biosample
Expand All @@ -559,7 +559,7 @@ remove-individual
Removes an individual from the repository.

.. argparse::
:module: ga4gh.cli.repomanager
:module: ga4gh.server.cli.repomanager
:func: getRepoManagerParser
:prog: ga4gh_repo
:path: remove-individual
Expand All @@ -583,7 +583,7 @@ to remove an ontology that is referenced by other objects in the
repository will result in an error.

.. argparse::
:module: ga4gh.cli.repomanager
:module: ga4gh.server.cli.repomanager
:func: getRepoManagerParser
:prog: ga4gh_repo
:path: remove-ontology
Expand All @@ -606,7 +606,7 @@ Removes a variant set from the repository. This also deletes all
associated call sets and variant annotation sets from the repository.

.. argparse::
:module: ga4gh.cli.repomanager
:module: ga4gh.server.cli.repomanager
:func: getRepoManagerParser
:prog: ga4gh_repo
:path: remove-variantset
Expand All @@ -628,7 +628,7 @@ remove-readgroupset
Removes a read group set from the repository.

.. argparse::
:module: ga4gh.cli.repomanager
:module: ga4gh.server.cli.repomanager
:func: getRepoManagerParser
:prog: ga4gh_repo
:path: remove-readgroupset
Expand All @@ -650,7 +650,7 @@ remove-rnaquantificationset
Removes a rna quantification set from the repository.

.. argparse::
:module: ga4gh.cli.repomanager
:module: ga4gh.server.cli.repomanager
:func: getRepoManagerParser
:prog: ga4gh_repo
:path: remove-rnaquantificationset
Expand All @@ -672,7 +672,7 @@ remove-phenotypeassociationset
Removes an rdf object store.

.. argparse::
:module: ga4gh.cli.repomanager
:module: ga4gh.server.cli.repomanager
:func: getRepoManagerParser
:prog: ga4gh_repo
:path: remove-phenotypeassociationset
Expand Down
4 changes: 2 additions & 2 deletions docs/demo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ performed above, we can use the following code:
from __future__ import print_function
import ga4gh_client.client as client
import ga4gh.client.client as client
httpClient = client.HttpClient("http://localhost:8000")
# Get the datasets on the server.
Expand Down Expand Up @@ -439,6 +439,6 @@ client's libraries for use in your own programs:

.. code-block:: python
>>> import ga4gh_client.client as client
>>> import ga4gh.client.client as client
>>> client.HttpClient
<class 'ga4gh_client.client.HttpClient'>
4 changes: 2 additions & 2 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ contents:

.. code-block:: python
from ga4gh.frontend import app as application
import ga4gh.frontend as frontend
from ga4gh.server.frontend import app as application
import ga4gh.server.frontend as frontend
frontend.configure("/srv/ga4gh/config.py")
Create the configuration file at ``/srv/ga4gh/config.py``, and write the
Expand Down
3 changes: 2 additions & 1 deletion ga2sam_dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
from __future__ import print_function
from __future__ import unicode_literals

import ga4gh.cli.ga2sam as ga2sam
import dev_glue # NOQA
import ga4gh.server.cli.ga2sam as ga2sam

if __name__ == "__main__":
ga2sam.ga2sam_main()
3 changes: 2 additions & 1 deletion ga2vcf_dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
from __future__ import print_function
from __future__ import unicode_literals

import ga4gh.cli.ga2vcf as cli_ga2vcf
import dev_glue # NOQA
import ga4gh.server.cli.ga2vcf as cli_ga2vcf

if __name__ == "__main__":
cli_ga2vcf.ga2vcf_main()
12 changes: 5 additions & 7 deletions ga4gh/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
"""
Reference implementation of the GA4GH APIs.
GA4GH server
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

__version__ = "undefined"
try:
from . import _version
__version__ = _version.version
except ImportError:
pass
__import__('pkg_resources').declare_namespace(__name__)
12 changes: 12 additions & 0 deletions ga4gh/server/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""
Reference implementation of the GA4GH APIs.
"""
# Don't include future imports here; we don't want to export them as
# part of the package

__version__ = "undefined"
try:
from . import _version
__version__ = _version.version
except ImportError:
pass
Loading

0 comments on commit 54a55c1

Please sign in to comment.