We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Note
Not tested! Please leave a comment if you have checked any of these methods.
PYTHONPATH
package.json
npm i dotenv-cli
package.json:
{ "scripts": { "dev": "dotenv -v PYTHONPATH=. -- node src/index.js" } }
src/index.js:
src/index.js
const { pymport, proxify } = await import('pymport'); const my_python_module = proxify(pymport('my_python_module'));
Warning
Dynamic imports can make the code more difficult to read and manage because they add asynchronous behavior.
import path from 'node:path'; process.env['PYTHONPATH'] = path.resolve("."); (async () => { const { pymport, proxify } = await import('pymport'); const my_python_module = proxify(pymport('my_python_module')); })();
require
--experimental-require-module
Caution
pymport is officially tested only on Node 16.x, 18.x, and 20.x.
You can read more about this in the Joyee Cheung's article and PR.
{ "scripts": { "start": "node src/index.js", } }
import path from 'node:path'; process.env['PYTHONPATH'] = path.resolve("."); const { pymport, proxify } = require('pymport'); const my_python_module = proxify(pymport('my_python_module'));
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Note
Not tested! Please leave a comment if you have checked any of these methods.
PYTHONPATH
inpackage.json
using dotenv-cli:package.json
:src/index.js
:Warning
Dynamic imports can make the code more difficult to read and manage because they add asynchronous behavior.
require
in Node 23.0 (there no need for a--experimental-require-module
flag):Caution
pymport is officially tested only on Node 16.x, 18.x, and 20.x.
Note
You can read more about this in the Joyee Cheung's article and PR.
package.json
:src/index.js
:The text was updated successfully, but these errors were encountered: