---@diagnostic disable: missing-fields
return {
	{
		"mfussenegger/nvim-dap-python",
		dependencies = "mfussenegger/nvim-dap",
		config = function()
			local dap = require("dap")
			local dap_python = require("dap-python")

			dap_python.setup()

			dap.configurations.python = {
				{
					type = "python",
					request = "launch",
					name = "Launch file",
					program = "${file}",
					cwd = "${workspaceFolder}",
					env = { PYTHONPATH = "${workspaceFolder}" },
				},
				{
					type = "python",
					request = "launch",
					name = "Debug current file (integrated terminal)",
					program = "${file}",
					cwd = "${workspaceFolder}",
					console = "integratedTerminal",
					env = { PYTHONPATH = "${workspaceFolder}" },
				},
				{
					type = "python",
					request = "launch",
					name = "Debug with arguments",
					program = "${file}",
					cwd = "${workspaceFolder}",
					args = function()
						local args = vim.fn.input("Args: ", ""):split(" ")
						return args
					end,
					console = "integratedTerminal",
					env = { PYTHONPATH = "${workspaceFolder}" },
				},
				{
					type = "python",
					request = "launch",
					name = "Debug pytest file",
					module = "pytest",
					args = { "${file}", "-v", "-s" },
					cwd = "${workspaceFolder}",
					env = { PYTHONPATH = "${workspaceFolder}" },
					console = "integratedTerminal",
				},
				{
					type = "python",
					request = "launch",
					name = "Debug test_api.py",
					module = "unittest",
					cwd = "${workspaceFolder}",
					args = { "test.test_api", "-v" },
				},
				{
					type = "python",
					request = "launch",
					name = "Debug all tests",
					module = "unittest",
					cwd = "${workspaceFolder}",
					args = { "discover", "-s", "test", "-v" },
				},
			}

			vim.keymap.set("n", "<leader>dtm", dap_python.test_method, { desc = "Debug test method" })
			vim.keymap.set("n", "<leader>dtc", dap_python.test_class, { desc = "Debug test class" })
		end,
	},
}
