Revision 2c3cfd1042e4a8aba3c2f9cf498f7822dc8d00a3 authored by P. L. Lim on 06 July 2023, 17:58:02 UTC, committed by GitHub on 06 July 2023, 17:58:02 UTC
2 parent s d064114 + 49e0b92
Raw File
pyproject.toml
[build-system]
requires = ["setuptools",
            "setuptools_scm>=6.2",
            "cython==0.29.34",
            "oldest-supported-numpy",
            "extension-helpers"]
build-backend = 'setuptools.build_meta'

[tool.setuptools_scm]
write_to = "astropy/_version.py"

[tool.astropy-bot]
    [tool.astropy-bot.autolabel]
        # Comment this out to re-enable but then labeler Action needs to be disabled.
        enabled = false

    [tool.astropy-bot.changelog_checker]
        enabled = false

[tool.cibuildwheel]
# We disable testing for the following wheels:
# - MacOS X ARM (no native hardware, tests are skipped anyway, this avoids a warning)
# - Linux AArch64 (no native hardware, tests take too long)
# - MuslLinux (tests hang non-deterministically)
test-skip = "*-macosx_arm64 *-manylinux_aarch64 *-musllinux_x86_64"

[[tool.cibuildwheel.overrides]]
# Python 3.11 and later is not available in manylinux2010 so we only
# set this for Python<=3.10.
select = "cp3{8,9,10}-*"
manylinux-x86_64-image = "manylinux2010"

[tool.cibuildwheel.macos]
archs = ["x86_64", "arm64"]

[tool.cibuildwheel.linux]
archs = ["auto", "aarch64"]

[tool.black]
line-length = 88
force-exclude = '''
^/(
  (
    # Directories to always exclude (.gitignore is always excluded)
      examples
    | docs/wcs/examples
    | docs/nddata/examples
    | cextern
    | astropy/extern
  )/
  # Individual files to always exclude
  | astropy/coordinates/.*tab.py
  | astropy/units/format/.*tab.py
)
'''


[tool.flynt]
exclude= [
    "astropy/extern",
    "astropy/coordinates/angle_lextab.py",
    "astropy/units/format/cds_lextab.py",
    "astropy/units/format/general_lextab.py",
    "astropy/units/format/ogip_lextab.py",
    "astropy/coordinates/angle_parsetab.py",
    "astropy/units/format/cds_parsetab.py",
    "astropy/units/format/general_parsetab.py",
    "astropy/units/format/ogip_parsetab.py",
]


