Skip to content
This repository was archived by the owner on Nov 23, 2023. It is now read-only.

Commit a9d0f2d

Browse files
committed
Moved Python wrapper from knime-kripodb nodes to own repo.
See https://github.com/3D-e-Chem/knime-kripodb
0 parents  commit a9d0f2d

22 files changed

+1551
-0
lines changed

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
*.class
2+
*.pyc
3+
4+
# Mobile Tools for Java (J2ME)
5+
.mtj.tmp/
6+
7+
8+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
9+
hs_err_pid*
10+
11+
# Eclipse project
12+
.settings/
13+
.project
14+
target
15+
.classpath
16+
17+
swagger-codegen-cli-*.jar

.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
sudo: false
2+
language: java
3+
jdk: oraclejdk8
4+
cache:
5+
directories:
6+
- $HOME/.m2
7+
install: mvn package -B
8+
script: mvn verify -B

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Change Log
2+
All notable changes to this project will be documented in this file.
3+
This project adheres to [Semantic Versioning](http://semver.org/).
4+
The file is formatted as described on http://keepachangelog.com/.
5+
6+
## [Unreleased]

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
Abstract Python wrapper KNIME node and helpers.
2+
Used for development of KNIME nodes calling Python scripts.
3+
4+
[![Build Status](https://travis-ci.org/3D-e-Chem/knime-python-wrapper.svg?branch=master)](https://travis-ci.org/3D-e-Chem/knime-python-wrapper)
5+
6+
The nodes in Scripting>Python folder of the node repository (nodes part of the `KNIME Python integration` plugin) the end-user needs to paste Python code in a text area in the node dialog.
7+
Nodes derived from this repo will have a Python script included in their jar file and the dialog of the node will contain no source code text area.
8+
The included Python script is not editable by the end-user, but can read options from dialog like the input column name.
9+
10+
# Usage
11+
12+
Requirements:
13+
14+
* KNIME SDK, https://www.knime.org, version 3.1 or higher
15+
16+
Instructions for KNIME node developers that want to call a Python script.
17+
Several steps must be performed:
18+
19+
[1. Add update site](#1-add-update-site)
20+
[2. Add dependency](#2-add-dependency)
21+
[3. Implement node](#3-implement-node)
22+
[4. Write tests](#4-write-tests)
23+
24+
## 1. Add update site
25+
26+
The releases of this repository are available in the `https://3d-e-chem.github.io/updates` update site.
27+
28+
Configure KNIME SDK by adding the `https://3d-e-chem.github.io/updates` update site in Preferences > Install/Update > Available Software Sites.
29+
30+
To make use of in a Tycho based project add to the `<repositories>` tag of the `pom.xml` file the following:
31+
```
32+
<repository>
33+
<id>3d-e-chem</id>
34+
<layout>p2</layout>
35+
<url>https://3d-e-chem.github.io/updates</url>
36+
</repository>
37+
```
38+
39+
## 2. Add dependency
40+
41+
To implement the node a dependency is needed for the plugin add tests.
42+
To do this add `nl.esciencecenter.e3dchem.knime.python` as a required plugin to the `plugin/META-INF/MANIFEST.MF` and `tests/META-INF/MANIFEST.MF` file.
43+
44+
## 3. Implement node
45+
46+
Create your node config class extended from the `nl.esciencecenter.e3dchem.python.PythonWrapperNodeConfig` class.
47+
Add fields you want to have in the node dialog and be available inside the Python script inside the `options` dictionary.
48+
49+
Create your node model class extended from the `nl.esciencecenter.e3dchem.python.PythonWrapperNodeModel` class.
50+
Overwrite the `python_code_filename` and `required_python_packages` fields in the constructor.
51+
52+
## 4. Write tests
53+
54+
To run tests which execute the node it is needed to setup `KNIME Python integration` plugin.
55+
This can be done by calling `PythonWrapperTestUtils.materializeKNIMEPythonUtils()` in `@BeforeClass` method of a test case.
56+
57+
# Build
58+
59+
```
60+
mvn verify
61+
```
62+
63+
An Eclipse update site will be made in `p2/target/repository` repository.
64+
The update site can be used to perform a local installation.
65+
66+
# Development
67+
68+
Development of code in this repository.
69+
70+
Steps to get development environment setup:
71+
72+
1. Download KNIME SDK from https://www.knime.org/downloads/overview
73+
2. Install/Extract/start KNIME SDK
74+
3. Start SDK
75+
4. Install m2e (Maven integration for Eclipse) + KNIME Python Integration
76+
77+
1. Goto Help > Install new software ...
78+
2. Make sure Update site is http://update.knime.org/analytics-platform/3.1 is in the pull down list otherwise add it
79+
3. Select --all sites-- in work with pulldown
80+
4. Select m2e (Maven integration for Eclipse)
81+
5. Select `KNIME Python Integration`
82+
6. Install software & restart
83+
84+
5. Import this repo as an Existing Maven project
85+
86+
During import the Tycho Eclipse providers must be installed.
87+
88+
# New release
89+
90+
1. Update versions in pom files with `mvn org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=<version>` command.
91+
2. Manually update version of "source" feature in `p2/category.xml` file.
92+
3. Commit and push changes
93+
3. Create package with `mvn package`, will create update site in `p2/target/repository`
94+
4. Append new release to an update site
95+
1. Make clone of an update site repo
96+
2. Append release to the update site with `mvn install -Dtarget.update.site=<path to update site>`
97+
5. Commit and push changes in this repo and update site repo.

p2/category.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<site>
3+
<bundle id="nl.esciencecenter.e3dchem.python.plugin" version="1.0.0">
4+
<category name="nl.esciencecenter.3D-e-Chem"/>
5+
</bundle>
6+
<bundle id="nl.esciencecenter.e3dchem.python.plugin.source" version="1.0.0">
7+
<category name="nl.esciencecenter.3D-e-Chem.sources"/>
8+
</bundle>
9+
<category-def name="nl.esciencecenter.3D-e-Chem" label="KNIME 3D-e-Chem Contributions">
10+
<description>
11+
3D-e-Chem: Collection KNIME nodes &amp; Extensions for the NLeSC 3d-e-Chem project
12+
</description>
13+
</category-def>
14+
<category-def name="nl.esciencecenter.3D-e-Chem.sources" label="KNIME 3D-e-Chem Contributions Sources">
15+
<description>
16+
3D-e-Chem Sources: Sources of KNIME nodes &amp; Extensions for the NLeSC 3d-e-Chem project
17+
</description>
18+
</category-def>
19+
</site>

p2/pom.xml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<parent>
5+
<artifactId>nl.esciencecenter.e3dchem.python</artifactId>
6+
<groupId>nl.esciencecenter.e3dchem.python</groupId>
7+
<version>1.0.0</version>
8+
</parent>
9+
<artifactId>nl.esciencecenter.e3dchem.python.p2</artifactId>
10+
<packaging>eclipse-repository</packaging>
11+
<build>
12+
<plugins>
13+
<plugin>
14+
<groupId>org.eclipse.tycho.extras</groupId>
15+
<artifactId>tycho-p2-extras-plugin</artifactId>
16+
<version>${tycho.extras.version}</version>
17+
<executions>
18+
<execution>
19+
<id>add-to-update-site</id>
20+
<phase>install</phase>
21+
<goals>
22+
<goal>mirror</goal>
23+
</goals>
24+
<configuration>
25+
<source>
26+
<repository>
27+
<url>${project.build.directory}/repository</url>
28+
</repository>
29+
</source>
30+
<destination>${target.update.site}</destination>
31+
<append>true</append>
32+
</configuration>
33+
</execution>
34+
</executions>
35+
</plugin>
36+
</plugins>
37+
</build>
38+
</project>

plugin/META-INF/MANIFEST.MF

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Manifest-Version: 1.0
2+
Bundle-ManifestVersion: 2
3+
Bundle-Name: Abstract Python wrapper KNIME node and helpers
4+
Bundle-SymbolicName: nl.esciencecenter.e3dchem.python.plugin;singleton:=true
5+
Bundle-Version: 1.0.0
6+
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
7+
Bundle-Vendor: Netherlands eScience Center
8+
Require-Bundle: org.knime.core;bundle-version="[3.1.0,4.0.0)",
9+
org.knime.base;bundle-version="[3.1.0,4.0.0)",
10+
org.knime.python;bundle-version="[3.1.0,4.0.0)"
11+
Bundle-ClassPath: .
12+
Export-Package: nl.esciencecenter.e3dchem.python

plugin/build.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
source.. = src/java/
2+
output.. = target/classes/
3+
bin.includes = META-INF/,\
4+
.,\
5+
plugin.xml

plugin/plugin.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<?eclipse version="3.0"?>
3+
<plugin>
4+
<!-- No extensions provided, plugin used to get Python Wrapper dependency inside another project to run implement nodes which call Python scripts -->
5+
</plugin>

0 commit comments

Comments
 (0)