Skip to content

Commit

Permalink
Merge pull request #17 from spraakbanken/make-cli-optional
Browse files Browse the repository at this point in the history
feat: make typer an optional dep in group cli
  • Loading branch information
kod-kristoff authored Jan 8, 2025
2 parents d678472 + 2e59d1f commit 7395475
Show file tree
Hide file tree
Showing 8 changed files with 127 additions and 112 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ permissions:

env:
MINIMUM_PYTHON_VERSION: "3.9"
UV_VERSION: "0.5.1"
UV_VERSION: "0.5.4"

# If new code is pushed to a PR branch, then cancel in progress workflows for that PR. Ensures that
# we don't waste CI time, and returns results quicker https://github.com/jonhoo/rust-ci-conf/pull/5
Expand All @@ -39,7 +39,7 @@ jobs:
# ----- setup uv and load cache -----
#----------------------------------------------
- name: Set up uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v4
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
# ----- setup uv and load cache -----
#----------------------------------------------
- name: Set up uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v4
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
# ----- setup uv and load cache -----
#----------------------------------------------
- name: Set up uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v4
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ permissions:

env:
MINIMUM_PYTHON_VERSION: "3.9"
UV_VERSION: "0.5.1"
UV_VERSION: "0.5.4"

jobs:
build:
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
# ----- setup uv and load cache -----
#----------------------------------------------
- name: Set up uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v4
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/scheduled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ concurrency:
name: rolling

env:
UV_VERSION: "0.5.1"
UV_VERSION: "0.5.4"

jobs:
# https://twitter.com/mycoliza/status/1571295690063753218
Expand All @@ -31,7 +31,7 @@ jobs:
submodules: true

- name: Set up uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v4
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:

- name: Set up uv
if: hashFiles('uv.lock') != ''
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v4
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ permissions:

env:
MINIMUM_PYTHON_VERSION: "3.9"
UV_VERSION: "0.5.1"
UV_VERSION: "0.5.4"

jobs:
coverage:
Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:
submodules: true

- name: Set up uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v4
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
submodules: true

- name: Set up uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v4
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:
submodules: true

- name: Set up uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v4
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ dev: install-dev

# setup development environment
install-dev:
uv sync --all-packages --dev
uv sync --all-packages --all-extras --dev

# setup production environment
install:
Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ classifiers = [
# "Programming Language :: Python :: Implementation :: Stackless",
"Topic :: Utilities",
]
dependencies = [
"fastjsonschema>=2.19.1",
"typer>=0.12.3",
"json-arrays>=0.14.1",
]
dependencies = ["fastjsonschema>=2.19.1", "json-arrays>=0.14.1"]

[project.optional-dependencies]
cli = ["typer>=0.13.1"]

[project.urls]
"Bug Tracker" = "https://github.com/spraakbanken/python-json-tools/issues"
Expand All @@ -41,6 +40,7 @@ Homepage = "https://github.com/spraakbanken/python-json-tools"
[project.scripts]
jt = "sb_json_tools.cli:cli"


[dependency-groups]
dev = [
"pytest>=8.2.1",
Expand Down
11 changes: 8 additions & 3 deletions sb_json_tools/cli.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import sys
import json
import sys

import typer
try:
import typer
except ImportError:
raise RuntimeError(
"Please install with the 'cli' extra, 'pip install sb-json-tools[cli]'"
)

import json_arrays
from sb_json_tools import jt_val

from sb_json_tools import jt_val

__version__ = "0.10.2"

Expand Down
190 changes: 100 additions & 90 deletions uv.lock

Large diffs are not rendered by default.

0 comments on commit 7395475

Please sign in to comment.