GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Accessing an environment in a platform independent way. · Issue #2 · scijava/scripting-appose-python Open DescriptionIf I want to run a script, then I need to know the environment. This works, but I know the existence of the pixi.toml. I could also build an environment using the following java program. import org.apposed.appose.*; import java.util.*; public class ApposeBuilder{ //Toml to create a cellpose environment. static final String toml = """ [workspace] authors = [ "Smith, MB", ] channels = ["conda-forge"] name = "example-appose" platforms = ["osx-arm64", "win-64", "linux-64", "osx-64"] version = "0.1.0" [dependencies] python = ">3.10.3" [pypi-dependencies] cellpose = ">=4" appose = ">=0.10.1" """; final static String command = """ import cellpose, sys, pathlib ex = pathlib.Path(sys.executable) #I could use this value with "wrap" env = ex.parent.parent #I can use this value with script parameter. toml = env.parent.parent.parent / "pixi.toml" "%s"%(toml, ) """; public static void main(String[] args) throws Exception{ try( Service python = Appose.pixi().content(toml).build().python() ){ Map<String, Object> inputs = new HashMap<>(); Service.Task task = python.task(command, inputs); task.start(); task.waitFor(); System.out.println(task.result()); } } } If I run that java program, then I will have a python environment with cellpose, and I know the location of the the pixi.toml that I need to point the script engine at. It would be nice if there was a consistent, platform independent way of naming/referencing an environment. ActivityMetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |