Skip to content
New issue

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

Automatically add commands to JS/Python packages #97

Open
syrusakbary opened this issue Nov 22, 2022 · 0 comments
Open

Automatically add commands to JS/Python packages #97

syrusakbary opened this issue Nov 22, 2022 · 0 comments

Comments

@syrusakbary
Copy link
Member

syrusakbary commented Nov 22, 2022

NPM and Python packages should automatically add the available commands and

Similarly to Zig in Python, where people can do:

python -m ziglang {YOURCOMMANDTOZIG}

Or similarly to cowasm

~$ npx python-wasm@latest
Python 3.11.0 (main, Oct 27 2022, 10:03:11) [Clang 15.0.3 (git@github.com:ziglang/zig-bootstrap.git 0ce789d0f7a4d89fdc4d9571 on wasi
Type "help", "copyright", "credits" or "license" for more information.
>>> 2 + 3
5
>>> import sys; sys.version
'3.11.0 (main, Oct 27 2022, 10:03:11) [Clang 15.0.3 (git@github.com:ziglang/zig-bootstrap.git 0ce789d0f7a4d89fdc4d9571'
>>> sys.platform
'wasi'

How this should work?

If the package has an entrypoint command, that should be run by default relying the args.

JS

In JS, we should add all the runnable webc commands inside of the bin:

package.json

{
  ...
  "bin": { "COMMAND_NAME": "./bin/COMMAND_NAME" },
}

Python

In Python, we can rely on the

setup.py

setup(
    ...
    entry_points={'console_scripts': [
        'COMMAND_NAME = PACKAGE_NAME.commands:FUNCTION_COMMAND',
    ]},
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant