Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .biobuddies/autoformat-excludes
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Cookiecutter outputs
^\.biobuddies/
^\.editorconfig$
^\.github/copilot-instructions\.md$
^\.github/pull_request_template\.md$
^\.gitignore$
^\.prettierrc\.toml$
^\.shellcheckrc$
^\.yamllint\.yaml$
# Markdown with intentional trailing whitespace
^README\.md$
# Presentations
^documentation/djangocon-us-2024\.md$
^documentation/self2024-python-defined-infrastructure\.md$
33 changes: 23 additions & 10 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,36 @@ env:
CLOUDFLARE_ACCOUNT_ID: 0123456789abcdef0123456789abcdef00
CLOUDFLARE_ZONE_ID: 0123456789abcdef0123456789abcdef01
INSH_TF: tofu
PATH: .venv/bin:/home/runner/.local/bin:/home/runner/.asdf/shims:/usr/bin:/bin
PATH: .venv/bin:/home/runner/.local/bin:/home/runner/.local/share/mise/shims:/usr/bin:/bin
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: bash .biobuddies/includes.bash forceready

- run: .venv/bin/just pcam --color always --show-diff-on-failure
- run: .venv/bin/just hti demo && tofu -chdir=deploys/demo/terraform validate
- run: .venv/bin/just test
# Real hash is head_ref on pull_request, ref on push
- uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ github.head_ref || github.ref }}
- uses: jdx/mise-action@v3
with:
experimental: true
- run: mise run set-environment
- run: mise run pre-commit
- run: mise tvalid demo
- run: mise test
- run: .venv/bin/just build_twine
summarize:
tabularize:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: bash .biobuddies/includes.bash summarize
# Real hash is head_ref on pull_request, ref on push
- uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ github.head_ref || github.ref }}
- uses: jdx/mise-action@v3
with:
experimental: true
- run: mise run tabularize

on: # yamllint disable-line rule:truthy
pull_request:
Expand Down
1 change: 0 additions & 1 deletion .python-version

This file was deleted.

2 changes: 1 addition & 1 deletion .tofu-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.9.0
1.11.5
3 changes: 0 additions & 3 deletions .tool-versions

This file was deleted.

2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ simplest:
- Split files around 500 lines
* Alphabetize, sometimes within sections (header worth a comment)
* Use Python 3.12+ idioms like:
- `from pytest import parametrize`
- `from pytest import mark; @mark.parametrize()`
- `from pathlib import Path; Path('a') / 'b'`
- `from subprocess import check_call, check_output; check_call(...); check_output(...)`
- Usually easiest to not `re.compile` at all than worry about aliasing the builtin
Expand Down
1 change: 1 addition & 0 deletions deploys/demo/terraform/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 13 additions & 11 deletions helicopyter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,17 @@
from os import environ
from pathlib import Path
from re import sub
from subprocess import check_output
from shutil import which
from subprocess import PIPE, CalledProcessError, check_output
from typing import Any, TypeVar

from cdk8s import Chart
from cdktf import App, TerraformElement, TerraformStack
from constructs import Construct, Node
from tap import Tap

environ['JSII_SILENCE_WARNING_UNTESTED_NODE_VERSION'] = '1'


class HeliChart(Chart):
def __init__(self, cona: str) -> None:
super().__init__(App(), cona)
self.cona = cona


class HeliStack(TerraformStack):
def __init__(self, cona: str) -> None:
# Something is automatically creating outdir, which is cdktf.out by default
Expand Down Expand Up @@ -139,9 +133,17 @@ def multisynth(
raise
if hashicorp_configuration_language:
unformatted = '# AUTOGENERATED by helicopyter\n\n' + stack.to_hcl_terraform()['hcl']
autoformatted = check_output( # noqa: S603
[format_with, 'fmt', '-'], input=unformatted.encode()
).decode()
try:
autoformatted = check_output( # noqa: S603
[format_with, 'fmt', '-'], input=unformatted.encode(), stderr=PIPE
).decode()
except CalledProcessError as error:
print(f'which {format_with}: {which(format_with)}')
print(f'{format_with} fmt stderr: {error.stderr}')
print(
f'{format_with} --version: {check_output([format_with, "--version"], stderr=PIPE)}'
) # noqa: S603
raise
formatted = sub(
r'\n{3,}',
'\n\n',
Expand Down
Loading
Loading