[tool.ruff]
target-version = "py38"
line-length = 88
select = ["ALL"]
exclude=[
    "astropy/extern/*",
    "*_parsetab.py",
    "*_lextab.py"
]
extend-ignore = [
    # flake8-builtins (A) : shadowing a Python built-in.
    # New ones should be avoided and is up to maintainers to enforce.
    "A00",

    # flake8-annotations (ANN) : static typing
    # TODO: revisit this when Astropy implements typing.
    "ANN",

    # flake8-unused-arguments (ARG)
    # TODO: fix all of these.
    "ARG001", "ARG002", "ARG003", "ARG004", "ARG005",

    # flake8-bugbear (B)
    "B004",  # UnreliableCallableCheck                 # TODO: fix
    "B005",  # StripWithMultiCharacters                # NOTE: low priority fix
    "B006",  # MutableArgumentDefault                  # NOTE: low priority fix
    "B007",  # UnusedLoopControlVariable               # TODO: autofix
    "B008",  # FunctionCallArgumentDefault
    "B015",  # UselessComparison                       # TODO: fix
    "B018",  # UselessExpression                       # TODO: fix
    "B020",  # LoopVariableOverridesIterator           # TODO: fix
    "B023",  # FunctionUsesLoopVariable                # TODO: fix
    "B024",  # AbstractBaseClassWithoutAbstractMethod  # TODO: fix
    "B026",  # StarArgUnpackingAfterKeywordArg         # NOTE: low priority fix
    "B028",  # No-explicit-stacklevel                  # TODO: fix
    "B904",  # RaiseWithoutFromInsideExcept            # TODO: fix
    "B905",  # ZipWithoutExplicitStrict                # TODO: fix

    # flake8-blind-except (BLE)
    "BLE001",  # BlindExcept                           # TODO: fix

    # flake8-comprehensions (C4)
    # these detect if there are better and faster list/set/dict comprehensions.
    "C400", "C406", "C408", "C413", "C416",            # TODO: autofix
    "C414",  # UnnecessaryDoubleCastOrProcess          # TODO: fix
    "C417",  # UnnecessaryMap (over a comprehension)   # NOTE: low priority fix

    # mccabe (C90) : code complexity
    # TODO: fix, but probably pretty challenging.
    "C901",

    # flake8-commas (COM)
    "COM812",  # TrailingCommaMissing
    "COM818",  # TrailingCommaOnBareTupleProhibited
    "COM819",  # TrailingCommaProhibited

    # pydocstyle (D)
    # Missing Docstrings
    "D100",  # PublicModule                            # TODO: fix
    "D101",  # PublicClass                             # TODO: fix
    "D102",  # Missing docstring in public method. Don't check b/c docstring inheritance.
    "D103",  # PublicFunction                          # TODO: fix
    "D104",  # PublicPackage                           # TODO: fix
    "D105",  # Missing docstring in magic method. Don't check b/c class docstring.
    "D107",  # Missing docstring in __init__. Don't check b/c class docstring.
    # Whitespace Issues
    "D200",  # FitsOnOneLine
    "D203",  # OneBlankLineBeforeClass. Don't check.
    "D205",  # BlankLineAfterSummary                   # TODO: fix
    "D212", "D213",  # MultiLineSummaryFirst/Second Line  # TODO: fix one of these
    # Quotes Issues
    "D300",  # UsesTripleQuotes                        # TODO: fix
    "D301",  # UsesRPrefixForBackslashedContent        # TODO: fix
    # Docstring Content Issues
    "D402",  # NoSignature                             # TODO: fix
    "D403",  # FirstLineCapitalized
    "D404",  # NoThisPrefix
    "D410",  # BlankLineAfterSection. Using D412 instead.
    "D400",  # EndsInPeriod. Using D415 instead.
    "D401",  # non-imperative-mood.
    "D413",  # BlankLineAfterLastSection. Don't check.
    "D414",  # NonEmptySection                         # TODO: fix
    "D416",  # SectionNameEndsInColon. Don't check.
    "D417",  # DocumentAllArguments                    # TODO: fix
    "D419",  # docstring is empty                      # TODO: fix

    # flake8-datetimez (DTZ)
    # TODO: fix by including the tzinfo.
    "DTZ001", "DTZ003", "DTZ005", "DTZ007",

    # pycodestyle (E, W)
    "E501",  # LineTooLong                             # TODO! fix
    "E711",  # NoneComparison  (see unfixable)
    "E721",  # TypeComparison                          # TODO: fix
    "E731",  # DoNotAssignLambda                       # TODO: autofix
    "E741",  # AmbiguousVariableName
    "E999",  # SyntaxError                             # TODO: fix

    # flake8-errmsg (EM)  : nicer error tracebacks
    # NOTE: low priority fix
    "EM",

    # eradicate (ERA)
    # NOTE: autofix, but be careful that some developer notes are kept.
    "ERA001",  # CommentedOutCode

    # flake8-executable (EXE)
    "EXE002",  # shebang-missing-executable-file

    # Pyflakes (F)
    "F403",  # ImportStarUsed
    "F821",  # UndefinedName                           # TODO: fix
    "F841",  # UnusedVariable                          # TODO: autofix

    # flake8-boolean-trap (FBT)  : boolean flags should be kwargs, not args
    # NOTE: a good thing to fix, but changes API.
    "FBT001", "FBT002", "FBT003",

    # flake8-logging-format (G)
    "G001",  # logging-string-format                   # TODO: fix
    "G003",  # logging-string-concat                   # TODO: fix
    "G004",  # logging-f-string                        # TODO: fix

    # isort (I)
    # TODO: replace isort with this.
    "I001",

    # flake8-import-conventions (ICN)  : use conventional import aliases
    # TODO: fix.
    "ICN001",

    # flake8-implicit-str-concat (ISC)
    "ISC001", "ISC003",

    # pep8-naming (N)
    # NOTE: some of these can/should be fixed, but this changes the API.
    "N8",

    # NumPy-specific rules (NPY)
    "NPY002", # Replace legacy `np.random.rand` call with `np.random.Generator`

    # flake8-pie (PIE)
    "PIE790",  # NoUnnecessaryPass                   # TODO: autofix
    "PIE794",  # DupeClassFieldDefinitions           # TODO: autofix
    "PIE804",  # no-unnecessary-dict-kwargs          # TODO: fix
    "PIE810",  # single-starts-ends-with             # TODO: fix

    # pandas-vet (PD)
    "PD",

    # pygrep-hooks (PGH)
    "PGH001",  # TODO: fix in astropy.utils.introspection

    # Pylint (PLC, PLE, PLR, PLW)
    "PLC1901",  # compare-to-empty-string            # TODO: fix
    "PLE0101",  # return-in-init                     # TODO: fix
    "PLE0605",  # invalid-all-format	             # TODO: fix
    "PLR0402",  # ConsiderUsingFromImport            # TODO: fix
    "PLR1701",  # ConsiderMergingIsinstance          # TODO: fix
    "PLR2004",  # MagicValueComparison               # Note: low priority fix
    "PLR0911",  # too-many-return-statements
    "PLR0912",  # too-many-branches
    "PLR5501",  # collapsible-else-if                # TODO: fix
    "PLR0913",  # too-many-args
    "PLR0915",  # too-many-statements
    "PLW0120",  # UselessElseOnLoop                  # Note: low priority fix
    "PLW0129",  # assert-on-string-literal           # TODO: fix
    "PLW0602",  # GlobalVariableNotAssigned          # TODO: fix
    "PLW2901",  # redefined-loop-name                # TODO: fix. Easy source of bugs!
    "PLW0603",  # global-statement                   # Maybe fix?

    # flake8-pytest-style (PT)
    # TODO: fix many of these.
    "PT",

    # flake8-use-pathlib (PTH)
    # TODO: fix many / all of these. ``pathlib`` is often preferred.
    "PTH",

    # flake8-return (RET)
    "RET",

    # flake8-raise (RSE)
    "RSE102",  # unnecessary-paren-on-raise-exception  # TODO: fix

    # Ruff-specific rules (RUF)
    "RUF001", "RUF002", "RUF003",  # AmbiguousUnicode, maybe fix?
    "RUF005",  # unpack-instead-of-concatenating-to-collection-literal -- it's not clearly faster.

    # flake8-bandit (S)
    "S101",  # UseOfAssert                              # TODO: fix
    "S105",  # HardcodedPasswordString                  # TODO: fix by adding noqa
    "S110",  # TryExceptPass                            # TODO: fix
    "S112",  # try-except-continue                      # TODO: fix
    "S301",  # suspeciious-pickle-usage                 # TODO: fix
    "S311",  # Suspecious-non-cryptographic-randomness  # TODO: fix
    "S506",  # UnsafeYAMLLoad                           # TODO: fix
    "S310",  # Suspicious-url-open-usage                # TODO: fix
    "S321",  # Suspecious-ftp-lib-usage                 # TODO: fix
    "S608",  # Posslibe SQL injection                   # TODO: fix
    "S324",  # hashlib-insecure-hash-function

    # flake8-simplify (SIM)
    "SIM102",  # NestedIfStatements                  # TODO: fixable with `pass`.
    "SIM105",  # UseContextlibSuppress
    "SIM108",  # UseTernaryOperator                  # TODO? autofix. Impact on readability?
    "SIM114",  # if-with-same-arms                   # TODO: fix by combining with `or`
    "SIM115",  # OpenFileWithContextHandler          # TODO: fix to prevent resource leak
    "SIM117",  # MultipleWithStatements              # TODO: fix
    "SIM118",  # KeyInDict                           # TODO: autofix, but be careful of Mapping
    "SIM201",  # NegateEqualOp                       # TODO: autofix, ensure neq is implemented
    "SIM202",  # NegateNotEqualOp                    # TODO: autofix, ensure eq is implemented
    "SIM300",  # yoda condition                      # TODO: partially on & not aggressive

    # flake8-self
    "SLF001", # private member access

    # flake8-print (T20)
    "T201",  # PrintUsed                             # TODO: change to logging

    # tryceratops (TRY)
    "TRY002",  # raise-vanilla-class                 # NOTE: low priority fix, requiring API change
    "TRY003",  # raise-vanilla-args
    "TRY004",  # prefer-type-error                   # TODO: fix, but breaks API
    "TRY200",  # reraise-no-cause                    # TODO: fix
    "TRY201",  # verbose-raise                       # TODO: fix
    "TRY300",  # Consider `else` block               # TODO: fix
    "TRY301",  # raise-within-try                    # TODO: fix
    "TRY400",  # error-instead-of-exception          # TODO: fix

    # flake8-quotes (Q)
    "Q000",  # use double quotes                     # TODO: fix
    "Q002",  # double quote docstring (D300)         # TODO: fix
]
unfixable = [
    "E711"  # NoneComparison. Hard to fix b/c numpy has it's own None.
]

