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
54 changes: 54 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"name": "Python",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"ghcr.io/devcontainers/features/python:1": {
"version": "latest",
"installTools": false,
"installJupyterlab": false,
"toolsToInstall": "mypy"
},
"ghcr.io/va-h/devcontainers-features/uv:1": {},
"ghcr.io/devcontainers-contrib/features/shfmt:1": {},
"ghcr.io/dhoeric/features/hadolint:1": {},
"ghcr.io/michidk/devcontainers-features/typos:1": {},
"ghcr.io/devcontainers/features/common-utils:2": {
"configureZshAsDefaultShell": true
}
},
"postCreateCommand": ".devcontainer/postCreateCommand.sh",
"remoteUser": "vscode",
"containerUser": "vscode",
"customizations": {
"vscode": {
"extensions": [
"charliermarsh.ruff",
"exiasr.hadolint",
"foxundermoon.shell-format",
"GitHub.copilot",
"GitHub.vscode-github-actions",
"Gruntfuggly.todo-tree",
"ms-azuretools.vscode-docker",
"ms-python.mypy-type-checker",
"njpwerner.autodocstring",
"oderwat.indent-rainbow",
"tamasfe.even-better-toml",
"tekumara.typos-vscode",
"timonwong.shellcheck",
"-ms-python.vscode-pylance"
],
"settings": {
"terminal.integrated.defaultProfile.linux": "zsh",
"python.defaultInterpreterPath": "./.venv/bin/python",
"[python]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
},
"editor.defaultFormatter": "charliermarsh.ruff"
}
}
}
}
}
16 changes: 16 additions & 0 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

set -euxo pipefail

uv sync --dev --all-extras
uv run pre-commit install --allow-missing-config

cat<<'A'>> ~/.zshrc
eval "$(uv generate-shell-completion zsh)"
eval "$(uvx --generate-shell-completion zsh)"
command -v deactivate &>/dev/null || . .venv/bin/activate
A

sed -i ~/.zshrc -e 's/^ZSH_THEME=.*/ZSH_THEME="refined"/'

[[ -d .venv ]] || uv venv
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 2
updates:
- package-ecosystem: pip
- package-ecosystem: uv
directory: /
schedule:
interval: monthly
Expand Down
19 changes: 7 additions & 12 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v5
with:
python-version: 3.x
cache: poetry
- name: Setup Poetry to publish
run: |
poetry install --no-interaction
poetry config repositories.testpypi 'https://test.pypi.org/legacy/'
poetry config pypi-token.testpypi '${{ secrets.TESTPYPI_API_TOKEN }}'
poetry config pypi-token.pypi '${{ secrets.PYPI_API_TOKEN }}'
enable-cache: true
cache-dependency-glob: uv.lock
- name: Publish package
run: poetry run task publish
run: uv run task publish
env:
TESTPYPI_API_TOKEN: ${{ secrets.TESTPYPI_API_TOKEN }}
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
17 changes: 10 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,21 @@ jobs:
with:
distribution: temurin
java-version: '21'
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: uv.lock
python-version: ${{ matrix.python-version }}
cache: poetry
- name: Setup
shell: bash
run: |
poetry install --no-interaction
export DOWNLOAD_LATEST_ONLY=1
poetry run task publish
uv run task publish
- name: Test
run: |
poetry run task test
uv run task test:ci
- name: Pytest coverage comment
uses: MishaKav/pytest-coverage-comment@v1.1.53
with:
pytest-xml-coverage-path: ./coverage.xml
junitxml-path: ./pytest.xml
8 changes: 0 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@ repos:
rev: v2.5.0
hooks:
- id: pyproject-fmt
- repo: https://github.com/python-poetry/poetry
rev: 2.0.0
hooks:
- id: poetry-check
- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.1
hooks:
Expand Down
24 changes: 7 additions & 17 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,34 @@

## Setup

```bash
pip install pipx
pipx install poetry

poetry install
poetry run pre-commit install
```

## Activate virtual environment (venv) for development

```bash
poetry shell
```
Open [Dev Container](https://code.visualstudio.com/docs/devcontainers/containers) in the cloned project.

## Lint

```bash
# in venv:
task lint
```

## Fetch latest jar file

```bash
# in venv:
task download-latest-jar
```

## Run tests for all unpublished versions without publishing

```bash
# in venv:
task test-unpublished-versions
```

## Test

```bash
task test
```

## Publish all unpublished versions to PyPI (for CI)

```bash
# in venv:
task publish
```
4 changes: 3 additions & 1 deletion openapi_generator_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ def run(args: list[str] | None = None) -> subprocess.CompletedProcess[bytes]:

arguments.append("-jar")

jar_path = importlib.resources.files("openapi_generator_cli") / "openapi-generator.jar"
jar_path = (
importlib.resources.files("openapi_generator_cli") / "openapi-generator.jar"
)
arguments.append(str(jar_path))

if args and isinstance(args, list):
Expand Down
Loading