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

Document how to registed pyodide CLI subcommands #16

Merged
merged 4 commits into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ concurrency:

jobs:
test:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v3
Expand All @@ -27,7 +27,7 @@ jobs:
run: |
python -m pytest
deploy:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
environment: PyPi-deploy
steps:
Expand Down
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,5 @@ repos:
hooks:
- id: codespell
args: ["-L", "te,slowy,aray,ba,nd,classs,crate,feld,lits"]
ci:
autoupdate_schedule: "quarterly"
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,32 @@ To get a list of available CLI commands,
pyodide --help
```

## Developers

You can register a subcommand in the `pyodide` CLI in your own package by:

1. adding a dependency on `pyodide-cli`
2. Adding a `pyodide.cli` [entry point](https://setuptools.pypa.io/en/latest/userguide/entry_point.html). For example, with

**setup.cfg**
```toml
[options.entry_points]
pyodide.cli =
do_something = "<your-package>.cli:main"
```

or

**pyproject.toml**
```toml
[project.entry-points."pyodide.cli"]
do_something = "<your-package>.cli:main"
```

where in this example `main` needs to be a function with type annotations
that can be converted to a CLI with [typer](https://typer.tiangolo.com/).


## License

pyodide-cli uses the [Mozilla Public License Version
Expand Down