{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {},
  "_ordered_sections": [],
  "item_file": null,
  "item_line": null,
  "item_type": null,
  "aliases": [],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": null,
  "references": null,
  "qa": "dev:contributor:pep8",
  "arbitrary": [
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "All SciPy Python code should adhere to "
            },
            {
              "__type": "Link",
              "__tag": 4049,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "PEP8"
                }
              ],
              "url": "https://www.python.org/dev/peps/pep-0008/",
              "title": ""
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " style guidelines, with the exception that line length should be limited to 88 characters rather than 79. It's so important that some continuous integration tests on GitHub will fail due to certain PEP8 violations. Here are a few tips for ensuring PEP8 compliance before pushing your code:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Many integrated development environments (IDEs) have options that    automatically check for PEP8 compliance. In Spyder, for example,    "
                    },
                    {
                      "__type": "Link",
                      "__tag": 4049,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "enable Real-time code style analysis"
                        }
                      ],
                      "url": "https://stackoverflow.com/questions/51463223/how-to-use-pep8-module-using-spyder",
                      "title": ""
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " in Tools "
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "rarr"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " Preferences "
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "rarr"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "    Editor "
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "rarr"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " Code Introspection/Analysis and \"Automatically remove    trailing spaces when saving files\" in in Tools "
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "rarr"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " Preferences "
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "rarr"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "    Editor "
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "rarr"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " Advanced Settings. This can help you fix PEP8 issues as you    write your code."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Note, however, that SciPy's linting configuration may not match    that of your IDE exactly. See below on how to run the official    checks."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "It is recommended to leave existing style issues alone    unless they exist in lines of code you are already modifying.    This practice ensures that the codebase is gradually cleaned up    without dedicating precious review time to style-only cleanups."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Before sending a Pull Request, run the linter on changes made in    your feature branch. The checks will also be made during    continuous integration, but it's quicker to catch them early."
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The easiest way to do so is to install our pre-commit hook (once)       "
                    }
                  ]
                },
                {
                  "__type": "Code",
                  "__tag": 4050,
                  "value": "cp tools/pre-commit-hook.py .git/hooks/pre-commit",
                  "execution_status": null
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "This will run linting checks before each commit is made."
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Alternatively, you can run the check manually from the SciPy root directory        "
                    }
                  ]
                },
                {
                  "__type": "Code",
                  "__tag": 4050,
                  "value": "spin lint",
                  "execution_status": null
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "You can also run the linter on specific files, using the "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "--files"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " option        "
                    }
                  ]
                },
                {
                  "__type": "Code",
                  "__tag": 4050,
                  "value": "python tools/lint.py --files scipy/odr/models.py scipy/ndimage",
                  "execution_status": null
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If you have existing code with a lot of PEP8 issues, consider using    "
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "|autopep8|_"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " to automatically fix them before incorporating the code into    SciPy."
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The line length limit of 88 characters was chosen to match the defaults of popular tools like "
            },
            {
              "__type": "Link",
              "__tag": 4049,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "ruff"
                }
              ],
              "url": "https://pypi.org/project/ruff/",
              "title": ""
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "Link",
              "__tag": 4049,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "black"
                }
              ],
              "url": "https://pypi.org/project/black/",
              "title": ""
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". This strikes a balance between producing shorter files and reducing linter errors on the one hand, and maintaining reasonably short lines and the ability to view files side-by-side on the other."
            }
          ]
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "PEP8"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "enable Real-time code style analysis"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "ruff"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "black"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "autopep8"
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "PEP8 and SciPy"
        }
      ],
      "level": 0,
      "target": "pep8-scipy"
    }
  ],
  "local_refs": []
}