Skip to content

Commit

Permalink
read plugin's conda dependencies from pyproject.toml rather than hard…
Browse files Browse the repository at this point in the history
…-coding
  • Loading branch information
emlys committed Jan 10, 2025
1 parent b9a8c7d commit 05ecf09
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions workbench/src/main/setupAddRemovePlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,16 @@ export function setupAddPlugin() {
const pluginID = pyprojectTOML.tool.natcap.invest.model_id;
const pluginName = pyprojectTOML.tool.natcap.invest.model_name;
const pluginPyName = pyprojectTOML.tool.natcap.invest.pyname;
const condaDeps = pyprojectTOML.tool.natcap.invest.conda_dependencies;

// Create a conda env containing the plugin and its dependencies
const envName = `invest_plugin_${pluginID}`;
const pluginEnvPrefix = upath.join(rootPrefix, envName)
await spawnWithLogging(
micromamba,
['create', '--yes', '--prefix', `"${pluginEnvPrefix}"`,
'-c', 'conda-forge', '"python<3.12"', '"gdal<3.6"']
);
const createCommand = [
'create', '--yes', '--prefix', `"${pluginEnvPrefix}"`,
'-c', 'conda-forge']; // include dependencies read from pyproject.toml
condaDeps.forEach((dep) => createCommand.push(`"${dep}"`))
await spawnWithLogging(micromamba, createCommand);
logger.info('created micromamba env for plugin');
await spawnWithLogging(
micromamba,
Expand Down

0 comments on commit 05ecf09

Please sign in to comment.