This guide describes how to build and publish the Twig package to PyPI using uv.
Ensure you have uv installed:
pip install uv
# or
curl -LsSf https://astral.sh/uv/install.sh | shTo build the package (source distribution and wheel), run:
uv buildThis will create the distribution files in the dist/ directory. uv will automatically use the hatchling build backend defined in pyproject.toml.
To publish the package to PyPI, use uv publish:
uv publishYou will be prompted for your PyPI API token.
Once published to PyPI, users can install Twig using pipx (recommended for CLI tools) or pip.
pipx installs the application in an isolated environment and makes the twg and twig commands available globally.
pipx install twgpip install twgTo install the package in editable mode for development:
uv pip install -e .This allows you to run twig and twg commands directly from your terminal while reflecting changes in the source code immediately.
Twig is built with textual, which runs on macOS, Linux, and Windows. The entry points defined in pyproject.toml will automatically create the appropriate executable scripts (twig.exe on Windows, twig script on Unix) when installed via pip/uv/pipx.