-
Notifications
You must be signed in to change notification settings - Fork 6
feat: rebase the gts-python to gts spec 0.13 #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
70f4079
ce47301
1c0c3ba
52ef751
83ef3b3
85f886b
fc6c41d
82f18f2
d32a737
44659b5
0d0cf22
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,7 @@ wheels/ | |
| *.egg | ||
|
|
||
| # Virtual environments | ||
| .venv/ | ||
| venv/ | ||
| ENV/ | ||
| env/ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,30 @@ | ||
| CI := 1 | ||
|
|
||
| .PHONY: help build dev-fmt all check fmt lint mypy test security update-spec e2e coverage | ||
| # These recipes rely on POSIX tools (command -v, touch, rm -rf, sleep, kill, | ||
| # cat) and POSIX syntax (background jobs, inline env assignments). Require Bash | ||
| # explicitly so GNU Make does not fall back to cmd.exe via COMSPEC on Windows. | ||
| # On Windows, run these targets from a Bash environment (e.g. Git Bash / MSYS2). | ||
| SHELL := /bin/bash | ||
|
|
||
| # Python: PYTHON_BOOTSTRAP is used only to create the virtual environment; | ||
| # PYTHON is the venv interpreter used by all other targets. | ||
| PYTHON_BOOTSTRAP ?= $(shell command -v python3 2>/dev/null || command -v python 2>/dev/null || echo python3) | ||
| PY_ENV_DIR ?= .venv | ||
| ifeq ($(OS),Windows_NT) | ||
| PYTHON ?= $(PY_ENV_DIR)/Scripts/python | ||
| else | ||
| PYTHON ?= $(PY_ENV_DIR)/bin/python | ||
| endif | ||
| PY_ENV_STAMP := $(PY_ENV_DIR)/.stamp | ||
| INSTALL_STAMP := $(PY_ENV_DIR)/.install-stamp | ||
|
|
||
| ifneq ($(filter install-local uninstall-local,$(MAKECMDGOALS)),) | ||
| ifeq ($(origin PYTHON),file) | ||
| $(error PYTHON must be set for local package targets (examples: venv: PYTHON=.venv/bin/python3.13 make install-local; global: PYTHON=python3.13 make install-local)) | ||
| endif | ||
| endif | ||
|
|
||
| .PHONY: help py-env install build install-local uninstall-local clean dev-fmt all check fmt lint clippy mypy test security update-spec e2e coverage | ||
|
|
||
| # Default target - show help | ||
| .DEFAULT_GOAL := help | ||
|
|
@@ -9,61 +33,103 @@ CI := 1 | |
| help: | ||
| @awk '/^# / { desc=substr($$0, 3) } /^[a-zA-Z0-9_-]+:/ && desc { target=$$1; sub(/:$$/, "", target); printf "%-20s - %s\n", target, desc; desc="" }' Makefile | sort | ||
|
|
||
| # Build/install the package in development mode | ||
| build: | ||
| pip install -e ./gts | ||
| # -------- Environment -------- | ||
|
|
||
| # Fix formatting issues | ||
| dev-fmt: | ||
| ruff format gts/src | ||
| # Create/update the virtual environment and install dev/test dependencies | ||
| py-env: $(PY_ENV_STAMP) | ||
|
|
||
| # Run all checks and build | ||
| all: check build | ||
| $(PY_ENV_STAMP): gts/pyproject.toml .gts-spec/tests/requirements.txt Makefile | ||
| @echo "Creating/updating Python virtual environment in $(PY_ENV_DIR)..." | ||
| $(PYTHON_BOOTSTRAP) -m venv $(PY_ENV_DIR) | ||
| $(PYTHON) -m pip install --upgrade pip | ||
| $(PYTHON) -m pip install -r .gts-spec/tests/requirements.txt | ||
| $(PYTHON) -m pip install --no-deps 'httprunner>=4,<5' | ||
| $(PYTHON) -m pip install ruff mypy | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| @touch $@ | ||
|
|
||
| # Install gts package into the venv (editable, for development) | ||
| install: $(INSTALL_STAMP) | ||
|
|
||
| $(INSTALL_STAMP): $(PY_ENV_STAMP) gts/pyproject.toml | ||
| $(PYTHON) -m pip install -e ./gts | ||
| @touch $@ | ||
|
|
||
| # Build source and wheel distributions into dist/ | ||
| build: py-env | ||
| $(PYTHON) -m pip install --upgrade build | ||
| $(PYTHON) -m build --outdir dist ./gts | ||
|
|
||
| # Install the locally built wheel, equivalent to installing the published gts package | ||
| install-local: build | ||
| $(PYTHON) -m pip install --force-reinstall dist/gts-*.whl | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Invalidate If 🤖 Prompt for AI Agents |
||
|
|
||
| # Uninstall gts from the selected interpreter | ||
| uninstall-local: | ||
| $(PYTHON) -m pip uninstall --yes gts | ||
| @rm -f $(INSTALL_STAMP) | ||
|
|
||
| # Remove venv and build artifacts | ||
| clean: | ||
| rm -rf $(PY_ENV_DIR) dist/ gts/dist/ gts/*.egg-info | ||
|
|
||
| # -------- Code quality -------- | ||
|
|
||
| # Fix formatting issues | ||
| dev-fmt: py-env | ||
| $(PYTHON) -m ruff format gts/src | ||
|
|
||
| # Check code formatting | ||
| fmt: | ||
| ruff format --check gts/src | ||
| fmt: py-env | ||
| $(PYTHON) -m ruff format --check gts/src | ||
|
|
||
| # Run linter (ruff) | ||
| lint: | ||
| ruff check gts/src | ||
| lint: py-env | ||
| $(PYTHON) -m ruff check gts/src | ||
|
|
||
| # Run clippy-equivalent linter with auto-fix | ||
| clippy: | ||
| ruff check --fix gts/src | ||
| clippy: py-env | ||
| $(PYTHON) -m ruff check --fix gts/src | ||
|
|
||
| # Run type checker | ||
| mypy: | ||
| mypy gts/src/gts --ignore-missing-imports | ||
| mypy: py-env | ||
| $(PYTHON) -m mypy gts/src/gts --ignore-missing-imports | ||
|
|
||
| # Run all tests | ||
| test: | ||
| pytest tests/ -v | ||
| # -------- Tests -------- | ||
|
|
||
| # Check dependencies for security vulnerabilities | ||
| security: | ||
| @command -v pip-audit >/dev/null || (echo "Installing pip-audit..." && pip install pip-audit) | ||
| pip-audit | ||
| # Run all tests | ||
| test: install | ||
| $(PYTHON) -m pytest tests/ -v | ||
|
|
||
| # Measure code coverage | ||
| coverage: | ||
| pytest tests/ --cov=gts --cov-report=xml --cov-report=term | ||
|
|
||
| # Update gts-spec submodule to latest | ||
| update-spec: | ||
| git submodule update --remote .gts-spec | ||
| coverage: install | ||
| $(PYTHON) -m pip install 'pytest-cov>=5,<7' | ||
| $(PYTHON) -m pytest tests/ --cov=gts --cov-report=xml --cov-report=term | ||
|
|
||
| # Run end-to-end tests against gts-spec | ||
| e2e: build | ||
| e2e: install | ||
| @echo "Starting server in background..." | ||
| @python -m gts server --port 8000 & echo $$! > .server.pid | ||
| @$(PYTHON) -m gts server --port 8000 & echo $$! > .server.pid | ||
| @sleep 2 | ||
| @echo "Running e2e tests..." | ||
| @PYTHONDONTWRITEBYTECODE=1 pytest -p no:cacheprovider --log-file=e2e.log ./.gts-spec/tests || (kill `cat .server.pid` 2>/dev/null; rm -f .server.pid; exit 1) | ||
| @PYTHONDONTWRITEBYTECODE=1 $(PYTHON) -m pytest -p no:cacheprovider --log-file=e2e.log ./.gts-spec/tests || (kill `cat .server.pid` 2>/dev/null; rm -f .server.pid; exit 1) | ||
| @echo "Stopping server..." | ||
| @kill `cat .server.pid` 2>/dev/null || true | ||
| @rm -f .server.pid | ||
| @echo "E2E tests completed successfully" | ||
|
|
||
| # -------- Misc -------- | ||
|
|
||
| # Check dependencies for security vulnerabilities | ||
| security: py-env | ||
| $(PYTHON) -m pip install pip-audit | ||
| $(PYTHON) -m pip_audit | ||
|
Comment on lines
+123
to
+125
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🛡️ Analyzed with Security Review | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- Makefile target definitions ---'
cat -n Makefile | sed -n '70,115p'
printf '%s\n' '--- dependency files ---'
git ls-files | grep -E '(^|/)(pyproject\.toml|requirements[^/]*\.txt|setup\.cfg|setup\.py)$|(^|/)Makefile$' | sort
printf '%s\n' '--- GTS dependency declarations ---'
for f in $(git ls-files | grep -E '(^|/)pyproject\.toml$|(^|/)requirements[^/]*\.txt$' | grep -E '(^|/)gts/|\.gts-spec/'); do
printf '\n### %s\n' "$f"
cat -n "$f"
doneRepository: GlobalTypeSystem/gts-python Length of output: 2753 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- Makefile setup and install targets ---'
cat -n Makefile | sed -n '1,70p'
printf '%s\n' '--- root requirements.txt ---'
cat -n requirements.txt
printf '%s\n' '--- submodule status and tracked dependency paths ---'
git submodule status -- .gts-spec || true
git ls-tree HEAD .gts-spec
git ls-files .gts-spec | sed -n '1,40p'Repository: GlobalTypeSystem/gts-python Length of output: 2981 Security Misconfiguration (CWE-1395) Make
🤖 Prompt for AI Agents |
||
|
|
||
| # Update gts-spec submodule to latest | ||
| update-spec: | ||
| git submodule update --remote .gts-spec | ||
|
|
||
| # Run all checks and build | ||
| all: check build | ||
|
|
||
| # Run all quality checks | ||
| check: fmt lint test e2e | ||
Uh oh!
There was an error while loading. Please reload this page.