Skip to content

Full-featured template for building extension (xontrib) for the xonsh shell.

License

Notifications You must be signed in to change notification settings

xonsh/xontrib-template

Repository files navigation

A template for creating the xonsh contributions called xontribs.

If you like the template click ⭐ on the repo.

asciicast

Why use this template?

This template includes good pack of prebuilt files:

  • README with the info and xontrib promotion instructions
  • PEP 621 or poetry based pyproject.toml file to make and install PyPi package easily
  • .gitattributes file to enable Github syntax highlighting for *.xsh files
  • .gitignore file with standard list of directories to ignore
  • .github/workflow/push-test.yml to automatically test the code using Github Actions
  • .github/*_template.md files to create Github templates for the text of issue and PR.
  • .github/FUNDING.yml file with template for Github sponsorship button.
  • .pre-commit-config.yaml file with pre-commit-hooks
  • MANIFEST.in file to make Conda feedstock easily
  • LICENSE file with standard MIT license
  • tests/ with the test suite

Create new xontrib

Install copier:

xpip install copier jinja2-time cookiecutter

# OR using pipx (https://pypa.github.io/pipx/):
pipx install copier>=9
pipx inject copier copier-templates-extensions

Create your new xontrib:

copier copy --trust gh:xonsh/xontrib-template .

Advent of PEP-621

Older projects can use the following tools to upgrade their setup to use pyproject.toml

If you have an idea for xontrib but have no time to implement

Development

  • copier selects the latest tag when --vcs-ref option is not given. So it is important to tag the main branch after important template updates.

How to fix pre-commit-hooks

If you're using .pre-commit-config.yaml and have an error during testing you need fix the code i.e.:

xpip install pre-commit-hooks
pre-commit run --all-files black  # or isort, etc

Links