Skip to content

Commit 3550cfa

Browse files
ulises-jeremiasulises-jeremias
andauthored
fix(ci): green main for lint, tests, and MegaLinter (#158)
* fix(ci): make main lint, tests, and MegaLinter green Wrap long lines for Ruff, harden --help flag test under narrow CI terminals, fix markdownlint templates/links, tune MegaLinter to the Ruff/Pyright stack, and fix editorconfig/yamllint noise. * fix(ci): disable MegaLinter Python tools covered by Ruff/Pyright jobs MegaLinter's pyright/ruff run without the uv workspace venv and produce false positives; dedicated Lint and Typecheck workflows remain the gate. --------- Co-authored-by: ulises-jeremias <ulises.jeremias@users.noreply.github.com>
1 parent 9f769db commit 3550cfa

21 files changed

Lines changed: 137 additions & 80 deletions

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
## Summary
2+
23
-
34

45
## Test plan
6+
57
- [ ] `make test`
68
- [ ] `make lint`
79
- [ ] `make typecheck`

.github/workflows/smoke-distribution.yml

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -121,20 +121,30 @@ jobs:
121121
run: |
122122
set -euo pipefail
123123
124-
PYPI=$(curl -sfL https://pypi.org/pypi/create-awesome-python-app/json | \
125-
python3 -c "import json,sys; print(json.load(sys.stdin)['info']['version'])")
126-
127-
DOCKER=$(docker run --rm ulisesjeremias/create-awesome-python-app:latest --version 2>&1 \
128-
|| echo "unavailable")
129-
130-
HOMEBREW=$(curl -sfL \
131-
https://raw.githubusercontent.com/Create-Python-App/homebrew-tap/main/Formula/create-awesome-python-app.rb | \
132-
grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1 || echo "unavailable")
133-
134-
AUR=$(curl -sfL \
135-
"https://aur.archlinux.org/rpc/v5/info?arg=create-awesome-python-app" | \
136-
python3 -c "import json,sys; d=json.load(sys.stdin); r=d.get('results') or []; print(r[0]['Version'].split('-')[0] if r else 'unavailable')" \
137-
|| echo "unavailable")
124+
PYPI=$(
125+
curl -sfL https://pypi.org/pypi/create-awesome-python-app/json \
126+
| python3 -c "import json,sys; print(json.load(sys.stdin)['info']['version'])"
127+
)
128+
129+
DOCKER=$(
130+
docker run --rm ulisesjeremias/create-awesome-python-app:latest --version 2>&1 \
131+
|| echo "unavailable"
132+
)
133+
134+
FORMULA_URL="https://raw.githubusercontent.com/Create-Python-App/homebrew-tap/main/Formula/create-awesome-python-app.rb"
135+
HOMEBREW=$(
136+
curl -sfL "$FORMULA_URL" \
137+
| grep -oE '[0-9]+\.[0-9]+\.[0-9]+' \
138+
| head -1 \
139+
|| echo "unavailable"
140+
)
141+
142+
AUR_RPC="https://aur.archlinux.org/rpc/v5/info?arg=create-awesome-python-app"
143+
AUR=$(
144+
curl -sfL "$AUR_RPC" \
145+
| python3 -c "import json,sys; d=json.load(sys.stdin); r=d.get('results') or []; print(r[0]['Version'].split('-')[0] if r else 'unavailable')" \
146+
|| echo "unavailable"
147+
)
138148
139149
echo "Channel versions:"
140150
echo " pypi: $PYPI"

.markdownlint.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"default": true,
33
"MD013": false,
44
"MD033": false,
5-
"MD041": false
5+
"MD041": false,
6+
"MD060": false
67
}

.mega-linter.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# MegaLinter — Python-first config for create-python-app
22
# Adapted from Create-Node-App/create-node-app .mega-linter.yml
3+
#
4+
# Project standards (AGENTS.md): Ruff + Pyright. Disable overlapping
5+
# MegaLinter Python tools that duplicate those checks or fail without
6+
# the workspace venv (pylint import-error, etc.).
37

48
APPLY_FIXES: all
59

@@ -12,11 +16,22 @@ DISABLE_LINTERS:
1216
- JSON_V8R
1317
- REPOSITORY_CHECKOV
1418
- REPOSITORY_GRYPE
15-
- REPOSITORY_OSV_SCANNER # Handled later by dedicated workflow (#51)
19+
- REPOSITORY_OSV_SCANNER # Handled by dedicated workflow
1620
- REPOSITORY_TRIVY
1721
- SPELL_CSPELL
1822
- SPELL_LYCHEE
1923
- YAML_V8R
24+
# Overlap with Ruff / Pyright (project tooling + dedicated type-check.yml)
25+
- PYTHON_PYLINT
26+
- PYTHON_FLAKE8
27+
- PYTHON_BLACK
28+
- PYTHON_ISORT
29+
- PYTHON_MYPY
30+
- PYTHON_PYRIGHT
31+
- PYTHON_BANDIT
32+
- PYTHON_RUFF
33+
# Badge / package pages can 404 briefly after first publish
34+
- MARKDOWN_MARKDOWN_LINK_CHECK
2035

2136
SHOW_ELAPSED_TIME: true
22-
FILTER_REGEX_EXCLUDE: (uv\.lock)
37+
FILTER_REGEX_EXCLUDE: (uv\.lock|megalinter-reports/)

