Skip to content

Commit

Permalink
Add indication if C extension is installed
Browse files Browse the repository at this point in the history
  • Loading branch information
nineteendo committed Sep 25, 2024
1 parent af6a076 commit a254dd1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
7 changes: 5 additions & 2 deletions docs/source/get-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Check if the correct version is installed
.. code-block:: console
$ jsonyx --version
jsonyx 2.0.0
jsonyx 2.0.0 (C extension)
.. tab:: short options

Expand All @@ -91,7 +91,10 @@ Check if the correct version is installed
.. code-block:: console
$ jsonyx -v
jsonyx 2.0.0
jsonyx 2.0.0 (C extension)
.. note:: If the version number is followed by ``(Python)``, the C extension is
not installed.

Quick start
-----------
Expand Down
1 change: 0 additions & 1 deletion src/jsonyx/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Copyright (C) 2024 Nice Zombies
"""Customizable JSON library for Python."""
# TODO(Nice Zombies): test on Python 3.8
# TODO(Nice Zombies): update badge branch
from __future__ import annotations

Expand Down
9 changes: 5 additions & 4 deletions src/jsonyx/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import sys
from argparse import ArgumentParser
from sys import stderr, stdin
from sys import modules, stderr, stdin
from traceback import format_exception_only
from typing import Any, Literal, cast

Expand Down Expand Up @@ -46,9 +46,10 @@ class _PatchNameSpace(_Namespace):


def _configure(parser: ArgumentParser) -> None:
parser.add_argument(
"-v", "--version", action="version", version=f"jsonyx {__version__}",
)
parser.add_argument("-v", "--version", action="version", version=(
f"jsonyx {__version__} "
f"({'C extension' if '_jsonyx' in modules else 'Python'})"
))
parent_parser: ArgumentParser = ArgumentParser(add_help=False)
parent_parser.add_argument(
"-a",
Expand Down

0 comments on commit a254dd1

Please sign in to comment.