Skip to main content

Bastet Python Developers Tools (https://github.com/mewbotorg/bastet)

Project description

Bastet

Bastet, the cat god, takes all of our tests and puts them in one basket.

Bastet is another attempt to simplify linting and testing python projects. It runs a range of linting tools, parses the output, and outputs reports in different formats based on the use case.

The aim of these tools is that, if you run them on a code base, you should end up with something which conforms to your organisations style guidelines, and passes a variety of

Functionality

While developing mewbot we built a number of tools to assist with development.

This mostly consist of tool chains for:

  • Automatically reformatting code.
  • Managing license / copyright information.
  • Running static analysis tooling.
  • Checking the code base against style requirements.
  • Running unit tests.

And it can output in a variety of ways:

  • Simple lists of issues for local development.
  • CI output format for GitHub workflows
  • Reports for ingestion by Sonar.

Usage

The dev tools uses path based auto-discovery to locate the relevant code. Python modules will be discovered in folders called src and test which are not exclude by version control.

If your project is in that src-dir layout, you can install bastet and then run any of the toolchains.

pip install bastet

# Runs all the tools
bastet

# You can also run just some tools or sections
bastet --help
bastet --skip format pylint

We also recommend that you set up bastet as a pre-commit or pre-push hook.

Configuration

The default unconfirmed mode of Bastet is to run all of its tools (be they code formatting, linting, or auditing) and outputting a list of issues.

The recommended pyproject.toml to set up your project can be found in the examples folder. It enables all of the ruff linting rules, excluding a few which conflict with each other. It also disables the black and isort formatting tools, which ruff provides an implementation of.

Advance Config and Debug

You can check what the configuration is doing with --debug the debug flag on a run, or by running python -m bastet.config to just run the configuration steps.

Integration with Sonar

Using the sonar reporter will output a number of files into reports for Sonar to ingest.

Ensure that Sonar is above to read the output from Bastet's run in your CI setup, and then configure the following properties in Sonar's admin or your sonar-project.properties file:

sonar.python.coverage.reportPaths=reports/coverage.xml
sonar.python.xunit.reportPaths=reports/junit-*.xml
sonar.python.ruff.reportPaths=reports/ruff.txt
sonar.python.pylint.reportPaths=reports/pylint.txt

Integration with Gitlab

Bastet can produce up to three reports that GitLab can directly integrate into merge requests (code quality, test results, and coverage) using the gitlab reporter. A sample CI stage can be found in examples/gitlab-ci.yml.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bastet-0.1.3.dev2.tar.gz (36.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bastet-0.1.3.dev2-py3-none-any.whl (43.8 kB view details)

Uploaded Python 3

File details

Details for the file bastet-0.1.3.dev2.tar.gz.

File metadata

  • Download URL: bastet-0.1.3.dev2.tar.gz
  • Upload date:
  • Size: 36.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bastet-0.1.3.dev2.tar.gz
Algorithm Hash digest
SHA256 67e721f0d214bf276a4aa24e49d8f238cb5c0907310201d8874e84a5a485f7b2
MD5 da9bfbd435de43bc443b78a71e75e2bf
BLAKE2b-256 8a95acab4a0969372d390f60c9552544ef7eb20b82056bcb927f6da5bf2c28bd

See more details on using hashes here.

File details

Details for the file bastet-0.1.3.dev2-py3-none-any.whl.

File metadata

  • Download URL: bastet-0.1.3.dev2-py3-none-any.whl
  • Upload date:
  • Size: 43.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bastet-0.1.3.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 552147efa0af491b6fab3dd9db1dbcf01e994221266f3c3eda2f7c81af7de240
MD5 ad01007b4eadd8f8f88dd5b69f7a712a
BLAKE2b-256 b81cb595de133cd12f74a922ff12a9dc7c86dd331a6e39baf0e48c57b005f5b9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page