-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from omazapa/main
added support to create templates for plugins closes colav/impactu#208
- Loading branch information
Showing
11 changed files
with
215 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import argparse | ||
from kahi.PluginGenerator import PluginGenerator | ||
|
||
parser = argparse.ArgumentParser( | ||
description='ETL for bibliographic data.') | ||
|
||
parser.add_argument('--plugin', type=str, | ||
help='Generate a plugin package directory, please provide the plugin name ex: --plugin test , the output is Kahi_test') | ||
|
||
|
||
args = parser.parse_args() | ||
|
||
if __name__ == '__main__': | ||
# create instance of kahi with the workflow file as a parameter | ||
if args.plugin: | ||
pg = PluginGenerator(args.plugin) | ||
pg.generate() |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Copyright (c) 2005-2020, Colav Developers. | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are | ||
met: | ||
|
||
* Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above | ||
copyright notice, this list of conditions and the following | ||
disclaimer in the documentation and/or other materials provided | ||
with the distribution. | ||
|
||
* Neither the name of the NumPy Developers nor the names of any | ||
contributors may be used to endorse or promote products derived | ||
from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
recursive-include kahi_template/ *.py | ||
recursive-include kahi_template/ *.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<center><img src="https://raw.githubusercontent.com/colav/colav.github.io/master/img/Logo.png"/></center> | ||
|
||
# Kahi template plugin | ||
This is a template for xyz project | ||
replace template for the name of the plugin everywhere. | ||
|
||
# Description | ||
Write something meaningful here ;) | ||
|
||
# Installation | ||
|
||
## Dependencies | ||
What do I need fot this plugin?, it could be external services etc.. | ||
|
||
## Package | ||
Write here how to install this plugin | ||
usauly is | ||
|
||
`pip install kahi_template` | ||
|
||
|
||
# Usage | ||
what should I know? | ||
put it here. | ||
|
||
Additional parameters for kahi_run in the workflow should be here as well. | ||
example : | ||
|
||
``` | ||
template: | ||
- my_param_example: value | ||
``` | ||
Those parameters are not really needed in the workflow file, it is just for illustration. | ||
|
||
|
||
# License | ||
BSD-3-Clause License | ||
|
||
# Links | ||
http://colav.udea.edu.co/ | ||
|
||
|
||
|
14 changes: 14 additions & 0 deletions
14
kahi/templates/plugin/Kahi_template/kahi_template/Kahi_template.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from kahi.KahiBase import KahiBase | ||
|
||
|
||
class Kahi_template(KahiBase): | ||
|
||
config = {} | ||
|
||
def __init__(self, config): | ||
self.config = config | ||
|
||
def run(self): | ||
# entry point for the execution of the plugin | ||
# magic happens here... | ||
pass |
Empty file.
6 changes: 6 additions & 0 deletions
6
kahi/templates/plugin/Kahi_template/kahi_template/_version.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# flake8: noqa | ||
__version__ = '0.0.1-alpha' | ||
|
||
|
||
def get_version(): | ||
return __version__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#!/usr/bin/env python3 | ||
# coding: utf-8 | ||
|
||
# Copyright (c) Colav. | ||
# Distributed under the terms of the Modified BSD License. | ||
|
||
# ----------------------------------------------------------------------------- | ||
# Minimal Python version sanity check (from IPython) | ||
# ----------------------------------------------------------------------------- | ||
|
||
# See https://stackoverflow.com/a/26737258/2268280 | ||
# sudo pip3 install twine | ||
# python3 setup.py sdist bdist_wheel | ||
# twine upload dist/* | ||
# For test purposes | ||
# twine upload --repository-url https://test.pypi.org/legacy/ dist/* | ||
|
||
from __future__ import print_function | ||
from setuptools import setup, find_packages | ||
|
||
import os | ||
import sys | ||
import codecs | ||
|
||
|
||
v = sys.version_info | ||
|
||
|
||
def read(rel_path): | ||
here = os.path.abspath(os.path.dirname(__file__)) | ||
with codecs.open(os.path.join(here, rel_path), 'r') as fp: | ||
return fp.read() | ||
|
||
|
||
def get_version(rel_path): | ||
for line in read(rel_path).splitlines(): | ||
if line.startswith('__version__'): | ||
delim = '"' if '"' in line else "'" | ||
return line.split(delim)[1] | ||
else: | ||
raise RuntimeError("Unable to find version string.") | ||
|
||
|
||
shell = False | ||
if os.name in ('nt', 'dos'): | ||
shell = True | ||
warning = "WARNING: Windows is not officially supported" | ||
print(warning, file=sys.stderr) | ||
|
||
|
||
def main(): | ||
setup( | ||
# Application name: | ||
name="Kahi_template", | ||
|
||
# Version number (initial): | ||
version=get_version('kahi_template/_version.py'), | ||
|
||
# Application author details: | ||
author="Colav", | ||
author_email="colav@udea.edu.co", | ||
|
||
# Packages | ||
packages=find_packages(exclude=['tests']), | ||
|
||
# Include additional files into the package | ||
include_package_data=True, | ||
|
||
# Details | ||
url="https://github.com/colav/Kahi_xyz", | ||
# | ||
license="BSD", | ||
|
||
description="Kahi plugin template", | ||
|
||
long_description=open("README.md").read(), | ||
|
||
long_description_content_type="text/markdown", | ||
|
||
# Dependent packages (distributions) | ||
# put you packages here | ||
install_requires=[ | ||
'kahi' | ||
], | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters