Unleash Dev Tool Mastery with a Flick of Your Wrist
Project description
Unleash Dev Tool Mastery with a Flick of Your Wrist
created by Jens Roland
⚔️ What is Switchblade?
Switchblade is a command line tool that lets you install and run dev tools from a central repository, and configure them in a standardised way across all your projects.
Try it
To use the included python-poetry-base
bundle for Python, create a .switchblade
file in your project root:
[switchblade]
bundle = "gh:jensroland/sentient-switchblade/bundles/python-poetry-base"
mode = "python-poetry"
Then, install Switchblade in your project and call swb lint
to run the standard Python linters configured in the base bundle:
# Install Switchblade
poetry add -G dev sentient-switchblade
# Run linters from the bundle
poetry run swb lint
That's it! :tada: Switchblade will fetch the bundle from Github, install the tools specified in the bundle, and run them with the configurations specified in the bundle. No need to install or configure anything yourself, and no need to commit any dev tooling to your project repo.
Note: The base bundle assumes that your source code lives under src/
and your tests under tests/
, but it is only meant as an example. To specify your own dev tools and tailor them to your needs and project structure, create your own custom bundle (see below).
Who is this for?
Switchblade was born from the question: "How do I ensure that I'm using the same linting and testing configurations across all of my project repositories?" Are all of your Python repos using the same version of Black
? Maybe you switched to flake8
on your newer repos but never updated the old ones? Sure, maybe it doesn't matter very much if your tooling deviates a little between your personal projects, but how about this: when your company's DevSecOps team updated all the templates to include scans for known vulnerabilities and credential leaks, did you remember to update all of your repos? And if not, how would you even know?
To complicate matters, developer tooling is not simply about choosing a particular linter and firing it up. It's also how you configure it -- maximum line lengths, whether to use single or double quotes, what rules to ignore entirely -- as well as which arguments to pass when you invoke it.
In an ideal world, dev tooling would not be checked into version control (seriously) but rather fetched on demand from a centrally managed dev tooling repository, and configured and invoked in exactly the same way in every repo, every time. This would allow for a single source of truth for all dev tooling, and would make it easy to update configurations across all projects.
To achieve this however, you would need some kind of small helper tool to abstract away the fetching, configuring and invoking of your centrally curated 'bundles' of dev tools.
Switchblade is that tool.
Learn more on the Switchblade project website.
Custom bundles
To create your own custom bundle with the dev tools and configurations you need, simply create a new Github repo and add a bundle.toml
file to it:
[bundle]
name = "my-dev-tool-bundle"
mode = "python-poetry"
schema_version = "1.0.0"
# Linters
[linters]
all = ["pylint"]
[linters.pylint]
command = "pylint src"
# Tests
[tests]
all = ["pytest"]
[tests.pytest]
command = "pytest -c pyproject.toml tests"
# Extensions to pyproject.toml
[tool.poetry.group.switchblade]
optional = true
[tool.poetry.group.switchblade.dependencies]
pylint = "^2.17.2"
pytest = "^7.3.1"
[tool.pytest.ini_options]
pythonpath = "src"
And in the same repo folder, add any config files you need, e.g. .pylintrc
:
[MAIN]
[MESSAGES CONTROL]
disable=
C0111, # missing-docstring
C0114, # missing-module-docstring
C0115, # missing-class-docstring
C0116, # missing-function-docstring
W0613, # unused-argument
Now when you want to use your custom bundle in a project, simply point to the repo in the project .switchblade
file as in the example above. Swtichblade will then fetch and install the tools you specified in the bundle and run them with the configurations you specified.
Anything in the bundle.toml
file under a tool.*
section will be temporarily added to the project's pyproject.toml
file under the same section. This allows you to add dependencies and configuration options to all your projects without having to manually edit all the individual pyproject.toml
files.
Prerequisites
Currently, you need Python since you install Switchblade with pip. This may change in the future.
Features
- CLI command
swb lint
to run linters - CLI command
swb test
to run tests - Project 'modes' supported: Currently only
python-poetry
is supported, but more will be added soon.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sentient_switchblade-0.1.2.tar.gz
.
File metadata
- Download URL: sentient_switchblade-0.1.2.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.9.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92690bc0810791de2e1719f44dc876d03845b9503b78bf9a4fcf4713b4560bfe |
|
MD5 | 62b4cdd0aff7e286dc3873470562ea61 |
|
BLAKE2b-256 | 1b3c7a07d335943d4801ee9b75edd30ec3bd1921f5ce291ddf8d1a4c53e0ecfc |
File details
Details for the file sentient_switchblade-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: sentient_switchblade-0.1.2-py3-none-any.whl
- Upload date:
- Size: 14.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.9.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52369910627dd231e63e236e0fa91bd67e1472732d34dfe472fd3e1c8de50caf |
|
MD5 | ec06cfc12f2c2e50540dc038a96b29f9 |
|
BLAKE2b-256 | 1f2f84c886546577052ca325ebc61798a7a39c2c33ea3b1a4845a6d026247cdc |