[tool.ruff.per-file-ignores]
"setup.py" = ["INP001"]  # Part of configuration, not a package.
"__init__.py" = ["E402", "F401", "F403"]
"astropy/coordinates/angle_formats.py" = ["D415"]  # The docstrings are regexes.
"astropy/io/registry/compat.py" = ["F822"]
"astropy/modeling/models.py" = ["F401", "F403", "F405"]
"astropy/units/format/*.py" = ["D415"]  # The docstrings are regexes.
"astropy/utils/decorators.py" = [
    "D214", "D215",  # keep Examples section indented.
    "D411",  # sphinx treats spaced example sections as real sections
]
"test_*.py" = ["B011", "D", "E402", "PGH001", "S101"]
".pyinstaller/*.py" = ["INP001"]  # Not a package.
"conftest.py" = ["INP001"]  # Part of configuration, not a package.
"docs/*.py" = [
    "INP001",  # implicit-namespace-package. The examples are not a package.
]
"examples/*.py" = [
    "D415",  # EndsInPeriod. The examples use RST syntax, not a one-line title.
    "E402",  # Imports are done as needed.
    "INP001", # implicit-namespace-package. The examples are not a package.
    "T203"
]

[tool.ruff.isort]
    known-third-party = ["erfa", "PyYAML", "packaging", "pytest", "scipy", "matplotlib"]
    known-first-party = ["astropy", "extension_helpers"]
    force-sort-within-sections = true

