1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461
|
<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Installation and customization — APSW 3.46.0.1 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=72bcf2f2" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=19f00094" />
<link rel="stylesheet" type="text/css" href="_static/apsw.css?v=3c7e2631" />
<link rel="shortcut icon" href="_static/favicon.ico"/>
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script src="_static/jquery.js?v=5d32c60e"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="_static/documentation_options.js?v=d98f5d2b"></script>
<script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/js/theme.js"></script>
<link rel="author" title="About these documents" href="about.html" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="copyright" title="Copyright" href="copyright.html" />
<link rel="next" title="Extensions" href="extensions.html" />
<link rel="prev" title="Example/Tour" href="example.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home">
APSW
<img src="_static/apswlogo.png" class="logo" alt="Logo"/>
</a>
<div class="version">
3.46.0.1
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="about.html">About</a></li>
<li class="toctree-l1"><a class="reference internal" href="tips.html">Tips</a></li>
<li class="toctree-l1"><a class="reference internal" href="example.html">Example/Tour</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Installation and customization</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#pypi-recommended">PyPI (recommended)</a></li>
<li class="toctree-l2"><a class="reference internal" href="#linux-bsd-provided">Linux/BSD provided</a></li>
<li class="toctree-l2"><a class="reference internal" href="#source">Source</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#verifying-your-download">Verifying your download</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#building-and-customization">Building and customization</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#build-process">Build process</a></li>
<li class="toctree-l3"><a class="reference internal" href="#sqlite-options">SQLite options</a></li>
<li class="toctree-l3"><a class="reference internal" href="#finding-sqlite">Finding SQLite</a></li>
<li class="toctree-l3"><a class="reference internal" href="#setup-py-commands-and-their-options">setup.py commands and their options</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#setup-build-flags">build</a></li>
<li class="toctree-l4"><a class="reference internal" href="#fetch">fetch</a></li>
<li class="toctree-l4"><a class="reference internal" href="#build-ext">build_ext</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#testing">Testing</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="extensions.html">Extensions</a></li>
<li class="toctree-l1"><a class="reference internal" href="apsw.html">APSW Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="connection.html">Connections to a database</a></li>
<li class="toctree-l1"><a class="reference internal" href="cursor.html">Cursors (executing SQL)</a></li>
<li class="toctree-l1"><a class="reference internal" href="blob.html">Blob Input/Output</a></li>
<li class="toctree-l1"><a class="reference internal" href="backup.html">Backup</a></li>
<li class="toctree-l1"><a class="reference internal" href="vtable.html">Virtual Tables</a></li>
<li class="toctree-l1"><a class="reference internal" href="vfs.html">Virtual File System (VFS)</a></li>
<li class="toctree-l1"><a class="reference internal" href="shell.html">Shell</a></li>
<li class="toctree-l1"><a class="reference internal" href="bestpractice.html">Best Practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="ext.html">Various interesting and useful bits of functionality</a></li>
<li class="toctree-l1"><a class="reference internal" href="exceptions.html">Exceptions and Errors</a></li>
<li class="toctree-l1"><a class="reference internal" href="execution.html">Execution and tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="dbapi.html">DBAPI notes</a></li>
<li class="toctree-l1"><a class="reference internal" href="pysqlite.html">sqlite3 module differences</a></li>
<li class="toctree-l1"><a class="reference internal" href="benchmarking.html">Benchmarking</a></li>
<li class="toctree-l1"><a class="reference internal" href="copyright.html">Copyright and License</a></li>
<li class="toctree-l1"><a class="reference internal" href="changes.html">Change History</a></li>
<li class="toctree-l1"><a class="reference internal" href="py-modindex.html">Module Index</a></li>
<li class="toctree-l1"><a class="reference internal" href="genindex.html">Index</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">APSW</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content style-external-links">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active">Installation and customization</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/install.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul><div class="rst-breadcrumbs-buttons" role="navigation" aria-label="Sequential page navigation">
<a href="example.html" class="btn btn-neutral float-left" title="Example/Tour" accesskey="p"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="extensions.html" class="btn btn-neutral float-right" title="Extensions" accesskey="n">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="installation-and-customization">
<h1>Installation and customization<a class="headerlink" href="#installation-and-customization" title="Link to this heading"></a></h1>
<section id="pypi-recommended">
<span id="pypi"></span><h2>PyPI (recommended)<a class="headerlink" href="#pypi-recommended" title="Link to this heading"></a></h2>
<p>APSW is on PyPI at <a class="reference external" href="https://pypi.org/project/apsw/">https://pypi.org/project/apsw/</a></p>
<p>It can be installed in the same way as other packages:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">python3</span> <span class="o">-</span><span class="n">m</span> <span class="n">pip</span> <span class="n">install</span> <span class="n">apsw</span>
</pre></div>
</div>
<p>When you install from PyPI:</p>
<ul>
<li><p>The corresponding SQLite version is embedded privately inside
and not affected by or visible to the rest of the machine or
even the rest of the process.</p>
<p>This means other modules and libraries will continue using
whatever SQLite they would have before. For example <a class="reference external" href="https://developer.apple.com/documentation/coredata">Core Data</a> on MacOS
uses SQLite, but will not know of or be affected by the SQLite
inside APSW.</p>
</li>
<li><p>All <a class="reference internal" href="extensions.html"><span class="doc">extensions</span></a> are enabled, except ICU.</p></li>
<li><p><a class="reference external" href="https://www.sqlite.org/compile.html#enable_column_metadata">SQLITE_ENABLE_COLUMN_METADATA</a>
is enabled, providing <a class="reference internal" href="cursor.html#apsw.Cursor.description_full" title="apsw.Cursor.description_full"><code class="xref py py-attr docutils literal notranslate"><span class="pre">Cursor.description_full</span></code></a></p></li>
</ul>
<p>The PyPI releases include pre-built binaries for common platforms. If yours is not covered, then
pip will download the source release and automatically compile with the same settings. It will
require a C compiler and the Python development header files.</p>
</section>
<section id="linux-bsd-provided">
<h2>Linux/BSD provided<a class="headerlink" href="#linux-bsd-provided" title="Link to this heading"></a></h2>
<p>Most Linux & BSD distributions have packaged APSW which may trail the
SQLite and APSW releases by a year, or more. The distribution provided
APSW uses the system wide SQLite library.</p>
<table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p>Debian</p></td>
<td><p>Install <a class="reference external" href="https://packages.debian.org/python3-apsw">python3-apsw</a></p></td>
</tr>
<tr class="row-even"><td><p>Fedora</p></td>
<td><p>Install <a class="reference external" href="https://packages.fedoraproject.org/pkgs/python-apsw/">python3-apsw</a></p></td>
</tr>
<tr class="row-odd"><td><p>Ubuntu</p></td>
<td><p>Install <a class="reference external" href="https://packages.ubuntu.com/search?suite=all&searchon=names&keywords=apsw">python3-apsw</a></p></td>
</tr>
<tr class="row-even"><td><p>Gentoo</p></td>
<td><p>Install <a class="reference external" href="https://packages.gentoo.org/package/dev-python/apsw">dev-python/apsw</a></p></td>
</tr>
<tr class="row-odd"><td><p>Arch</p></td>
<td><p>Install <a class="reference external" href="https://www.archlinux.org/packages/?q=apsw">python-apsw</a></p></td>
</tr>
<tr class="row-even"><td><p>FreeBSD</p></td>
<td><p><a class="reference external" href="https://cgit.freebsd.org/ports/tree/databases/py-apsw">databases/py-apsw</a> in <a class="reference external" href="https://docs.freebsd.org/en/books/handbook/ports/">Ports</a></p></td>
</tr>
</tbody>
</table>
<p>There is a <a class="reference external" href="https://repology.org/project/python:apsw/versions">full list (150+)</a> of
distributions, the package name for APSW, and what APSW version they
are currently on.</p>
</section>
<section id="source">
<h2>Source<a class="headerlink" href="#source" title="Link to this heading"></a></h2>
<p>It is recommended you get the source from <a class="reference external" href="https://github.com/rogerbinns/apsw/releases">Github releases</a>. If you get the
source from <a class="reference external" href="https://pypi.org/project/apsw/">PyPi</a> then ensure you
edit the <code class="file docutils literal notranslate"><span class="pre">setup.apsw</span></code> file inside.</p>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/rogerbinns/apsw/releases/download/3.46.0.1/apsw-3.46.0.1.zip">apsw-3.46.0.1.zip</a>
(Source, includes this HTML Help)</p></li>
<li><p><a class="reference external" href="https://github.com/rogerbinns/apsw/releases/download/3.46.0.1/apsw-3.46.0.1.cosign-bundle">apsw-3.46.0.1.cosign-bundle</a>
cosign signature</p></li>
</ul>
<section id="verifying-your-download">
<span id="verifydownload"></span><h3>Verifying your download<a class="headerlink" href="#verifying-your-download" title="Link to this heading"></a></h3>
<p>Github <a class="reference external" href="https://github.com/rogerbinns/apsw/releases">source releases</a> are
digitally signed so you can verify they have not been tampered with,
and were produced by the project maintainer.</p>
<p><a class="reference external" href="https://www.sigstore.dev/">Sigstore</a> is used via the <a class="reference external" href="https://docs.sigstore.dev/signing/quickstart/">cosign tool</a>. Download the
corresponding cosign bundle which contains the signature.</p>
<p>Verify</p>
<blockquote>
<div><p><a class="reference external" href="https://docs.sigstore.dev/system_config/installation/">Install cosign</a> if you
don’t have it already. It is <a class="reference external" href="https://github.com/sigstore/cosign/releases/">available for a wide variety of
platforms</a>
including Linux, MacOS, and Windows.</p>
<p>Checking the signature needs to provide the source release, the
cosign bundle, the maintainer id, and issuer. The command is all
one line shown here across multiple lines for clarity.</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>cosign<span class="w"> </span>verify-blob<span class="w"> </span>apsw-3.46.0.1.zip<span class="w"> </span><span class="se">\</span>
<span class="w"> </span>--bundle<span class="w"> </span>apsw-3.46.0.1.cosign-bundle<span class="w"> </span><span class="se">\</span>
<span class="w"> </span>--certificate-identity<span class="o">=</span>rogerb@rogerbinns.com<span class="w"> </span><span class="se">\</span>
<span class="w"> </span>--certificate-oidc-issuer<span class="o">=</span>https://github.com/login/oauth
<span class="go">Verified OK</span>
</pre></div>
</div>
<p>Check for a success exit code, and verified message.</p>
</div></blockquote>
</section>
</section>
<section id="building-and-customization">
<span id="build"></span><h2>Building and customization<a class="headerlink" href="#building-and-customization" title="Link to this heading"></a></h2>
<p>APSW is configured for standard building (<span class="target" id="index-0"></span><a class="pep reference external" href="https://peps.python.org/pep-0518/"><strong>PEP 518</strong></a>)</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>python3<span class="w"> </span>-m<span class="w"> </span>build
</pre></div>
</div>
<p>You will need to update the MANIFEST first if you are providing your
own SQLite, or if you are providing a <code class="docutils literal notranslate"><span class="pre">setup.apsw</span></code> with custom
configuration. <a class="reference external" href="https://setuptools.pypa.io/en/latest/index.html">setuptools</a> is used to
compile the extension. You can use it directly instead by invoking
<code class="docutils literal notranslate"><span class="pre">setup.py</span></code>.</p>
<section id="build-process">
<h3>Build process<a class="headerlink" href="#build-process" title="Link to this heading"></a></h3>
<p>A series of commands and options are given to <code class="file docutils literal notranslate"><span class="pre">setup.py</span></code> in this pattern:</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>python<span class="w"> </span>setup.py<span class="w"> </span>cmdone<span class="w"> </span>--option<span class="w"> </span>--option<span class="w"> </span>value<span class="w"> </span>cmdtwo<span class="w"> </span>--option<span class="w"> </span><span class="se">\</span>
<span class="w"> </span>cmdthree<span class="w"> </span>--option<span class="w"> </span>--option<span class="w"> </span>value
</pre></div>
</div>
<p>The only necessary command is <strong>build</strong>. You can get help by <cite>–help</cite>:</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>python<span class="w"> </span>setup.py<span class="w"> </span>build<span class="w"> </span>--help
</pre></div>
</div>
<p>Each command takes options which can be specified on the command line,
or in a configuration file named <code class="file docutils literal notranslate"><span class="pre">setup.cfg</span></code> or
<code class="file docutils literal notranslate"><span class="pre">setup.apsw</span></code>. The leading double dash on options is omitted,
and dashes inside should become underscores.</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="c1"># This is used with pypi source and binary builds</span>
<span class="k">[build]</span>
<span class="c1"># download corresponding sqlite release</span>
<span class="na">fetch</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">True</span>
<span class="c1"># all extensions included</span>
<span class="na">enable_all_extensions</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">True</span>
<span class="c1"># ... except icu (not abi stable)</span>
<span class="na">omit</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">icu</span>
<span class="c1"># for Cursor.description_full</span>
<span class="na">enable</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">COLUMN_METADATA</span>
</pre></div>
</div>
</section>
<section id="sqlite-options">
<h3>SQLite options<a class="headerlink" href="#sqlite-options" title="Link to this heading"></a></h3>
<p>It is important to understand <a class="reference external" href="https://www.sqlite.org/compile.html">SQLite’s compile time options</a>. They provide control
over functionality and APIs included or excluded from SQLite.</p>
<p>APSW needs to know the options chosen so it can adapt. For example if
extension loading is omitted from SQLite then APSW also needs to omit
the same functionality, otherwise compilation or linking will fail.</p>
</section>
<section id="finding-sqlite">
<h3>Finding SQLite<a class="headerlink" href="#finding-sqlite" title="Link to this heading"></a></h3>
<p>APSW can fetch SQLite as detailed below, and places it in a
<code class="file docutils literal notranslate"><span class="pre">sqlite3/</span></code> subdirectory. You can place your own SQLite in that
directory. If there is a <code class="file docutils literal notranslate"><span class="pre">sqlite3.c</span></code> (ie the <a class="reference external" href="https://www.sqlite.org/amalgamation.html">amalgamation</a>) then it will be
statically included inside APSW. A compiled SQLite will be picked up
if present. If none of that is present, then the standard compiler
locations are used (eg <code class="file docutils literal notranslate"><span class="pre">/usr/include</span></code> on Unix).</p>
<p>If <code class="file docutils literal notranslate"><span class="pre">sqlite3/sqlite3config.h</span></code> is present it is included before
<code class="file docutils literal notranslate"><span class="pre">sqlite3/sqlite3.c</span></code>. It is a good location to put <a class="reference external" href="https://www.sqlite.org/compile.html#_platform_configuration">platform
configuration</a> which
APSW’s fetch does automatically by running <code class="file docutils literal notranslate"><span class="pre">configure</span></code>.</p>
</section>
<section id="setup-py-commands-and-their-options">
<span id="setup-py-flags"></span><h3>setup.py commands and their options<a class="headerlink" href="#setup-py-commands-and-their-options" title="Link to this heading"></a></h3>
<p>These are the relevant <code class="file docutils literal notranslate"><span class="pre">setup.py</span></code> commands and their relevant options.</p>
<section id="setup-build-flags">
<span id="id1"></span><h4>build<a class="headerlink" href="#setup-build-flags" title="Link to this heading"></a></h4>
<p>Does the complete build. This will invoke <cite>build_ext</cite> - use only one of
<cite>build</cite> or <cite>build_ext</cite>.</p>
<table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">--fetch</span></code></p></td>
<td><p>Fetches the corresponding SQLite version</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">--enable-all-extensions</span></code></p></td>
<td><p>Enables all the <a class="reference internal" href="extensions.html"><span class="doc">standard extensions</span></a></p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">--enable</span></code></p></td>
<td><p>A comma separated list of <a class="reference external" href="https://www.sqlite.org/compile.html#_options_to_enable_features_normally_turned_off">options to enable that are normally
off</a>
omitting the <code class="code docutils literal notranslate"><span class="pre">SQLITE_ENABLE</span></code> prefix. They will be
uppercased. eg <code class="code docutils literal notranslate"><span class="pre">--enable</span> <span class="pre">column_metadata,fts5</span></code></p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">--omit</span></code></p></td>
<td><p>A comma separated list of <a class="reference external" href="https://www.sqlite.org/compile.html#_options_to_omit_features">options to omit that are normally
enabled</a>
omitting the <code class="code docutils literal notranslate"><span class="pre">SQLITE_OMIT</span></code> prefix. They will be
uppercased. eg <code class="code docutils literal notranslate"><span class="pre">--omit</span> <span class="pre">automatic_index</span></code></p></td>
</tr>
</tbody>
</table>
</section>
<section id="fetch">
<span id="fetch-checksums"></span><h4>fetch<a class="headerlink" href="#fetch" title="Link to this heading"></a></h4>
<p>This provides more fine grained control over what is fetched.</p>
<table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">--version</span></code></p></td>
<td><p>Specify an explicit version of SQLite to fetch</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">--fetch-sqlite</span></code></p></td>
<td><p>Downloads the SQLite amalgamation</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">--all</span></code></p></td>
<td><p>Downloads all SQLite components other than the amalgamation.
Over time this has included additional extensions and SQLite
functions, but currently is nothing.</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">--missing-checksum-ok</span></code></p></td>
<td><p>APSW includes checksums of SQLite releases and will fail a
fetch if you specify a version for which no checksum is known.
This allows proceeding.</p></td>
</tr>
</tbody>
</table>
</section>
<section id="build-ext">
<span id="matching-sqlite-options"></span><h4>build_ext<a class="headerlink" href="#build-ext" title="Link to this heading"></a></h4>
<p>This performs the compilation of the C code, and provides more control than build.</p>
<table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">--use-system-sqlite-config</span></code></p></td>
<td><p>Uses <a class="reference external" href="https://docs.python.org/3/library/ctypes.html#module-ctypes" title="(in Python v3.12)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">ctypes</span></code></a> to determine the system wide SQLite library
compilation options</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">--definevalues</span></code></p></td>
<td><p>Additional #defines separated by commas. eg <code class="code docutils literal notranslate"><span class="pre">--definevalues</span>
<span class="pre">SQLITE_MAX_ATTACHED=37,SQLITE_EXTRA_INIT=mycore_init</span></code></p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">--enable-all-extensions</span></code></p></td>
<td><p>Enables all the <a class="reference internal" href="extensions.html"><span class="doc">standard extensions</span></a></p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">--enable</span></code></p></td>
<td><p>A comma separated list of <a class="reference external" href="https://www.sqlite.org/compile.html#_options_to_enable_features_normally_turned_off">options to enable that are normally
off</a>
omitting the <code class="code docutils literal notranslate"><span class="pre">SQLITE_ENABLE</span></code> prefix. They will be
uppercased. eg <code class="code docutils literal notranslate"><span class="pre">--enable</span> <span class="pre">column_metadata,fts5</span></code></p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">--omit</span></code></p></td>
<td><p>A comma separated list of <a class="reference external" href="https://www.sqlite.org/compile.html#_options_to_omit_features">options to omit that are normally
enabled</a>
omitting the <code class="code docutils literal notranslate"><span class="pre">SQLITE_OMIT</span></code> prefix. They will be
uppercased. eg <code class="code docutils literal notranslate"><span class="pre">--omit</span> <span class="pre">automatic_index</span></code></p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">--apsw-no-old-names</span></code></p></td>
<td><p>Excludes old non <span class="target" id="index-1"></span><a class="pep reference external" href="https://peps.python.org/pep-0008/"><strong>PEP 8</strong></a> <a class="reference internal" href="changes.html#renaming"><span class="std std-ref">complaint name aliases</span></a> from the extension and type stubs.</p></td>
</tr>
</tbody>
</table>
</section>
</section>
</section>
<section id="testing">
<span id="id2"></span><h2>Testing<a class="headerlink" href="#testing" title="Link to this heading"></a></h2>
<p>SQLite itself is <a class="reference external" href="https://sqlite.org/testing.html">extensively tested</a>. It has considerably more code
dedicated to testing than makes up the actual database functionality.</p>
<p>APSW includes tests which use the standard Python testing modules to
verify correct operation. New code is developed alongside the tests.
Reported issues also have test cases to ensure the issue doesn’t
happen or doesn’t happen again.:</p>
<div class="highlight-output notranslate"><div class="highlight"><pre><span></span><span class="go"> Python /usr/bin/python3 sys.version_info(major=3, minor=11, micro=6, releaselevel='final', serial=0) 64bit ELF</span>
<span class="go">Testing with APSW file /space/apsw/apsw/__init__.cpython-311-x86_64-linux-gnu.so</span>
<span class="go"> APSW version 3.44.0.0</span>
<span class="go"> SQLite lib version 3.44.0</span>
<span class="go">SQLite headers version 3044000</span>
<span class="go"> Using amalgamation True</span>
<span class="go">.............................................................A message due to RecursionError is possible, and what is being tested</span>
<span class="go">object address : 0x7fea3c94ada0</span>
<span class="go">object refcount : 1</span>
<span class="go">object type : 0x9de7a0</span>
<span class="go">object type name: TypeError</span>
<span class="go">object repr :</span>
<span class="go">lost sys.stderr</span>
<span class="go">object address : 0x7fea3c94ad40</span>
<span class="go">object refcount : 1</span>
<span class="go">object type : 0x9de7a0</span>
<span class="go">object type name: TypeError</span>
<span class="go">object repr :</span>
<span class="go">lost sys.stderr</span>
<span class="go">................................................................</span>
<span class="go">----------------------------------------------------------------------</span>
<span class="go">Ran 125 tests in 26.783s</span>
<span class="go">OK</span>
</pre></div>
</div>
<p>The tests also ensure that as much APSW code as possible is executed
including alternate paths through the code. 95.5% of the APSW code is
executed by the tests. In the source, there is a script that enables
extra code that deliberately induces extra conditions such as memory
allocation failures, SQLite returning error codes, Python APIs
erroring etc. That brings coverage up to 99.6% of the code.</p>
<p>A memory checker <a class="reference external" href="https://valgrind.org">Valgrind</a> and <a class="reference external" href="https://en.wikipedia.org/wiki/AddressSanitizer">compiler
sanitizer options</a>
are also used for further validation.</p>
<p>To ensure compatibility with the various Python versions, a script
downloads and compiles all supported Python versions in both debug and
release configurations (and 32 and 64 bit) against the APSW and SQLite
supported versions running the tests.</p>
<p>In short both SQLite and APSW have a lot of testing!</p>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="example.html" class="btn btn-neutral float-left" title="Example/Tour" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="extensions.html" class="btn btn-neutral float-right" title="Extensions" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>© <a href="copyright.html">Copyright</a> 2004-2024, Roger Binns <rogerb@rogerbinns.com>.
<span class="lastupdated">Last updated on Jun 16, 2024.
</span></p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>
|