Skip to content

Commit

Permalink
initial commit of skeleton files
Browse files Browse the repository at this point in the history
  • Loading branch information
jonrkarr committed Jun 25, 2019
1 parent aaed688 commit 31d35c8
Show file tree
Hide file tree
Showing 28 changed files with 1,010 additions and 1 deletion.
104 changes: 104 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@

version: 2
jobs:
build:
working_directory: /root/project
docker:

- image: karrlab/wc_env_dependencies:latest

steps:
# Clone repository
- checkout

# Load packages from cache
- restore_cache:
keys:
- v1-{{ arch }}-{{ .Branch }}-{{ checksum "/etc/docker-image-tag" }}-{{ checksum "requirements.txt" }}

# Python 3 installation tasks
- run:
name: Install pkg_utils (Python 3)
command: pip3 install -U git+https://github.com/KarrLab/pkg_utils.git#egg=pkg_utils
- run:
name: Install karr_lab_build_utils (Python 3)
command: |
pip3 install -U git+https://github.com/KarrLab/log.git#egg=log
pip3 install -U git+https://github.com/KarrLab/sphinxcontrib-googleanalytics.git#egg=sphinxcontrib_googleanalytics
pip3 install -U git+https://github.com/KarrLab/wc_utils.git#egg=wc_utils[all]
pip3 install -U git+https://github.com/KarrLab/karr_lab_build_utils.git#egg=karr_lab_build_utils[all]
- run:
name: Install package configuration files including credentials
command: karr_lab_build_utils3 download-install-package-config-files
- run:
name: Setup Python environment
command: |
if [[ -f .circleci/requirements.txt ]]; then
while IFS="" read -r line || [ -n "$line" ]; do
if [[ ! -z "$line" ]] && [[ ! "$line" =~ ^# ]]; then
pip3 install -U "$line"
fi
done < .circleci/requirements.txt
fi
- run:
name: Install package (Python 3)
command: pip3 install -U -e .[all]

# Save packages to cache
- save_cache:
key: v1-{{ arch }}-{{ .Branch }}-{{ checksum "/etc/docker-image-tag" }}-{{ checksum "requirements.txt" }}
paths:
- /usr/local/lib/python3.6/site-packages

# Test code
- run:
name: Test code
command: |
set +e
karr_lab_build_utils3 run-tests --with-xunit --with-coverage
TEST_EXIT_CODE_PY3=$?
# Calculate exit code and save to file for reading by the next step
if [[ $TEST_EXIT_CODE_PY3 -eq 0 ]]; then
echo "0" > TEST_EXIT_CODE
exit 0
else
echo "0" > TEST_EXIT_CODE
exit 1
fi
# Generate reports, archive results, and send notifications
- run:
name: Generate reports, archive results, and send notifications
when: always
command: |
if [[ -f TEST_EXIT_CODE ]]; then
INSTALLATION_EXIT_CODE=0
TEST_EXIT_CODE=$(<TEST_EXIT_CODE)
else
INSTALLATION_EXIT_CODE=1
TEST_EXIT_CODE=1
fi
karr_lab_build_utils3 do-post-test-tasks $INSTALLATION_EXIT_CODE $TEST_EXIT_CODE
- store_test_results:
path: /root/project/tests/reports
- store_artifacts:
path: /root/project/tests/reports
destination: reports
- store_artifacts:
path: /root/.wc/log
destination: log
- store_artifacts:
path: /root/project/docs/_build/html
destination: docs


# workflows:
# version: 2
# build:
# jobs:
# - build:
# context: karr_lab
3 changes: 3 additions & 0 deletions .circleci/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Karr Lab packages
git+https://github.com/KarrLab/pkg_utils.git#egg=pkg_utils
git+https://github.com/KarrLab/wc_utils.git#egg=wc_utils
54 changes: 54 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# compiled files
*.pyc

# python cache
__pycache__/

#distribution files
/build/
/dist/
/sdists/
*.egg-info

# test reports
tests/reports

# coverage file
.coverage*
htmlcov/
.tox/

# profiling data
prof/

# .rst-formatted README
README.rst

# compiled documentation
docs/source
docs/_build
docs/.doctrees/

# pytest .cache directory
.cache/
.pytest_cache/

# passwords
tests/fixtures/secret/

# IDE configuration
.idea/
.spyderproject
.ropeproject

# temporary files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
.~lock.*
Thumbs.db
~$*.xlsx
~$*.xls
.~*.xlsx
4 changes: 4 additions & 0 deletions .karr_lab_build_utils.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
static_analyses:
ignore_files: []
downstream_dependencies: []
email_notifications: []
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2019 Karr Lab

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
12 changes: 12 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# description
README.rst

# version
include bcforms/VERSION

# license
include LICENSE

# requirements
include requirements.txt
include requirements.optional.txt
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,34 @@
[//]: # ( [![PyPI package](https://img.shields.io/pypi/v/bcforms.svg)](https://pypi.python.org/pypi/bcforms) )
[![Documentation](https://readthedocs.org/projects/bcforms/badge/?version=latest)](https://docs.karrlab.org/bcforms)
[![Test results](https://circleci.com/gh/KarrLab/bcforms.svg?style=shield)](https://circleci.com/gh/KarrLab/bcforms)
[![Test coverage](https://coveralls.io/repos/github/KarrLab/bcforms/badge.svg)](https://coveralls.io/github/KarrLab/bcforms)
[![Code analysis](https://api.codeclimate.com/v1/badges/c8f15ac1e50c27ca44cc/maintainability)](https://codeclimate.com/github/KarrLab/bcforms)
[![License](https://img.shields.io/github/license/KarrLab/bcforms.svg)](LICENSE)
![Analytics](https://ga-beacon.appspot.com/UA-86759801-1/bcforms/README.md?pixel)

# bcforms
Toolkit for concretely describing macromolecular complexes

Write an overview

## Installation
1. Install dependencies
2. Install the latest release from PyPI
```
pip install bcforms.git[all]
```
3. Install the latest revision from GitHub
```
pip install git+https://github.com/KarrLab/bcforms.git#egg=bcforms[all]
```

## Documentation
Please see the [API documentation](https://docs.karrlab.org/bcforms).

## License
The package is released under the [MIT license](LICENSE).

## Development team
This package was developed by the [Karr Lab](https://www.karrlab.org) at the Icahn School of Medicine at Mount Sinai in New York, USA.

## Questions and comments
Please contact the [Karr Lab](https://www.karrlab.org) with any questions or comments.
1 change: 1 addition & 0 deletions bcforms/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.1
5 changes: 5 additions & 0 deletions bcforms/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import pkg_resources

# read version
with open(pkg_resources.resource_filename('bcforms', 'VERSION'), 'r') as file:
__version__ = file.read().strip()
79 changes: 79 additions & 0 deletions bcforms/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
""" bcforms command line interface
:Author: Name <email>
:Date: 2019-6-25
:Copyright: 2019, Karr Lab
:License: MIT
"""

import cement
import bcforms
import bcforms.core


class BaseController(cement.Controller):
""" Base controller for command line application """

class Meta:
label = 'base'
description = "bcforms"
arguments = [
(['-v', '--version'], dict(action='version', version=bcforms.__version__)),
]

@cement.ex(help='command_1 description')
def cmd1(self):
""" command_1 description """
print('command_1 output')

@cement.ex(help='command_2 description')
def cmd2(self):
""" command_2 description """
print('command_2 output')

@cement.ex(hide=True)
def _default(self):
self._parser.print_help()


class Command3WithArgumentsController(cement.Controller):
""" Command3 description """

class Meta:
label = 'command-3'
description = 'Command3 description'
stacked_on = 'base'
stacked_type = 'nested'
arguments = [
(['arg_1'], dict(
type=str, help='Description of arg_1')),
(['arg_2'], dict(
type=str, help='Description of arg_2')),
(['--opt-arg-3'], dict(
type=str, default='default value of opt-arg-1', help='Description of opt-arg-3')),
(['--opt-arg-4'], dict(
type=float, default=float('nan'), help='Description of opt-arg-4')),
]

@cement.ex(hide=True)
def _default(self):
args = self.app.pargs
args.arg_1
args.arg_2
args.opt_arg_3
args.opt_arg_4


class App(cement.App):
""" Command line application """
class Meta:
label = 'bcforms'
base_controller = 'base'
handlers = [
BaseController,
Command3WithArgumentsController,
]

def main():
with App() as app:
app.run()
47 changes: 47 additions & 0 deletions bcforms/core.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
""" bcforms
:Author: Name <email>
:Date: 2019-6-25
:Copyright: 2019, Karr Lab
:License: MIT
"""


class ExampleClass(object):
""" Descipton of ExampleClass
Attributes:
attr_1 (:obj:`type of attr_1`): description of attr_1
attr_2 (:obj:`type of attr_2`): description of attr_2
...
"""

def __init__(self, arg_1, arg_2, kwarg_1=None, kwarg_2=None):
"""
Args:
arg_1 (:obj:`type of arg_1`): description of arg_1
arg_2 (:obj:`type of arg_2`): description of arg_2
kwarg_1 (:obj:`type of kwarg_1`, optional): description of kwarg_1
kwarg_2 (:obj:`type of kwarg_2`, optional): description of kwarg_2
...
"""
self.attr_1 = arg_1
self.attr_2 = arg_2

def method_1(self, arg_1, arg_2, kwarg_1=None, kwarg_2=None):
""" Description of method_1
Args:
arg_1 (:obj:`type of arg_1`): description of arg_1
arg_2 (:obj:`type of arg_2`): description of arg_2
kwarg_1 (:obj:`type of kwarg_1`, optional): description of kwarg_1
kwarg_2 (:obj:`type of kwarg_2`, optional): description of kwarg_2
...
Returns:
:obj:`type of return value`: description of return value
Raises:
:obj:`type of raised exception(s)`: description of raised exceptions
"""
pass
Loading

0 comments on commit 31d35c8

Please sign in to comment.