[tool.ruff.pydocstyle]
convention = "numpy"


[tool.coverage]

    [tool.coverage.run]
        omit = [
            "astropy/__init__*",
            "astropy/conftest.py",
            "astropy/*setup*",
            "astropy/*/tests/*",
            "astropy/tests/test_*",
            "astropy/extern/*",
            "astropy/utils/compat/*",
            "astropy/version*",
            "astropy/wcs/docstrings*",
            "*/astropy/__init__*",
            "*/astropy/conftest.py",
            "*/astropy/*setup*",
            "*/astropy/*/tests/*",
            "*/astropy/tests/test_*",
            "*/astropy/extern/*",
            "*/astropy/utils/compat/*",
            "*/astropy/version*",
            "*/astropy/wcs/docstrings*",
        ]

    [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 defensive assertion code:
            "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}",
            # Don't complain about IPython completion helper
            "def _ipython_key_completions_",
        ]

[tool.towncrier]
    package = "astropy"
    filename = "CHANGES.rst"
    directory = "docs/changes"
    underlines = "=-^"
    template = "docs/changes/template.rst"
    title_format = "Version {version} ({project_date})"

    [[tool.towncrier.type]]
        directory = "feature"
        name = "New Features"
        showcontent = true

    [[tool.towncrier.type]]
        directory = "api"
        name = "API Changes"
        showcontent = true

    [[tool.towncrier.type]]
        directory = "bugfix"
        name = "Bug Fixes"
        showcontent = true

    [[tool.towncrier.type]]
        directory = "other"
        name = "Other Changes and Additions"
        showcontent = true

    [[tool.towncrier.section]]
        name = ""
        path = ""

    [[tool.towncrier.section]]
        name = "astropy.config"
        path = "config"

    [[tool.towncrier.section]]
        name = "astropy.constants"
        path = "constants"

    [[tool.towncrier.section]]
        name = "astropy.convolution"
        path = "convolution"

    [[tool.towncrier.section]]
        name = "astropy.coordinates"
        path = "coordinates"

    [[tool.towncrier.section]]
        name = "astropy.cosmology"
        path = "cosmology"

    [[tool.towncrier.section]]
        name = "astropy.extern"
        path = "extern"

    [[tool.towncrier.section]]
        name = "astropy.io.ascii"
        path = "io.ascii"

    [[tool.towncrier.section]]
        name = "astropy.io.fits"
        path = "io.fits"

    [[tool.towncrier.section]]
        name = "astropy.io.misc"
        path = "io.misc"

    [[tool.towncrier.section]]
        name = "astropy.io.registry"
        path = "io.registry"

    [[tool.towncrier.section]]
        name = "astropy.io.votable"
        path = "io.votable"

    [[tool.towncrier.section]]
        name = "astropy.modeling"
        path = "modeling"

    [[tool.towncrier.section]]
        name = "astropy.nddata"
        path = "nddata"

    [[tool.towncrier.section]]
        name = "astropy.samp"
        path = "samp"

    [[tool.towncrier.section]]
        name = "astropy.stats"
        path = "stats"

    [[tool.towncrier.section]]
        name = "astropy.table"
        path = "table"

    [[tool.towncrier.section]]
        name = "astropy.tests"
        path = "tests"

    [[tool.towncrier.section]]
        name = "astropy.time"
        path = "time"

    [[tool.towncrier.section]]
        name = "astropy.timeseries"
        path = "timeseries"

    [[tool.towncrier.section]]
        name = "astropy.uncertainty"
        path = "uncertainty"

    [[tool.towncrier.section]]
        name = "astropy.units"
        path = "units"

    [[tool.towncrier.section]]
        name = "astropy.utils"
        path = "utils"

    [[tool.towncrier.section]]
        name = "astropy.visualization"
        path = "visualization"

    [[tool.towncrier.section]]
        name = "astropy.wcs"
        path = "wcs"

