Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# PyCharm / Git folders
.idea/

# VS Code folders
.vscode/

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/
docs/_static/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
language: python
python:
- '3.6.3'
before_script:
- pip install pybuilder
script: pyb package publish
branches:
only:
- master
before_deploy:
- cd target/dist/janusgraph_python
deploy:
provider: pypi
user: debasishdebs
server: https://test.pypi.org/legacy/
skip_cleanup: true
true:
branch: master
password:
secure: f0TQzX+wDDOT3LV76MO3ba8xLBYbcrne509HpA3w6nQKCl4OZobjC0SXG39ATAp6dq1m098FEioVB4usw9NVcc+fpeZm0jmkKq9fUvh9j0TxDC/wT0L6Rn6Cn2BnL8i/xBWkn027a4/FHFSgEqQgOycYuTcOggfyCFIbi5FflBSScjkqY6jlwXHLmIBRHgvHulkXLOOVFS5jDlI9rHqo87Ejj/A47IRttdjoz3Vt4c7ECTn+KZGsVRhvwLAraT/pRn4Hq1IuG/Xiykd2GAbCRBPeTTRkL2NCBEgjWEJSXnBRoKe+fAdI1J/sxyYd8eBx2KQLtiUkP4yPJELaAe6UoypVUvTVV3B8M8vDG3/fJlxBA3MyuOI6C2F4ilnHSdzCG/IVMBEE5lB2Jy4b60dbOxoJxU1gerfGYIo9SPNV0Q6FtCpWzjUmVfNpeEEN9pi9pPqjcaOaauk5SlMTNu0RieO2oa9lF2sK9Bfh7Uk6+DJMEDELKZytlDMHNMFwvakDwEBDSDmOxnhxkvn6lbGWx/dNXwe07nXpl/FVSVsJaGvoh8mrFMkGFTcoqHrn2nTMLKoKlbMQeCWfhTld1OfUMsolYjdk9yuowsFN8z+weXb1FpsVeXppCUZZ34nHdtX49vTkXKx0e6tJNYojsPGu4aDtz50dsXI6qfUIo7j3CGM=
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# JanusGraph Python driver

## License
Expand All @@ -6,3 +7,37 @@ JanusGraph Python driver code is provided under the [Apache 2.0
license](APACHE-2.0.txt) and documentation is provided under the [CC-BY-4.0
license](CC-BY-4.0.txt). For details about this dual-license structure, please
see [`LICENSE.txt`](LICENSE.txt).


Python Client for connecting to JanusGraph and executing JanusGraph specific features.


For building the library, the pre requisite is that PyBuilder needs to be installed on system.

For installing PyBuilder, the following needs to be run:

```pip install pybuilder```

Once PyBuilder is installed, run the following commands to build the Library:

```pyb package publish```

Running the above command deletes the <b>target</b> folder, installs dependencies, and generates Project files to be used with PyCharm.

For building documentation, the following command needs to be run:

- First, build <b>.rst</b> files from docstrings so that the same can be consumed by Sphinx auto-doc generator to generate HTML docs.
- Second, run the pybuilder spinx generator plugin to generate html files from .rst files.

```
# Generate rst files using sphinx-apidoc
sphinx-apidoc -o docs/ src/main/python/janusgraph_python
```

```
# Build HTML files from .rst source files
pyb sphinx_generate_documentation
```

Once done, you can see the build HTML files under ```docs/_build``` directory.

55 changes: 55 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Name: Debasish Kanhar


from pybuilder.core import use_plugin, init, Author, task, depends

authors = [Author("Debasish Kanhar", "dekanhar@in.ibm.com")]
description = "Python client drivers for JanusGraph"
license = "Apache License v2.0"

name = "janusgraph_python"

tinkerpop_version = "3.3.3"
janusgraph_version = "0.3.0"
version = "0.0.9"

use_plugin("python.core")
# the python unittest plugin allows running python's standard library unittests
# use_plugin("python.unittest")
# this plugin allows installing project dependencies with pip
use_plugin("python.install_dependencies")
# a plugin that measures unit test statement coverage
# use_plugin("python.coverage")
# use_plugin('pypi:pybuilder_pytest_coverage')
# for packaging purposes since we'll build a tarball
use_plugin("python.distutils")
# For generating Pycharm project files
use_plugin("python.pycharm")
# For generating Docs from docstring using Spinx
use_plugin("python.sphinx")

# default_task = ['clean', 'install_dependencies', 'publish', 'pycharm_generate']
default_task = ['clean', 'install_dependencies', 'prepare', 'compile_sources', 'pycharm_generate']

# This is an initializer, a block of logic that runs before the project is built.
@init
def initialize(project):
# Nothing happens here yet, but notice the `project` argument which is automatically injected.
project.set_property("coverage_break_build", False) # default is True
project.set_property("coverage_reset_modules", True)
project.set_property("coverage_threshold_warn", 50)
project.set_property("coverage_branch_threshold_warn", 60)
project.set_property("coverage_branch_partial_threshold_warn", 70)
project.set_property("coverage_allow_non_imported_modules", True)
project.set_property("coverage_exceptions", ["__init__"])

project.set_property("unittest_test_method_prefix", "test")
project.set_property("unittest_file_suffix", "_test")

project.set_property("sphinx_config_path", "docs/")
project.set_property("sphinx_source_dir", "docs/")
project.set_property("sphinx_output_dir", "docs/_build")

project.set_property("dir_dist", "target/dist/" + project.name)
project.depends_on("gremlinpython", "=={}".format(tinkerpop_version))
pass
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = python -msphinx
SPHINXPROJ = JanusGraph-Pythondocs
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Loading