[project]
name = "MC6809"
dynamic = ["version"]
description = "MC6809 CPU emulator written in Python"
license = {text = "GPL-3.0-or-later"}
readme = "README.md"
authors = [
    {name = 'Jens Diemer', email = 'git@jensdiemer.de'}
]
requires-python = ">=3.11"
dependencies = [
    "cli-base-utilities",  # https://github.com/jedie/cli-base-utilities
    "bx_py_utils",  # https://github.com/boxine/bx_py_utils
    "click",  # https://github.com/pallets/click/
    "rich-click",  # https://github.com/ewels/rich-click
    "rich",  # https://github.com/Textualize/rich
]
[project.optional-dependencies]
dev = [
    "manageprojects",  # https://github.com/jedie/manageprojects
    "urllib3", # for bx_py_utils.test_utils.deny_requests.deny_any_real_request() in tests
    "pip-tools",  # https://github.com/jazzband/pip-tools/
    "tox",  # https://github.com/tox-dev/tox
    "coverage",  # https://github.com/nedbat/coveragepy
    "autopep8",  # https://github.com/hhatto/autopep8
    "pyupgrade",  # https://github.com/asottile/pyupgrade
    "flake8",  # https://github.com/pycqa/flake8
    "flake8-bugbear",  # https://github.com/PyCQA/flake8-bugbear
    "pyflakes",  # https://github.com/PyCQA/pyflakes
    "codespell",  # https://github.com/codespell-project/codespell
    "EditorConfig",  # https://github.com/editorconfig/editorconfig-core-py
    "pip-audit",  # https://github.com/pypa/pip-audit
    "mypy",  # https://github.com/python/mypy
    "twine",  # https://github.com/pypa/twine
    "pre-commit",  # https://github.com/pre-commit/pre-commit
    "typeguard",  # https://github.com/agronholm/typeguard/

    # https://github.com/akaihola/darker
    # https://github.com/ikamensh/flynt
    # https://github.com/pycqa/isort
    # https://github.com/pygments/pygments
    "darker[flynt, isort, color]",

    # Work-a-round for: https://github.com/jazzband/pip-tools/issues/1866
    # see also: https://github.com/jazzband/pip-tools/issues/994#issuecomment-1321226661
    # backports.tarfile is needed for python <3.12
    'backports.tarfile', # via jaraco-context -> keyring -> twine
]

[tool.pip-tools.compile]
index-url="https://pypi.org/simple"
extra-index-url=["https://www.piwheels.org/simple"] # Add hashes of piwheels packages, too!
generate-hashes = true
# https://pip-tools.readthedocs.io/en/stable/#deprecations
allow-unsafe = true
resolver="backtracking"
strip-extras = true

[project.urls]
Documentation = "https://github.com/6809/MC6809"
Source = "https://github.com/6809/MC6809"

[project.scripts]
MC6809_app = "MC6809.__main__:main"
MC6809_dev = "MC6809.cli_dev:main"

[tool.cli_base]
version_module_name = "MC6809"  # Used by "update-readme-history" git hook

[build-system]
requires = ["setuptools>=61.0", "setuptools_scm>=7.1"]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
where = ["."]
include = ["MC6809*"]

[tool.setuptools.dynamic]
version = {attr = "MC6809.__version__"}


[tool.cli_base.pip_audit]
requirements=["requirements.dev.txt"]
strict=true
require_hashes=true
ignore-vuln=[]


[tool.darker]
src = ['.']
revision = "origin/main..."
line_length = 119
color = true
skip_string_normalization = true
diff = false
check = false
stdout = false
isort = true
lint = [
    "flake8",
]
log_level = "INFO"


[tool.isort]
# https://pycqa.github.io/isort/docs/configuration/config_files/#pyprojecttoml-preferred-format
atomic=true
profile='black'
skip_glob=['.*', '*/htmlcov/*']
known_first_party=['MC6809']
line_length=119
lines_after_imports=2


[tool.coverage.run]
branch = true
parallel = true
concurrency = ["multiprocessing"]
source = ['.']
command_line = '-m unittest --verbose --locals --buffer'

[tool.coverage.report]
omit = ['.*', '*/tests/*']
skip_empty = true
fail_under = 30
show_missing = true
exclude_lines = [
    'if self.debug:',
    'pragma: no cover',
    'raise NotImplementedError',
    'if __name__ == .__main__.:',
]


[tool.tox]  # https://tox.wiki/en/latest/config.html#pyproject-toml
legacy_tox_ini = """
[tox]
isolated_build = True
envlist = py{312,311}
skip_missing_interpreters = True

[testenv]
passenv = *
skip_install = true
commands_pre =
    pip install -U pip-tools
    pip-sync requirements.dev.txt
commands =
    {envpython} -m coverage run --context='{envname}'
"""


[tool.mypy]
warn_unused_configs = true
ignore_missing_imports = true
allow_redefinition = true  # https://github.com/python/mypy/issues/7165
show_error_codes = true
plugins = []
exclude = ['.venv', 'tests']


[manageprojects] # https://github.com/jedie/manageprojects
initial_revision = "47cac0a"
initial_date = 2023-03-06T19:46:41+01:00
cookiecutter_template = "https://github.com/jedie/cookiecutter_templates/"
cookiecutter_directory = "piptools-python"
applied_migrations = [
    "a66e5ae", # 2024-01-16T19:13:13+01:00
    "56c3caa", # 2024-09-22T16:52:30+02:00
]

[manageprojects.cookiecutter_context.cookiecutter]
full_name = "Jens Diemer"
github_username = "jedie"
author_email = "git@jensdiemer.de"
package_name = "MC6809"
package_version = "0.7.0"
package_description = "MC6809 CPU emulator written in Python"
package_url = "https://github.com/6809/MC6809"
issues_url = "https://github.com/6809/MC6809/issues"
license = "GPL-3.0-or-later"
_template = "https://github.com/jedie/cookiecutter_templates/"
applied_migrations = [
    "04d5a25", # 2023-03-07T16:25:36+01:00
    "da054d6", # 2023-08-04T17:39:02+02:00
    "c1a9d97", # 2023-11-01T19:59:17+01:00
]
