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
37 changes: 19 additions & 18 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,29 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
- name: Install uv
uses: astral-sh/setup-uv@v6

- name: Install ruff
uses: astral-sh/ruff-action@v3

- name: Ruff check
run: ruff check

- name: Ruff format
run: ruff format --check

- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install pipx and Poetry
run: |
pip install pipx &&
pipx ensurepath &&

python --version &&

pipx install poetry==1.8.4 &&
poetry --version

- name: Install dependencies
run: |
poetry install
python-version-file: ".python-version"

- name: Install the project
run: uv sync --locked --all-extras --dev

- name: Run tests
run: |
poetry run pytest tests --junit-xml=tests-results.xml
uv run pytest tests --junit-xml=tests-results.xml

- name: Render test results
if: success() || failure()
Expand Down
34 changes: 25 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
name: Publish Python package on tag
# publish.yml

name: "Publish"

on:
push:
tags:
- "v*.*.*"
release:
types: ["published"]

jobs:
build:
run:
name: "Build and publish release"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Build and publish to pypi
uses: JRubics/poetry-publish@v2.0
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}
enable-cache: true
cache-dependency-glob: uv.lock

- name: Set up Python
run: uv python install 3.10

- name: Build
run: uv build

- name: Publish
run: uv publish -t ${{ secrets.PYPI_TOKEN }}
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.10
408 changes: 0 additions & 408 deletions poetry.lock

This file was deleted.

43 changes: 21 additions & 22 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,26 +1,16 @@
[tool.poetry]
[project]
name = "toml-cli"
version = "0.7.0"
description = "Command line interface to read and write keys/values to/from toml files"
authors = ["Marc Rijken <marc@rijken.org>"]
license = "MIT"
repository = "https://github.com/mrijken/toml-cli"
readme = "README.md"
packages = [{ include = "toml_cli" }]

[tool.poetry.scripts]
toml = 'toml_cli:main'

[tool.poetry.dependencies]
python = ">=3.10"
typer = ">=0.16.0"
tomlkit = ">=0.13.3"
regex = ">=2020.7.14"
jmespath = "^1.0.1"

[tool.poetry.group.dev.dependencies]
pytest = "^8.4.1"
ruff = "^0.12"
requires-python = ">=3.10"
dependencies = [
"jmespath>=1.0.1",
"regex>=2020.7.14",
"tomlkit>=0.13.3",
"typer>=0.16.0",
]
authors = [{ name = "Marc Rijken", email = "marc@rijken.org" }]
scripts = { toml = 'toml_cli:main'}

[tool.ruff]
line-length = 120
Expand All @@ -30,6 +20,15 @@ target-version = "py38"
force-single-line = true
known-first-party = ["pytest_nlcov"]

[tool.hatch.build.targets.wheel]
packages = ["toml_cli"]

[dependency-groups]
dev = [
"pytest>=8.4.1",
"ruff>=0.12",
]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
requires = ["hatchling"]
build-backend = "hatchling.build"
12 changes: 5 additions & 7 deletions tests/toml_cli/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,13 @@ def test_search(tmp_path: pathlib.Path):

result = runner.invoke(app, ["search", "--toml-path", str(test_toml_path), "person.vehicles[*].model"])
assert result.exit_code == 0
assert result.stdout.strip() == (
"['Golf', 'Prius']"
)
assert result.stdout.strip() == ("['Golf', 'Prius']")

result = runner.invoke(app, ["search", "--toml-path", str(test_toml_path), "person.vehicles[*].not_existing_property"])
assert result.exit_code == 0
assert result.stdout.strip() == (
"No result found"
result = runner.invoke(
app, ["search", "--toml-path", str(test_toml_path), "person.vehicles[*].not_existing_property"]
)
assert result.exit_code == 0
assert result.stdout.strip() == ("No result found")

result = runner.invoke(app, ["search", "--toml-path", str(test_toml_path), "wrong-expression"])
assert result.exit_code == 1
Expand Down
Loading