[tool.gilesbot]
    [tool.gilesbot.circleci_artifacts]
        enabled = true

    [tool.gilesbot.pull_requests]
        enabled = true

    [tool.gilesbot.towncrier_changelog]
        enabled = true
        verify_pr_number = true
        changelog_skip_label = "no-changelog-entry-needed"
        help_url = "https://github.com/astropy/astropy/blob/main/docs/changes/README.rst"
        changelog_missing_long = "There isn't a changelog file in this pull request. Please add a changelog file to the `changelog/` directory following the instructions in the changelog [README](https://github.com/astropy/astropy/blob/main/docs/changes/README.rst)."
        type_incorrect_long = "The changelog file you added is not one of the allowed types. Please use one of the types described in the changelog [README](https://github.com/astropy/astropy/blob/main/docs/changes/README.rst)"
        number_incorrect_long = "The number in the changelog file you added does not match the number of this pull request. Please rename the file."

    [tool.gilesbot.circleci_artifacts.py39-test-image-mpl334]
        url = ".tmp/py39-test-image-mpl334/results/fig_comparison.html"
        message = "Click details to see the figure test comparisons, for py39-test-image-mpl334."
        report_on_fail = true

    [tool.gilesbot.circleci_artifacts.py39-test-image-mpldev]
        url = ".tmp/py39-test-image-mpldev/results/fig_comparison.html"
        message = "Click details to see the figure test comparisons for py39-test-image-mpldev."
        report_on_fail = true

[tool.codespell]
skip = "*.dat,*.fits,*.hdr,*.xml,*egg*,*extern/*,.git,.tox,_build,fitshdr.htest_groups.py,venv,_*.c,wcs.h,lin.h,tab.h,spc.h,cython*"
# The following list of words for codespell to ignore may contain some
# misspellings that should be revisited and fixed in the future.
ignore-words-list = """
    ans,
    clen,
    cna,
    compiletime,
    coo,
    datas,
    ded,
    dfine,
    dne,
    doesnt,
    dout,
    dum,
    falsy,
    fo,
    fot,
    hart,
    hel,
    hendler,
    inflight,
    inout,
    lightyear,
    lod,
    lond,
    mapp,
    milimeter,
    moreso,
    nax,
    nd,
    ndefined,
    ned,
    nin,
    numer,
    ond,
    ot,
    precessing,
    pres,
    rade,
    rotat,
    siz,
    som,
    splitted,
    stil,
    struc,
    te,
    thex,
    timere,
    tread,
    trun,
    ue,
    valu,
    watn,
    watstr,
    wirth"""
back to top