-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #211 from pythoninthegrass/main
refactor: tooling
- Loading branch information
Showing
19 changed files
with
4,362 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Release Please | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
release-please: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Release with release-please | ||
uses: google-github-actions/release-please-action@v4 | ||
with: | ||
# PAT with write access to the repository | ||
token: ${{ secrets.RELEASE_PLEASE_TOKEN }} | ||
# optional. customize path to release-please-config.json | ||
config-file: release-please-config.json | ||
# optional. customize path to .release-please-manifest.json | ||
manifest-file: .release-please-manifest.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
fail_fast: true | ||
|
||
repos: | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.2.2 | ||
hooks: | ||
- id: ruff | ||
args: [--fix, --exit-non-zero-on-fix] | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: check-added-large-files | ||
args: ['--maxkb=1024'] | ||
- id: check-docstring-first | ||
exclude: | | ||
(?x)^( | ||
hello.py | ||
)$ | ||
- id: check-executables-have-shebangs | ||
- id: check-merge-conflict | ||
- id: check-shebang-scripts-are-executable | ||
- id: check-symlinks | ||
- id: check-toml | ||
- id: check-yaml | ||
args: [--unsafe] | ||
- id: debug-statements | ||
- id: destroyed-symlinks | ||
- id: detect-private-key | ||
- id: end-of-file-fixer | ||
- id: fix-byte-order-marker | ||
- id: mixed-line-ending | ||
- id: pretty-format-json | ||
# https://pre-commit.com/#regular-expressions | ||
exclude: | | ||
(?x)^( | ||
.devcontainer/devcontainer.json| | ||
.vscode/launch.json| | ||
.vscode/settings.json| | ||
.vscode/extensions.json | ||
)$ | ||
args: ['--autofix', '--indent=2', '--no-sort-keys'] | ||
- id: requirements-txt-fixer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
".": "3.8.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
python 3.11.4 | ||
poetry 1.5.1 | ||
python 3.11.6 | ||
poetry 1.7.1 | ||
nodejs 21.4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"recommendations": [ | ||
"aaron-bond.better-comments", | ||
"codezombiech.gitignore", | ||
"eamodio.gitlens", | ||
"EditorConfig.EditorConfig", | ||
"GitHub.copilot-chat", | ||
"GitHub.copilot", | ||
"mads-hartmann.bash-ide-vscode", | ||
"ms-azuretools.vscode-docker", | ||
"ms-python.python", | ||
"ms-vscode.atom-keybindings", | ||
"ms-vsliveshare.vsliveshare", | ||
"redhat.vscode-yaml", | ||
"timonwong.shellcheck", | ||
"yzhang.markdown-all-in-one" | ||
] | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -170,32 +170,105 @@ source .venv/bin/activate | |
python -m pip install -r requirements.txt | ||
``` | ||
|
||
### Pre-commit hooks | ||
|
||
Pre-commit hooks are installed via `pre-commit` and are run automatically on `git commit`. | ||
|
||
Most importantly, `ruff` is used to lint all python code. | ||
|
||
* Install [pre-commit](https://pre-commit.com/#install) | ||
* Install pre-commit hooks | ||
```bash | ||
pre-commit install | ||
``` | ||
* Trigger pre-commit hooks automatically on `git commit` | ||
```bash | ||
git add . | ||
git commit -m "commit message" | ||
``` | ||
* Bypass pre-commit hooks | ||
* Sometimes, it's necessary to bypass pre-commit hooks. This can be done with the `--no-verify` flag. | ||
```bash | ||
git commit -m "commit message" --no-verify | ||
``` | ||
### Conventional Commits | ||
While not currently enforced, by using [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/#summary), it's possible to automatically generate changelogs and version numbers via [release-please](https://github.com/googleapis/release-please). | ||
|
||
To help with that, the [commitizen](https://commitizen-tools.github.io/commitizen/) tool can be installed. | ||
|
||
#### Usage | ||
|
||
```bash | ||
# install cz | ||
npm install -g commitizen cz-conventional-changelog | ||
# make repo cz friendly | ||
commitizen init cz-conventional-changelog --save-dev --save-exact | ||
npm install | ||
# add file to commit | ||
git add .gitignore | ||
# run cz | ||
λ git cz | ||
[email protected], [email protected] | ||
? Select the type of change that you're committing: chore: Other changes that don't modify src or test files | ||
? What is the scope of this change (e.g. component or file name): (press enter to skip) .gitignore | ||
? Write a short, imperative tense description of the change (max 81 chars): | ||
(17) update .gitignore | ||
? Provide a longer description of the change: (press enter to skip) | ||
? Are there any breaking changes? No | ||
? Does this change affect any open issues? No | ||
[main 0a9920d] chore(.gitignore): update .gitignore | ||
1 file changed, 131 insertions(+) | ||
λ git push | ||
``` | ||
|
||
### Formatting | ||
|
||
> **TL;DR**: The [Ruff formatter](https://astral.sh/blog/the-ruff-formatter) is an extremely fast Python formatter, written in Rust. It’s over 30x faster than Black and 100x faster than YAPF, formatting large-scale Python projects in milliseconds — all while achieving >99.9% Black compatibility. | ||
|
||
* While it runs automatically on commits, it can also be run manually | ||
```bash | ||
# check for errors | ||
ruff check . | ||
# fix (some) errors automatically | ||
ruff check . --fix | ||
``` | ||
|
||
### Additional tooling | ||
|
||
Additional tooling includes but is not limited to: | ||
#### TODO | ||
|
||
* Add [devbox](https://www.jetpack.io/devbox/) 👌 | ||
|
||
#### asdf | ||
|
||
* Install [asdf](https://asdf-vm.com/guide/getting-started.html#_2-download-asdf) | ||
* Usage | ||
* Add plugins | ||
```bash | ||
# add python plugin | ||
asdf plugin-add python | ||
|
||
asdf plugin-add poetry https://github.com/asdf-community/asdf-poetry.git | ||
asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git | ||
``` | ||
* Usage | ||
* Install local plugins in repo | ||
```bash | ||
asdf install | ||
``` | ||
* Install specific plugins | ||
```bash | ||
# install stable python | ||
asdf install python <latest|3.11.4> | ||
# set stable to system python | ||
asdf global python latest | ||
|
||
# add poetry asdf plugin | ||
asdf plugin-add poetry https://github.com/asdf-community/asdf-poetry.git | ||
|
||
# install latest version via asdf | ||
asdf install poetry <latest|1.5.1> | ||
|
||
# set latest version as default | ||
asdf global poetry latest | ||
``` | ||
|
||
#### shellcheck | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# TODO: export all dynamic vars from NonSteamLaunchers.sh here | ||
# TODO: read into main.py or config.py (latter's preferable) |
Oops, something went wrong.