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
46 changes: 46 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Lint

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
lint:
name: Lint and format check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

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

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Run ruff linter
run: uvx ruff check .

- name: Run ruff formatter check
run: uvx ruff format --check .

- name: Validate pyproject.toml
run: |
uv tool install validate-pyproject
uvx validate-pyproject pyproject.toml

- name: Validate changelog fragments
run: |
set -euo pipefail
if ! uv run --group dev scriv print; then
status=$?
if [ "$status" -eq 2 ]; then
echo "::notice::No changelog fragments to collect"
exit 0
fi
exit "$status"
fi
33 changes: 33 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Tests

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
tests:
name: Run tests (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Install dependencies
run: uv sync --group dev

- name: Run pytest
run: uv run --group dev pytest
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,6 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

*.swp
worktrees/
27 changes: 27 additions & 0 deletions changelog.d/templates/fragment.md.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# A new scriv changelog fragment.
#
# Uncomment the section that is right for this fragment:
#
# Added
# -----
# * New feature or functionality
#
# Changed
# -------
# * Changes to existing functionality
#
# Deprecated
# ----------
# * Features that will be removed in future releases
#
# Removed
# -------
# * Features that have been removed
#
# Fixed
# -----
# * Bug fixes
#
# Security
# --------
# * Security-related changes
7 changes: 7 additions & 0 deletions lmterminal/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
"o1-preview-2024-09-12": None,
"o1-mini": None,
"o1-mini-2024-09-12": None,
"o1-pro": None,
"o1-pro-2025-03-19": None,
"gpt-4.1": ("4.1",),
"gpt-4.1-2025-04-14": None,
"gpt-4.1-mini": ("4.1-mini",),
Expand All @@ -57,6 +59,11 @@
"o3-mini-2025-01-31": None,
"o4-mini": None,
"o4-mini-2025-04-16": None,
"codex-mini-latest": None,
"gpt-4o-search-preview": None,
"gpt-4o-search-preview-2025-03-11": None,
"gpt-4o-mini-search-preview": None,
"gpt-4o-mini-search-preview-2025-03-11": None,
"gpt-5": (
"5",
"gpt5",
Expand Down
7 changes: 7 additions & 0 deletions lmterminal/gpt_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ def estimate_prompt_cost(message, model):
"o1-preview-2024-09-12": 15,
"o1-mini": 1.10,
"o1-mini-2024-09-12": 1.10,
"o1-pro": 150,
"o1-pro-2025-03-19": 150,
"gpt-4.1": 2,
"gpt-4.1-2025-04-14": 2,
"gpt-4.1-mini": 0.40,
Expand All @@ -173,6 +175,11 @@ def estimate_prompt_cost(message, model):
"o3-mini-2025-01-31": 1.10,
"o4-mini": 1.10,
"o4-mini-2025-04-16": 1.10,
"codex-mini-latest": 1.50,
"gpt-4o-search-preview": 2.50,
"gpt-4o-search-preview-2025-03-11": 2.50,
"gpt-4o-mini-search-preview": 0.15,
"gpt-4o-mini-search-preview-2025-03-11": 0.15,
"gpt-5": 1.25,
"gpt-5-mini": 0.25,
"gpt-5-nano": 0.05,
Expand Down
66 changes: 66 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
[build-system]
requires = ["uv_build>=0.9.18,<0.10.0"]
build-backend = "uv_build"

[project]
name = "LMterminal"
version = "0.0.43"
description = "Interact with OpenAI's models from the comfort of your terminal."
readme = "README.md"
requires-python = ">=3.10"
license = "Apache-2.0"
authors = [{ name = "Sébastien De Revière" }]
dependencies = [
"click",
"click-default-group",
"openai<1.0",
"PyYAML",
"rich",
"tiktoken",
]

[project.urls]
Documentation = "https://github.com/sderev/lmterminal"
Issues = "http://github.com/sderev/lmterminal/issues"
Changelog = "https://github.com/sderev/lmterminal/releases"

[project.scripts]
lmt = "lmterminal.cli:lmt"

[dependency-groups]
dev = [
"pytest",
"scriv[toml]>=1.5.0",
]

[tool.ruff]
line-length = 100
lint.extend-select = ["I001"]

[tool.pytest.ini_options]
addopts = "-ra"
testpaths = ["tests"]
markers = [
"integration: marks tests that call external services",
]

[tool.scriv]
version = "literal: pyproject.toml: project.version"
format = "md"
md_header_level = 2
output_file = "CHANGELOG.md"
fragment_directory = "changelog.d"
new_fragment_template = "file: changelog.d/templates/fragment.md.j2"
categories = [
"Added",
"Changed",
"Deprecated",
"Removed",
"Fixed",
"Security",
]
entry_title_template = "{{ version }} - {{ date.strftime('%Y-%m-%d') }}"

[tool.uv.build-backend]
module-root = ""
module-name = "lmterminal"
6 changes: 0 additions & 6 deletions requirements.txt

This file was deleted.

38 changes: 0 additions & 38 deletions setup.py

This file was deleted.

1 change: 1 addition & 0 deletions tests/cli_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest
from click.exceptions import BadParameter
from click.testing import CliRunner

from lmterminal import cli


Expand Down
Loading