{
  "__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": "f2py:buildtools:distutils-to-meson",
  "arbitrary": [
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "As per the timeline laid out in "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "distutils-status-migration",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "docs",
                "path": "reference:distutils_status_migration"
              },
              "kind": "exists"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "distutils"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " has ceased to be the default build backend for "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "f2py"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". This page collects common workflows in both formats."
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "note",
          "base_type": "note",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "note "
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "This is a "
                },
                {
                  "__type": "Strong",
                  "__tag": 4048,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "living"
                    }
                  ]
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " document, "
                },
                {
                  "__type": "Link",
                  "__tag": 4049,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "pull requests"
                    }
                  ],
                  "url": "https://numpy.org/doc/stable/dev/howto-docs.html",
                  "title": ""
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " are very welcome!"
                }
              ]
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "1 Migrating to "
        },
        {
          "__type": "InlineCode",
          "__tag": 4051,
          "value": "meson"
        }
      ],
      "level": 0,
      "target": "f2py-meson-distutils"
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "We will start out with a slightly modern variation of the classic Fibonnaci series generator."
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "! fib.f90\nsubroutine fib(a, n)\n  use iso_c_binding\n   integer(c_int), intent(in) :: n\n   integer(c_int), intent(out) :: a(n)\n   do i = 1, n\n      if (i .eq. 1) then\n         a(i) = 0.0d0\n      elseif (i .eq. 2) then\n         a(i) = 1.0d0\n      else\n         a(i) = a(i - 1) + a(i - 2)\n      end if\n   end do\nend",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "This will not win any awards, but can be a reasonable starting point."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "1.1 Baseline"
        }
      ],
      "level": 1,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "1.2 Compilation options"
        }
      ],
      "level": 1,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "This is unchanged:"
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "python -m numpy.f2py -c fib.f90 -m fib\n❯ python -c \"import fib; print(fib.fib(30))\"\n[     0      1      1      2      3      5      8     13     21     34\n     55     89    144    233    377    610    987   1597   2584   4181\n   6765  10946  17711  28657  46368  75025 121393 196418 317811 514229]",
          "execution_status": null
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "1.2.1 Basic Usage"
        }
      ],
      "level": 2,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "1.2.2 Specify the backend"
        }
      ],
      "level": 2,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Similarly, "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "CC"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " can be used in both cases to set the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "C"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " compiler. Since the environment variables are generally pretty common across both, so a small sample is included below."
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "note",
          "base_type": "note",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "note "
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "For Windows, these may not work very reliably, so "
                },
                {
                  "__type": "Link",
                  "__tag": 4049,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "native files"
                    }
                  ],
                  "url": "https://mesonbuild.com/Native-environments.html",
                  "title": ""
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " are likely the best bet, or by direct "
                },
                {
                  "__type": "InlineRole",
                  "__tag": 4003,
                  "value": "1.3 Customizing builds",
                  "domain": null,
                  "role": null,
                  "inventory": null
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "."
                }
              ]
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "1.2.3 Pass a compiler name"
        }
      ],
      "level": 2,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Here, "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "meson"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " can actually be used to set dependencies more robustly."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "1.2.4 Dependencies"
        }
      ],
      "level": 2,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Both "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "meson"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "distutils"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " are capable of linking against libraries."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "1.2.5 Libraries"
        }
      ],
      "level": 2,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "1.3 Customizing builds"
        }
      ],
      "level": 1,
      "target": null
    }
  ],
  "local_refs": []
}