mirror of
https://github.com/kristoferssolo/grovers-visualizer.git
synced 2025-10-21 20:10:35 +00:00
build: fix installation
This commit is contained in:
parent
750cccdcd5
commit
eafab73c6a
@ -1,7 +1,7 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "grovers-visualizer"
|
name = "grovers-visualizer"
|
||||||
version = "0.4.0"
|
version = "0.4.1"
|
||||||
description = "Add your description here"
|
description = "A tiny Python package that steps through Grover’s Search algorithm."
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.13"
|
requires-python = ">=3.13"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
@ -21,16 +21,17 @@ ui = ["dearpygui==2.0.0"]
|
|||||||
[dependency-groups]
|
[dependency-groups]
|
||||||
dev = ["mypy~=1.15", "ruff~=0.11"]
|
dev = ["mypy~=1.15", "ruff~=0.11"]
|
||||||
|
|
||||||
[build-system]
|
|
||||||
requires = ["hatchling"]
|
|
||||||
build-backend = "hatchling.build"
|
|
||||||
|
|
||||||
[tool.hatch.build]
|
[tool.hatch.build]
|
||||||
sources = ["src"]
|
sources = ["src"]
|
||||||
|
packages = ["grovers_visualizer"]
|
||||||
|
|
||||||
[tool.hatch.build.targets.wheel]
|
[tool.hatch.build.targets.wheel]
|
||||||
packages = ["src/grovers_visualizer"]
|
packages = ["src/grovers_visualizer"]
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["hatchling"]
|
||||||
|
build-backend = "hatchling.build"
|
||||||
|
|
||||||
[tool.mypy]
|
[tool.mypy]
|
||||||
mypy_path = "src"
|
mypy_path = "src"
|
||||||
check_untyped_defs = true
|
check_untyped_defs = true
|
||||||
|
|||||||
@ -1,3 +1,12 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
"""Grover's Algorithm Visualizer.
|
||||||
|
|
||||||
|
This script builds a Grover search circuit based on user input, runs the
|
||||||
|
simulation using Qiskit's Aer simulator, and visualizes the results
|
||||||
|
using matplotlib.
|
||||||
|
"""
|
||||||
|
|
||||||
from .main import main
|
from .main import main
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
import tomllib
|
|
||||||
from collections.abc import Iterator
|
from collections.abc import Iterator
|
||||||
|
from importlib.metadata import PackageNotFoundError, version
|
||||||
from itertools import product
|
from itertools import product
|
||||||
from math import floor, pi, sqrt
|
from math import floor, pi, sqrt
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from .state import QubitState
|
from .state import QubitState
|
||||||
|
|
||||||
@ -31,14 +30,12 @@ def get_bar_color(state: str, target_state: QubitState | None, iteration: int, o
|
|||||||
return "orange"
|
return "orange"
|
||||||
|
|
||||||
|
|
||||||
def get_app_version(pyproject_path: str = "pyproject.toml") -> str:
|
def get_app_version() -> str:
|
||||||
"""Reads the version from the [project] section of pyproject.toml."""
|
"""Return the installed package version, e.g. '0.4.0'.
|
||||||
path = Path(pyproject_path)
|
|
||||||
if not path.is_file():
|
Falls back to 'unknown' if not installed as a distribution.
|
||||||
raise FileNotFoundError(f"{pyproject_path} not found.")
|
"""
|
||||||
with path.open("rb") as f:
|
|
||||||
data = tomllib.load(f)
|
|
||||||
try:
|
try:
|
||||||
return str(data["project"]["version"])
|
return version("grovers-visualizer")
|
||||||
except KeyError:
|
except PackageNotFoundError:
|
||||||
raise KeyError("Version not found in [project] section of pyproject.toml.")
|
return "unknown"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user