[build-system] requires = ["setuptools", "wheel"] build-backend = "setuptools.build_meta" [tool.towncrier] package = "cocotb" directory = "docs/source/newsfragments" filename = "docs/source/release_notes.rst" issue_format = ":pr:`{issue}`" # The first underline is used for the version/date header, # the second underline for the subcategories (like 'Features') underlines = ["=", "-"] all_bullets = false [[tool.towncrier.type]] directory = "feature" name = "Features" showcontent = true [[tool.towncrier.type]] directory = "bugfix" name = "Bugfixes" showcontent = true [[tool.towncrier.type]] directory = "doc" name = "Improved Documentation" showcontent = true [[tool.towncrier.type]] directory = "removal" name = "Deprecations and Removals" showcontent = true [[tool.towncrier.type]] directory = "change" name = "Changes" showcontent = true [tool.ruff] extend-exclude = [ "docs/source/conf.py", "makefiles", "venv", "_vendor", ".nox/", ] target-version = "py37" [tool.ruff.format] docstring-code-format = true [tool.ruff.lint] extend-select = [ "I", # isort "UP", # pyupgrade "PL", # pylint "E", # pycodestyle errors "W", # pycodestyle warnings "F", # pyflakes "C4", # flake8-comprehension "LOG", # flake8-logging "G", # flake8-logging-format "ISC", # implicit string concat "TC", # flake8-typechecking "SIM103", # return the condition directly "SIM300", # yoda conditions "RUF100", # unused noqa "RUF101", # redirected noqa "RUF010", # explicit type conversion in f-string "RUF005", # collection literal concatenation "RUF022", # unsorted __all__ "PERF101", # unnecessary list cast "PERF102", # unnecessary dict.items() "B007", # unused loop variable "PYI030", # unnecessary literal union ] ignore = [ "E741", # ambiguous variable name (preference) "E501", # line too long (preference) "PLR0912", # Too many branches (>12) (preference) "PLR0913", # Too many arguments to function call (>5) (preference) "PLR0915", # Too many statements (>50) (preference) "PLR2004", # Magic value used in comparison (preference) "PLW0603", # Using the global statement (preference) "PLR0911", # Too many return statements (preference) "PLW1641", # __eq__ without __hash__ (mypy compatibility) "UP021", # subprocess.run() universal_newlines => text (not supported in 3.6) ] [tool.ruff.lint.per-file-ignores] # necessary because of how file is included into documentation "examples/doc_examples/quickstart/test_my_design.py" = [ "E402", "F811", ] [tool.ruff.lint.isort] known-first-party = [ "cocotb", "cocotb_tools", "pygpi", ] known-third-party = [ "pytest", ] [tool.cibuildwheel] # Build for supported platforms only. # Even though we only support 64 bit operating systems, we still support 32 bit # userspace applications (Python and simulators) on Windows and Linux. # # - CPython on Linux i686 and x86_64 with glibc # - CPython on Windows i686 and x86_64 # - CPython on macOS x86_64 build = "cp*-manylinux_x86_64 cp*-manylinux_i686 cp*-win_amd64 cp*-win32 cp*-macosx_x86_64 cp*-macosx_arm64" # Build with optimizations and debugging # -O2 Enables reasonable optimizations. -O3 is unnecessary with the virtual-call-heavy code in the GPI and may bloat binary size. # -g Generate standard debugging info. # -flto Enable LTO which can reduce binary size and improve inlining. environment = {CFLAGS = "-O2 -g -flto", CPPFLAGS = "-O2 -g -flto", LDFLAGS = "-O2 -g -flto"} # By default, build on manylinux2014 for compatibility with CentOS/RHEL 7+ (once # the user updates Python) and Ubuntu 20.04+ (with system Python). manylinux-x86_64-image = "manylinux2014" manylinux-i686-image = "manylinux2014" # Build with optimizations and debugging (Windows) # /O2 Enables reasonable optimizations. # /Z7 Enables debugging and places info in the binary (/Zi puts debug info in a different file). # /Zo Improves debugging when optimizations are also enabled. # /LTCG Enables LTO which can reduce binary size and improve inlining. [tool.cibuildwheel.windows] environment = {CL = "/O2 /Z7 /Zo /LTCG"} [[tool.cibuildwheel.overrides]] # Build CPython 3.6 wheels on manylinux1 to support Ubuntu 18.04, CentOS/RHEL 7 # and CentOS/RHEL 8 with their default Python 3.6/pip 9 installation. select = "cp36-*" manylinux-x86_64-image = "manylinux1" manylinux-i686-image = "manylinux1" [tool.pytest.ini_options] # Note: Do *not* add files within the cocotb/ tree here. Add them to the # noxfile instead. testpaths = [ "tests/pytest", ] # Ensure that all markers used in pytests are declared (in here). addopts = "--strict-markers" markers = [ "simulator_required: mark tests as needing a simulator", "compile: the compile step in runner-based tests", ] # log_cli = true # log_cli_level = DEBUG [tool.coverage.paths] source = [ "src/cocotb/", ".nox/**/cocotb/", ] [tool.coverage.report] omit = [ "*/cocotb_tools/*", "*/_vendor/*", ] exclude_lines = [ # copy-pasted from coveragepy source # TODO when we can move to a newer version of coverage "#\\s*(pragma|PRAGMA)[:\\s]?\\s*(no|NO)\\s*(cover|COVER)", "^\\s*(((async )?def .*?)?\\)(\\s*->.*?)?:\\s*)?\\.\\.\\.\\s*(#|$)", "if (typing\\.)?TYPE_CHECKING:", ] [tool.codespell] ignore-words-list = [ "AFE", "Synopsys", "afe", "afile", "alog", "ccompiler", "datas", "implementors", "inout", "nam", "sting", "synopsys", ] [tool.mypy] packages = ["cocotb", "pygpi"] modules = ["noxfile"] disallow_untyped_defs = true disallow_any_unimported = true disallow_untyped_calls = true disallow_untyped_decorators = true no_implicit_optional = true warn_redundant_casts = true warn_unused_ignores = true implicit_reexport = false show_error_codes = true pretty = true