.yamllint.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
extends: default
22
rules:
33
line-length:
4-
max: 120
4+
max: 180
55
allow-non-breakable-inline-mappings: true
66
document-start: disable
7+
truthy:
8+
allowed-values: ["true", "false", "on", "off"]
9+
check-keys: false

Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ ARG VERSION=latest
88

99
# hadolint ignore=DL3013
1010
RUN useradd --create-home --uid 1000 --shell /bin/bash app \
11-
&& if [ "$VERSION" = "latest" ]; then \
12-
pip install --no-cache-dir create-awesome-python-app; \
13-
else \
14-
pip install --no-cache-dir "create-awesome-python-app==${VERSION}"; \
15-
fi
11+
&& if [ "$VERSION" = "latest" ]; then \
12+
pip install --no-cache-dir create-awesome-python-app; \
13+
else \
14+
pip install --no-cache-dir "create-awesome-python-app==${VERSION}"; \
15+
fi
1616

1717
USER app
1818
WORKDIR /home/app

docs/CPA_TEMPLATES_TRACKING.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Tracking: `cpa-templates` + website
22

3-
Previously tracked by https://github.com/Create-Python-App/create-python-app/issues/44 (closed).
3+
Previously tracked by
4+
[issue #44](https://github.com/Create-Python-App/create-python-app/issues/44)
5+
(closed).
46

57
## Status
68

@@ -15,8 +17,8 @@ Previously tracked by https://github.com/Create-Python-App/create-python-app/iss
1517

1618
| Repo | URL |
1719
|------|-----|
18-
| CLI monorepo | https://github.com/Create-Python-App/create-python-app |
19-
| Template bank | https://github.com/Create-Python-App/cpa-templates |
20+
| CLI monorepo | [create-python-app](https://github.com/Create-Python-App/create-python-app) |
21+
| Template bank | [cpa-templates](https://github.com/Create-Python-App/cpa-templates) |
2022

2123
## CNA parity reference
2224

packages/create-awesome-python-app/src/create_awesome_python_app/catalog.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818

1919
console = Console(stderr=True)
2020

21-
DEFAULT_CATALOG_URL = (
22-
"https://raw.githubusercontent.com/Create-Python-App/cpa-templates/main/templates.json"
23-
)
21+
DEFAULT_CATALOG_URL = "https://raw.githubusercontent.com/Create-Python-App/cpa-templates/main/templates.json"
2422
CACHE_TTL_SECONDS = 3600
2523
FETCH_TIMEOUT_SECONDS = 10
2624
USER_AGENT = f"create-awesome-python-app/{__version__} (https://github.com/Create-Python-App/create-python-app)"
@@ -111,22 +109,31 @@ def get_catalog_data(*, force_refresh: bool = False) -> dict[str, Any]:
111109
try:
112110
data = _fetch_remote(url)
113111
_write_disk_cache(data)
114-
except (urllib.error.URLError, TimeoutError, OSError, json.JSONDecodeError) as err:
112+
except (
113+
urllib.error.URLError,
114+
TimeoutError,
115+
OSError,
116+
json.JSONDecodeError,
117+
) as err:
115118
disk = _read_disk_cache()
116119
if disk is not None:
117120
console.print(
118-
f"[yellow][cpa] Could not refresh catalog ({err}); using disk cache.[/yellow]"
121+
"[yellow][cpa] Could not refresh catalog "
122+
f"({err}); using disk cache.[/yellow]"
119123
)
120124
data = disk
121125
else:
122126
fixture = _read_fixture()
123127
if fixture.get("templates"):
124128
console.print(
125-
f"[yellow][cpa] Could not refresh catalog ({err}); using fixture.[/yellow]"
129+
"[yellow][cpa] Could not refresh catalog "
130+
f"({err}); using fixture.[/yellow]"
126131
)
127132
data = fixture
128133
else:
129-
raise RuntimeError(f"Failed to load template catalog: {err}") from err
134+
raise RuntimeError(
135+
f"Failed to load template catalog: {err}"
136+
) from err
130137

131138
_memory_cache = data
132139
_memory_ts = time.time()
@@ -173,7 +180,9 @@ def list_addons(template_slug: str | None = None) -> None:
173180
ext_types = [ext_types]
174181
if template_type and template_type not in ext_types:
175182
continue
176-
type_label = ", ".join(ext_types) if isinstance(ext_types, list) else str(ext_types)
183+
type_label = (
184+
", ".join(ext_types) if isinstance(ext_types, list) else str(ext_types)
185+
)
177186
table.add_row(
178187
str(ext.get("slug", "")),
179188
str(ext.get("category", "")),

packages/create-awesome-python-app/src/create_awesome_python_app/cli.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,7 @@ def scaffold(
103103
if offline:
104104
pass # passed to core
105105

106-
want_interactive = (
107-
interactive if interactive is not None else (not _in_ci())
108-
)
106+
want_interactive = interactive if interactive is not None else (not _in_ci())
109107
if want_interactive and not template:
110108
try:
111109
import questionary

packages/create-awesome-python-app/tests/test_cache_cmds.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
from typer.testing import CliRunner
2-
31
from create_awesome_python_app.cli import cache_app
2+
from typer.testing import CliRunner
43

54
runner = CliRunner()
65

0 commit comments

Comments
 (0)