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]
|
||||
name = "grovers-visualizer"
|
||||
version = "0.4.0"
|
||||
description = "Add your description here"
|
||||
version = "0.4.1"
|
||||
description = "A tiny Python package that steps through Grover’s Search algorithm."
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.13"
|
||||
dependencies = [
|
||||
@ -21,16 +21,17 @@ ui = ["dearpygui==2.0.0"]
|
||||
[dependency-groups]
|
||||
dev = ["mypy~=1.15", "ruff~=0.11"]
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[tool.hatch.build]
|
||||
sources = ["src"]
|
||||
packages = ["grovers_visualizer"]
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["src/grovers_visualizer"]
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[tool.mypy]
|
||||
mypy_path = "src"
|
||||
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
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
import tomllib
|
||||
from collections.abc import Iterator
|
||||
from importlib.metadata import PackageNotFoundError, version
|
||||
from itertools import product
|
||||
from math import floor, pi, sqrt
|
||||
from pathlib import Path
|
||||
|
||||
from .state import QubitState
|
||||
|
||||
@ -31,14 +30,12 @@ def get_bar_color(state: str, target_state: QubitState | None, iteration: int, o
|
||||
return "orange"
|
||||
|
||||
|
||||
def get_app_version(pyproject_path: str = "pyproject.toml") -> str:
|
||||
"""Reads the version from the [project] section of pyproject.toml."""
|
||||
path = Path(pyproject_path)
|
||||
if not path.is_file():
|
||||
raise FileNotFoundError(f"{pyproject_path} not found.")
|
||||
with path.open("rb") as f:
|
||||
data = tomllib.load(f)
|
||||
def get_app_version() -> str:
|
||||
"""Return the installed package version, e.g. '0.4.0'.
|
||||
|
||||
Falls back to 'unknown' if not installed as a distribution.
|
||||
"""
|
||||
try:
|
||||
return str(data["project"]["version"])
|
||||
except KeyError:
|
||||
raise KeyError("Version not found in [project] section of pyproject.toml.")
|
||||
return version("grovers-visualizer")
|
||||
except PackageNotFoundError:
|
||||
return "unknown"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user