[project]
name = "asdf"
description = "Python implementation of the ASDF Standard"
readme = 'README.rst'
license-files = ['LICENSE']
authors = [{ name = 'The ASDF Developers' }]
requires-python = '>=3.9'
classifiers = [
  'Development Status :: 5 - Production/Stable',
  'Programming Language :: Python',
  'Programming Language :: Python :: 3',
]
dynamic = [
  'version',
]
dependencies = [
  "asdf-standard>=1.1.0",
  "asdf-transform-schemas>=0.3",  # required for asdf-1.0.0 schema
  "importlib-metadata>=4.11.4 ; python_version<='3.11'",
  "jmespath>=0.6.2",
  "numpy>=1.22",
  "packaging>=19",
  "pyyaml>=5.4.1",
  "semantic_version>=2.8",
  # for vendorized jsonschema
  "attrs>=22.2.0",
  # end of vendorized jsonschema deps
]
[project.optional-dependencies]
all = [
  "asdf[lz4]",
  "asdf[http]",
]
lz4 = [
  "lz4>=0.10",
]
http = [
  "fsspec[http]>=2022.8.2",
]
docs = [
  "sphinx-asdf>=0.2.2",
  "graphviz",
  "sphinx-inline-tabs",
  'tomli; python_version < "3.11"',
  "furo",
]
tests = [
  "asdf[all]",
  "psutil",
  "pytest>=8",
  "pytest-remotedata",
]
test = [
  "asdf[tests]",
]
benchmark = [
  "asdf[tests]",
  "pytest-benchmark",
]
[project.urls]
'documentation' = 'https://asdf.readthedocs.io/en/stable/'
'repository' = 'https://github.com/asdf-format/asdf'
'tracker' = 'https://github.com/asdf-format/asdf/issues'
[project.entry-points]
'asdf.extensions' = {asdf = 'asdf._core._integration:get_extensions'}
'asdf.resource_mappings' = {asdf = 'asdf._core._integration:get_json_schema_resource_mappings'}
asdf_extensions = {builtin = 'asdf.extension._legacy:BuiltinExtension'}
console_scripts = {asdftool = 'asdf._commands.main:main'}

[build-system]
build-backend = 'setuptools.build_meta'
requires = [
  "setuptools>=60",
  "setuptools_scm[toml]>=8",
  "wheel",
]

[tool.setuptools.packages.find]
include = ['asdf*']
exclude = ['asdf/_jsonschema/json/*']

[tool.setuptools.package-data]
'asdf.commands.tests.data' = ["*"]
'asdf.tags.core.tests.data' = ["*"]
'asdf.tests.data' = ["*"]

[tool.setuptools_scm]
version_file = "asdf/_version.py"

[tool.black]
line-length = 120
force-exclude = '''
^/(
  (
      \.eggs
    | \.git
    | \.pytest_cache
    | \.tox
    | asdf/_extern
    | asdf/_jsonschema
    | build
    | dist
  )/
)
'''

[tool.pytest.ini_options]
testpaths = ['asdf', 'docs']
minversion = 4.6
remote_data_strict = true
filterwarnings = [
    'error',  # also set in _tests/conftest to work with pyargs
    'ignore:numpy.ndarray size changed:RuntimeWarning',
    'ignore:Benchmarks are automatically disabled because xdist plugin is active.Benchmarks cannot be performed reliably in a parallelized environment.',
]
addopts = [
    '--doctest-modules',
    '--doctest-glob=*.rst',
    '--color=yes',
    '-rsxfE',
    '-p no:legacypath',
]

[tool.coverage.run]
omit = [
    'asdf/_astropy_init*',
    'asdf/conftest*',
    'asdf/cython_version*',
    'asdf/setup_package*',
    'asdf/*/setup_package*',
    'asdf/*/*/setup_package*',
    'asdf/testing/*',
    'asdf/tests/*',
    'asdf/*/tests/*',
    'asdf/*/*/tests/*',
    'asdf/version.*',
    'asdf/compat*',
    'asdf/_extern*',
    'asdf/_jsonschema/**',
    # And again for running against installed version
    '*/asdf/_astropy_init*',
    '*/asdf/conftest*',
    '*/asdf/cython_version*',
    '*/asdf/setup_package*',
    '*/asdf/*/setup_package*',
    '*/asdf/*/*/setup_package*',
    '*/asdf/testing/*',
    '*/asdf/tests/*',
    '*/asdf/*/tests/*',
    '*/asdf/*/*/tests/*',
    '*/asdf/version.*',
    '*/asdf/compat*',
    '*/asdf/_extern*',
    '*/asdf/_jsonschema/**',
]

[tool.coverage.report]
exclude_lines = [
    # Have to re-enable the standard pragma
    'pragma: no cover',
    # Don't complain about packages we have installed
    'except ImportError',
    # Don't complain if tests don't hit assertions
    'raise AssertionError',
    'raise NotImplementedError',
    # Don't complain about script hooks
    'def main\(.*\):',
    # Ignore branches that don't pertain to this version of Python
    'pragma: py{ ignore_python_version }',
]

[tool.ruff]
target-version = "py39"
line-length = 120
extend-exclude = ["asdf/_extern/*", "asdf/_jsonschema/*", "docs/*"]

[tool.ruff.lint]
select = [
    # minimal set to match pre-ruff behavior
    "E", # pycodestyle
    "F", # pyflakes, autoflake
    "I", # isort
    "S", # bandit
    "UP", # pyupgrade
    "RUF",  # ruff specific, includes yesqa
]
extend-ignore = [
    "S310", # URL open for permitted schemes
    "RUF005",  # prefer concatenate over add for collections
    "RUF012",  # mutable-class-default (typing related)
]

[tool.ruff.lint.per-file-ignores]
"test_*.py" = ["S101"]
"asdf/_tests/_helpers.py" = ["S101"]
"integration_tests/compatibility/common.py" = ["S101"]

[tool.flynt]
exclude = ["asdf/_extern/*", "asdf/_jsonschema/*"]

[tool.codespell]
skip="*.pdf,*.asdf,.tox,asdf/_extern,asdf/_jsonschema,build,./tags,.git,docs/_build"
ignore-words-list="""
fo,afile,
"""

[tool.towncrier]
filename = "CHANGES.rst"
directory = "changes"
package = "asdf"
title_format = "{version} ({project_date})"
ignore = [".gitkeep"]
wrap = true
issue_format = "`#{issue} <https://github.com/asdf-format/asdf/pull/{issue}>`_"

[tool.towncrier.fragment.feature]
[tool.towncrier.fragment.bugfix]
[tool.towncrier.fragment.doc]
[tool.towncrier.fragment.removal]
[tool.towncrier.fragment.general]
