Repository: pyodide/pytest-pyodide (language: python)

Issue:
Document usage
It would be good to document  usage, with something like,
 - downloading the pyodide dist
 - using the included fixtures

Maybe in the readme for a start


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index c069e924..9ac2fa9e 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -142,3 +142,23 @@ jobs:
         if: ${{ github.event.repo.name == 'pyodide/pytest-pyodide' || github.event_name == 'pull_request' }}
         with:
           fail_ci_if_error: true
+  deploy:
+    runs-on: ubuntu-latest
+    if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
+    environment: PyPi-deploy
+    steps:
+      - uses: actions/checkout@v2
+
+      - uses: actions/setup-python@v3
+        with:
+          python-version: 3.10.2
+      - name: Install requirements and build wheel
+        shell: bash -l {0}
+        run: |
+          python -m pip install build twine
+          python -m build .
+      - name: Publish package
+        uses: pypa/gh-action-pypi-publish@release/v1
+        with:
+          user: __token__
+          password: ${{ secrets.PYPI_API_TOKEN }}
diff --git a/README.md b/README.md
index 26c391fd..03c51f24 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
 [![codecov](https://codecov.io/gh/pyodide/pytest-pyodide/branch/main/graph/badge.svg?token=U7tWHpJj5c)](https://codecov.io/gh/pyodide/pytest-pyodide)
 
 
-Pytest plugin for testing Pyodide and third-party applications that use Pyodide"
+Pytest plugin for testing Pyodide and third-party applications that use Pyodide
 
 ## Installation
 
@@ -19,7 +19,32 @@ You would also one at least one of the following runtimes,
 
 ## Usage
 
-TODO
+1. First you would need a compatible version of Pyodide. You can download the Pyodide build artifacts from releases with,
+   ```
+   wget https://github.com/pyodide/pyodide/releases/download/0.21.0a3/pyodide-build-0.21.0a3.tar.bz2
+   tar xjf pyodide-build-0.21.0a3.tar.bz2
+   mv pyodide dist/
+   ```
+
+2. You can then use the provided fixtures (`selenium`, `selenium_standalone`) in tests,
+   ```py
+   def test_a(selenium):
+       selenium.run("assert 1+1 == 2")   # run Python with Pyodide
+
+   ```
+   which you can run with
+   ```bash
+   pytest --dist-dir=./dist/
+   ```
+3. For convenience, the `run_in_pyodide` decorator is also provided. For
+   instance the above example would be equivalent to,
+   ```py
+   from pytest_pyodide import run_in_pyodide
+
+   @run_in_pyodide
+   def test_a(selenium):
+       assert 1+1 == 2
+   ```
 
 ## License
 
diff --git a/pyproject.toml b/pyproject.toml
index 6eba6a1b..abcd6443 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,3 +1,9 @@
+[build-system]
+requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"]
+
+# Evable versioning via setuptools_scm
+[tool.setuptools_scm]
+
 [tool.mypy]
 python_version = "3.10"
 show_error_codes = true
diff --git a/setup.cfg b/setup.cfg
index c00e9034..0b0e23ea 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,5 @@
 [metadata]
 name = pytest-pyodide
-version = 0.21.0.dev0
 author = Pyodide developers
 description = "Pytest plugin for testing Pyodide and third-party applications that use Pyodide"
 long_description = file: README.md


Test patch:
diff --git a/pytest_pyodide/__init__.py b/pytest_pyodide/__init__.py
index bd55fff0..9ec4bd1b 100644
--- a/pytest_pyodide/__init__.py
+++ b/pytest_pyodide/__init__.py
@@ -1,3 +1,5 @@
+from importlib.metadata import PackageNotFoundError, version
+
 from .browser import (
     BrowserWrapper,
     NodeWrapper,
@@ -13,6 +15,12 @@
 from .server import spawn_web_server
 from .utils import parse_driver_timeout, set_webdriver_script_timeout
 
+try:
+    __version__ = version("pytest-pyodide")
+except PackageNotFoundError:
+    # package is not installed
+    pass
+
 __all__ = [
     "BrowserWrapper",
     "SeleniumWrapper",