|
| 1 | +# The (unofficial) SQLite package manager |
| 2 | + |
| 3 | +`sqlpkg` manages SQLite extensions, just like `pip` does with Python packages or `brew` does with macOS programs. |
| 4 | + |
| 5 | +It works primarily with the [SQLite package registry](https://sqlpkg.org/), but is not limited to it. You can install SQLite extensions from GitHub repositories or other websites. All you need is a package spec file (more on that later). |
| 6 | + |
| 7 | +Please note that `sqlpkg` is new and a bit rough around the edges. |
| 8 | + |
| 9 | +## Downloading and installing |
| 10 | + |
| 11 | +`sqlpkg` is a binary executable file (`sqlpkg.exe` on Windows, `sqlpkg` on Linux/macOS). Download it from the link below and put it somewhere in your `PATH` ([what's that?](https://stackoverflow.com/a/41895179/19962064)), so you can run it from anyhwere on your computer. |
| 12 | + |
| 13 | +[**Download**](https://github.com/nalgeon/sqlpkg-cli/releases/latest) |
| 14 | + |
| 15 | +Then run it from the command line (terminal) as described below. |
| 16 | + |
| 17 | +## Installing packages |
| 18 | + |
| 19 | +Install a package from the registry: |
| 20 | + |
| 21 | +``` |
| 22 | +sqlpkg install nalgeon/stats |
| 23 | +``` |
| 24 | + |
| 25 | +`nalgeon/stats` is the ID of the extension as shown in the registry. |
| 26 | + |
| 27 | +Install a package from a GitHub repository (it should have a package spec file): |
| 28 | + |
| 29 | +``` |
| 30 | +sqlpkg install github.com/nalgeon/sqlean |
| 31 | +``` |
| 32 | + |
| 33 | +Install a package from a spec file somewhere on the Internet: |
| 34 | + |
| 35 | +``` |
| 36 | +sqlpkg install https://antonz.org/downloads/stats.json |
| 37 | +``` |
| 38 | + |
| 39 | +Install a package from a local spec file: |
| 40 | + |
| 41 | +``` |
| 42 | +sqlpkg install ./stats.json |
| 43 | +``` |
| 44 | + |
| 45 | +## Package location |
| 46 | + |
| 47 | +By default, `sqlpkg` installs all extensions in the home folder: |
| 48 | + |
| 49 | +- `%USERPROFILE%\.sqlpkg` on Windows |
| 50 | +- `~/.sqlpkg` on Linux/macOS |
| 51 | + |
| 52 | +So for our `nalgeon/stats` extension it might be: |
| 53 | + |
| 54 | +- `C:\Users\anton\.sqlpkg\nalgeon\stats\stats.dll` on Windows |
| 55 | +- `/home/anton/.sqlpkg/nalgeon/stats/stats.so` on Linux |
| 56 | +- `/Users/anton/.sqlpkg/nalgeon/stats/stats.dylib` on macOS |
| 57 | + |
| 58 | +## Other commands |
| 59 | + |
| 60 | +`sqlpkg` provides other basic commands you would expect from a package manager. |
| 61 | + |
| 62 | +### `update` |
| 63 | + |
| 64 | +``` |
| 65 | +sqlpkg update |
| 66 | +``` |
| 67 | + |
| 68 | +Updates all installed packages to the latest versions. |
| 69 | + |
| 70 | +### `list` |
| 71 | + |
| 72 | +``` |
| 73 | +sqlpkg list |
| 74 | +``` |
| 75 | + |
| 76 | +Lists installed packages. |
| 77 | + |
| 78 | +### `info` |
| 79 | + |
| 80 | +``` |
| 81 | +sqlpkg info nalgeon/stats |
| 82 | +``` |
| 83 | + |
| 84 | +Displays package information. Works with both local and remote packages. |
| 85 | + |
| 86 | +### `uninstall` |
| 87 | + |
| 88 | +``` |
| 89 | +sqlpkg uninstall nalgeon/stats |
| 90 | +``` |
| 91 | + |
| 92 | +Uninstalls a previously installed package. |
| 93 | + |
| 94 | +## Using a local repository |
| 95 | + |
| 96 | +By default, `sqlpkg` installs all extensions in the home folder. If you are writing a Python (JavaScript, Go, ...) application — you may prefer to put them in the project folder (think virtual environment in Python or `node_modules` in JavaScript). |
| 97 | + |
| 98 | +To do that, run the `init` command: |
| 99 | + |
| 100 | +``` |
| 101 | +sqlpkg init |
| 102 | +``` |
| 103 | + |
| 104 | +It will create an `.sqlpkg` folder in the current directory. After that, all other commands run from the same directory will use it instead of the home folder. |
| 105 | + |
| 106 | +## Package spec file |
| 107 | + |
| 108 | +The package spec file describes a particular package so that `sqlpkg` can work with it. It is usually created by the package author, so if you are a `sqlpkg` user, you don't need to worry about that. |
| 109 | + |
| 110 | +If you _are_ a package author, who wants your package to be installable by `sqlpkg`, learn how to create a spec file using [this guide](docs/spec-file.md) (coming soon). |
| 111 | + |
| 112 | +That's all for now. Now try some packages! |
| 113 | + |
| 114 | +[⬇️ Download](https://github.com/nalgeon/sqlpkg-cli/releases/latest) • |
| 115 | +[✨ Explore](https://sqlpkg.org/) • |
| 116 | +[🚀 Follow](https://twitter.com/ohmypy) |
0 commit comments