i want to know that is it possible to call biopython library in jython? - jython

I am using netbeans 8.2 with python plugin 8.1. I want to code in jython with using biopython library.
Kindly tell me whether it's possible or not if so than how ?

As far as I see, Biopython libraries are libraries written for Python (and so, in C, C++ or FORTRAN).
You cannot run them directly from Jython because Jython is "Python for Java" - a project where Python language was re-implemented. Jython Documentation mentions:
Unlike the CPython distribution, Jython does not include built-in libraries written in C as they will not work on the Java platform. Instead, there are certain libraries that have been re-written in the Java languages to be included with Jython
But if you also have a Python interpreter installed on your machine, you could run your Python interpreter via commandline. You could also think about invoking Python interpreter via Java exec command from your Jython project, and collect the result, to provide it in a way that you can continue in Jython after fetching the result from Python.

Related

Which Kotlin download do I need?

I'm getting started with Kotlin, and on the downloads page I see two different possibilities that look relevant for me:
kotlin-compiler
kotlin-native-windows
What's the difference? In what case would I need one or the other?
Most probably you won't use CLI to compile, build and run Kotlin projects a lot. Well, maybe you'll need a standalone compiler a few times compiling "Hello world" when starting with this language. BTW, you can use https://try.kotlinlang.org to compile simple programs and play with the language without local installations.
But as you proceed, it won't be enough. Most Kotlin projects today use either Gradle or Maven. Gradle scripts could be written in Kotlin themselves. I recommend you taking this extra step and use build tools instead of standalone compiler, as it will simplify a lot if things in future. IntelliJ IDEA, the most popular IDE for Kotlin made by JetBrains, the company behind Kotlin, allows you to create Gralde-based Kotlin projects in a few clicks.
Kotlin is a multi-platform language. It can be compiled to produce binaries compatible either with:
Java
JavaScript
A native platform (Windows, Linux, iOS, etc.)
Which compiler you should choose depends on your needs. If you don't need to make your code operate with a C library or a specific OS tool, I'd recommend the kotlin-compiler, so you'll get an app executable through Java, which (at least for now) produce more optimized programs, and also easily portable (install a jre on target computer and you're ready to execute your Kotlin program). Plus, you'll be able to use any Java lib you need in your kotlin program.
Note : Official documentation contains guides to get started:
Command line compiler for JVM
Command line compiler for native executables

Problems using pyd files on Sikuli IDE

I'm trying to use the pyodbc package on Sikuli IDE, but I'm running into some issues because it seems that Sikuli cannot identify pyd files.
I placed the pyd file in the Sikulix\Lib folder, but when I try to import it, I keep getting the message "No module named pyodbc".
with SikuliX (since it is jython/java based) only pure python language modules or modules ported to Jython can be used.
Modules like pyodbc contain C-based stuff or depend on native libs - not posible to use with SikuliX
RaiMan (developer of SikuliX)

How can we use Sikuli with Selenium in Python?

I know that how we can use Sikuli in Java. But I have some code in Python which is automating a web application, and I want to use Sikuli in it. I searched a lot on the Internet about how we can use Sikuli in Python. But I did not find any good resource related to it.
How can I import Sikuli script in a Python project in Eclipse? When I added the sikuli-script.jar file in the Python path in Eclipse and when I am trying to use
import * from sikuli
Then I am getting "there is no such type of module named sikuli".
Sikuli is a tool written in Java and hence you can't use it in your Python code as is. Instead you have the option to use it within a Jython environment, that provides you the Python syntax and enables running jar packages. If you are not using many third party Python libraries and mainly stick to the generic functionality, you shouldn't get into too much trouble transferring from pure Python to Jython.
There are clear instructions of how to use Sikuli with Jython on SikuliX official website. If you have any related questions, you can post the here.

How to export Sikuli scripts to java?

I am new to automation and have to use Sikuli, can you all tell me how to export Sikuli script in java also is it possible to integrate those scripts with Selenium....
Thanks in advance.....
"export" scripts to Java is not possible in this sense, since Sikuli scripts are written in Python scripting language and the scripts itself are run using the Jython interpreter (Java base implementation of Python language).
But since the the essential Sikuli features are implemented using Java, you might transcript/translate a script to Java code, since the Sikuli functions are nearly identical on the Python API level and the Java API level.
But if you have more complex Sikuli Scripts, that you want to run from Java code, there are options to do that:
run the script like from command line, but in a subprocess
run the script using Sikuli's ScriptRunner

Using Jython with Maven

I have a Maven module, that depends on various other Maven dependencies by which I am accessing through my jython code.
I am now done, and I would like to compile the project as a .jar, or even just run it without compiling, but I have no clue where to start.
Does anyone have any idea how I can run some .py files that accesses some Java libraries in other packages?
Also, how can I compile it as a .jar file when all is done and good?
Thanks!
Compiling and integrating python
Use the jython-compile-maven-plugin. It allows you to deploy a standalone project that includes jython with libraries.
For demonstration of this plugin, see the demo project and its source code. It shows how to
launch a python console -- look at AbstractInitJython and InitJython on how to launch a python/jython console, how to execute python code snippets, and how to run a python script.
include python libraries -- the plugin also downloads and bundles python libraries (using easy_install) in the package phase, and adds them to the jar. The resulting jar can have all the libraries of the project, all pom dependencies and all the python libraries requested. The demo project shows this with the "nose" python library (see the pom file).
Testing python / jython code
The python-test-maven-plugin allows you to run your python tests alongside the normal junit tests. The demo project (look at the source at source code) shows the use of standard python unit tests (with nose) and BDD (behaviour testing) with the lettuce-clone freshen.
The sourceforge umbrella project is http://mavenjython.sourceforge.net/
Unlike maven-jython-plugin, they don't use the outdated jythonc compiler.
I am now done, and I would like to compile the project as a .jar,
It looks like there is a maven-jython-plugin allowing to compile jython source files to Java class files.
I've kinda figured out my answer to this. I shouldn't have tried to compile it, but instead wrap the python code with Java: http://jythonpodcast.hostjava.net/jythonbook/en/1.0/JythonAndJavaIntegration.html#using-jython-within-java-applications
The compiler portion of jython, jythonc, is deprecated as of 2.5 -- http://wiki.python.org/jython/ReplaceJythonc -- a replacement is in the works.