Skip to content

Commit

Permalink
Document how to register pyodide CLI subcommands (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
rth authored Dec 12, 2022
1 parent 9c392a6 commit b9b82c0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
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

0 comments on commit b9b82c0

Please sign in to comment.