# piker: trading gear for hackers
# Copyright (C) 2018-present (in stewardship of pikers)
# Tyler Goodlet and the pike pikes

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.

# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "piker"
version = "0.1.0a0dev0"
description = "trading gear for hackers"
authors = [{ name = "Tyler Goodlet", email = "goodboy_foss@protonmail.com" }]
requires-python = ">=3.12"
license = "AGPL-3.0-or-later"
readme = "README.rst"
keywords = [
    "async",
    "trading",
    "finance",
    "quant",
    "charting",
]
classifiers = [
    "Development Status :: 3 - Alpha",
    "License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
    "Operating System :: POSIX :: Linux",
    "Programming Language :: Python :: Implementation :: CPython",
    "Programming Language :: Python :: 3 :: Only",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3.13",
    "Intended Audience :: Financial and Insurance Industry",
    "Intended Audience :: Science/Research",
    "Intended Audience :: Developers",
    "Intended Audience :: Education",
]
dependencies = [
    "async-generator >=1.10, <2.0.0",
    "attrs >=23.1.0, <24.0.0",
    "bidict >=0.23.1",
    "colorama >=0.4.6, <0.5.0",
    "colorlog >=6.7.0, <7.0.0",
    "ib-insync >=0.9.86, <0.10.0",
    "numpy>=2.0",
    "polars >=0.20.6",
    "polars-fuzzy-match>=0.1.5",
    "pygments >=2.16.1, <3.0.0",
    "rich >=13.5.2, <14.0.0",
    "tomli >=2.0.1, <3.0.0",
    "tomli-w >=1.0.0, <2.0.0",
    "trio-util >=0.7.0, <0.8.0",
    "trio-websocket >=0.10.3, <0.11.0",
    "typer >=0.9.0, <1.0.0",
    "trio >=0.27",
    "pendulum",
    "httpx >=0.27.0, <0.28.0",
    "cryptofeed >=2.4.0, <3.0.0",
    "pyarrow>=18.0.0",
    "websockets ==12.0",
    "msgspec>=0.19.0,<0.20",
    "tractor",
    "tomlkit",
    "trio-typing>=0.10.0",
    "numba>=0.61.0",
    "pyvnc",
]
# ------ dependencies ------
# NOTE, by default we ship only a "headless" deps set bc
# the `uis` group is not listed in the optional set.

# [optional-dependencies]
# uis = []
# ?TODO? really we should be able to mv this `uis` group
# to be under [optional-dependencies] and then include
# it in the dev deps?
# https://docs.astral.sh/uv/concepts/projects/dependencies/#optional-dependencies
# -> uis should be included in pubbed pkgs.
# [ ] uv seems to have no way to do this though?

# TODO? move to a `uv.toml`?
[tool.uv]
# https://docs.astral.sh/uv/reference/settings/#python-preference
python-preference = 'system'
# https://docs.astral.sh/uv/reference/settings/#python-downloads
python-downloads = 'manual'
# https://docs.astral.sh/uv/concepts/projects/dependencies/#default-groups
default-groups = [
  'uis',
]
# ------ tool.uv ------

[dependency-groups]
uis = [
  "pyqtgraph",
  "qdarkstyle >=3.0.2, <4.0.0",
  "pyqt6 >=6.7.0, <7.0.0",

  # fuzzy search
  "rapidfuzz >=3.2.0, <4.0.0",
]

# dev deps enabled by `uv --dev`
# https://docs.astral.sh/uv/concepts/projects/dependencies/#development-dependencies
dev = [
  # https://docs.astral.sh/uv/concepts/projects/dependencies/#development-dependencies
  "cython >=3.0.0, <4.0.0",
  # nested deps-groups
  # https://docs.astral.sh/uv/concepts/projects/dependencies/#nesting-groups
  {include-group = 'uis'},
  {include-group = 'repl'},
  {include-group = 'testing'},
  {include-group = 'de'},
]
repl = [
  # `tractor`'s debugger
  "pdbp >=1.8.2, <2.0.0",
    "greenback >=1.1.1, <2.0.0",

  # @goodboy's preferred console toolz
  "xonsh",
    "prompt-toolkit ==3.0.40",
    "pyperclip>=1.9.0",

  # for @claude's `snippets/claude_debug_helper.py` it uses to do
  # "offline" debug/crash REPL-in alongside a dev.
  "pexpect>=4.9.0",

  # ?TODO, new stuff to consider..
  # "visidata"  # console numerics
  # "xxh"  # for remote `xonsh`-ing
  # "rsyscall"  # (eventual) optional `tractor` backend
  # - an actor-runtime-ctl console like BEAM/OTP
]
testing = [
  "pytest",
]
de = [ # (linux) specific DEs
  "i3ipc>=2.2.1",
]
lint = [
  # XXX, with flake.nix needs to be from nixpkgs
  "ruff>=0.9.6"
  # ; os_name != 'nixos' and platform_system != 'NixOS'",
  # ?TODO? since ^ markers won't work, use a deps-flags to toggle for
  # now.
]
dbs = [
  "elasticsearch >=8.9.0, <9.0.0",
]
# ------ dependency-groups ------


[tool.pytest.ini_options]
# https://docs.pytest.org/en/stable/reference/reference.html#configuration-options
testpaths = [
    "tests",
]
# https://docs.pytest.org/en/stable/reference/reference.html#confval-console_output_style
console_output_style = 'progress'

# https://docs.pytest.org/en/stable/how-to/plugins.html#disabling-plugins-from-autoloading
# https://docs.pytest.org/en/stable/how-to/plugins.html#deactivating-unregistering-a-plugin-by-name
addopts = '-p no:xonsh'
# ------ tool.pytest ------


[project.scripts]
piker = "piker.cli:cli"
pikerd = "piker.cli:pikerd"
ledger = "piker.accounting.cli:ledger"
# ------ project.scripts ------

[tool.hatch.build.targets.sdist]
include = ["piker"]
[tool.hatch.build.targets.wheel]
include = ["piker"]
# ------ tool.hatch ------


[tool.uv.sources]
pyqtgraph = { git = "https://github.com/pikers/pyqtgraph.git" }
tomlkit = { git = "https://github.com/pikers/tomlkit.git", branch ="piker_pin" }
pyvnc = { git = "https://github.com/regulad/pyvnc.git" }

# to get fancy next-cmd/suggestion feats prior to 0.22.2 B)
# https://github.com/xonsh/xonsh/pull/6037
# https://github.com/xonsh/xonsh/pull/6048
xonsh = { git = 'https://github.com/xonsh/xonsh.git', branch = 'main' }

# XXX since, we're like, always hacking new shite all-the-time. Bp
# tractor = { git = "https://github.com/goodboy/tractor.git", branch ="piker_pin" }
# tractor = { git = "https://pikers.dev/goodboy/tractor", branch = "piker_pin" }
# tractor = { git = "https://pikers.dev/goodboy/tractor", branch = "main" }
# ------ goodboy ------
# hackin dev-envs, usually there's something new he's hackin in..
tractor = { path = "../tractor", editable = true }
