Skip to content

Add pythonPath/localModules config option for local Python modules #131

@bbopen

Description

@bbopen

Problem

When generating wrappers for local Python modules, users need to set PYTHONPATH manually:

PYTHONPATH=./python npx tywrap generate

The generator silently produces nothing if Python can't find the modules. There's no config option to specify where local modules live.

Current Behavior

// tywrap.config.ts
export default defineConfig({
  pythonModules: {
    'my_local_module': { functions: ['my_func'] }  // Won't find without PYTHONPATH
  }
});

Proposed Solution

Add a pythonPath or localModules option to the config:

export default defineConfig({
  pythonPath: ['./python', './src/python'],  // Added to PYTHONPATH during generation
  // or
  localModules: {
    path: './python',
    modules: ['my_local_module']
  },
  pythonModules: {
    'my_local_module': { functions: ['my_func'] }
  }
});

Additional Context

Labels

enhancement, config, developer-experience

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions