|
| 1 | +--- |
| 2 | +icon: lucide/hammer |
| 3 | +--- |
| 4 | + |
| 5 | +# Set up a development environment |
| 6 | + |
| 7 | +We are providing instructions below to get you up and running if you want to |
| 8 | +build Zensical yourself and if you want to contribute to its development. |
| 9 | + |
| 10 | +!!! warning "Raise an issue before creating a pull request!" |
| 11 | + |
| 12 | + Zensical is evolving rapidly and while we work hard to keep the user |
| 13 | + experience stable, the implementation is still changing a lot. Since the |
| 14 | + grounds are shifting fast, you must open an issue before you create a pull |
| 15 | + request so that we can discuss what you want to work on. You must also read |
| 16 | + the page on [pull requests], which provides further guidance. |
| 17 | + |
| 18 | + [pull requests]: ../contribute/pull-requests.md |
| 19 | + |
| 20 | +## Prerequisites |
| 21 | + |
| 22 | +Zensical consists of a number of projects, each with its own repository. |
| 23 | +Depending on which component you want to work on, you will need to install |
| 24 | +different development tools. |
| 25 | + |
| 26 | +To be able to build Zensical, you need to have the following installed: |
| 27 | + |
| 28 | +- [the `uv` package and project manager][uv] |
| 29 | +- a [Rust toolchain] |
| 30 | +- [Python] |
| 31 | + |
| 32 | + [uv]: https://docs.astral.sh/uv/ |
| 33 | + [Rust toolchain]: https://rust-lang.org/tools/install/ |
| 34 | + [Python]: https://www.python.org/ |
| 35 | + |
| 36 | +To build the templates, CSS, and TypeScript from the [UI repository], you will |
| 37 | +need these additional dependencies: |
| 38 | + |
| 39 | +- [Node.js] |
| 40 | + |
| 41 | + [UI repository]: https://github.com/zensical/ui |
| 42 | + [Node.js]: https://nodejs.org |
| 43 | + |
| 44 | +## Development setup |
| 45 | + |
| 46 | +To build Zensical, you need to: |
| 47 | + |
| 48 | +1. Check out the code from the [zensical repository] or from your own fork if |
| 49 | + you are making a [pull request]: |
| 50 | + |
| 51 | + [zensical repository]: https://github.com/zensical/zensical/ |
| 52 | + [pull request]: ../contribute/pull-requests.md |
| 53 | + |
| 54 | + ``` |
| 55 | + git clone https://github.com/zensical/zensical.git |
| 56 | + ``` |
| 57 | + |
| 58 | +2. Run `uv sync` in the project directory to download and install the |
| 59 | + dependencies into the project's virtual environment. |
| 60 | + |
| 61 | +3. Install the theme content by cloning the [UI repository] and making sure that |
| 62 | + the contents of the `dist` directory appear under `python/zensical/templates` |
| 63 | + in the Zensical project workspace: |
| 64 | + |
| 65 | + |
| 66 | + === ":material-apple: macOS" |
| 67 | + |
| 68 | + ``` |
| 69 | + git clone https://github.com/zensical/ui.git |
| 70 | + ln -s ../../../ui/dist zensical/python/zensical/templates |
| 71 | + ``` |
| 72 | + |
| 73 | + === ":material-linux: Linux" |
| 74 | + |
| 75 | + ``` |
| 76 | + git clone https://github.com/zensical/ui.git |
| 77 | + ln -s ../../../ui/dist zensical/python/zensical/templates |
| 78 | + ``` |
| 79 | + |
| 80 | + === ":fontawesome-brands-windows: Windows (cmd.exe)" |
| 81 | + |
| 82 | + ``` |
| 83 | + git clone https://github.com/zensical/ui.git |
| 84 | + mklink zensical\python\zensical\templates ui\dist |
| 85 | + ``` |
| 86 | + |
| 87 | + __Note:__ You need the permission to create symbolic links to do this on |
| 88 | + Windows. |
| 89 | + |
| 90 | + === ":fontawesome-brands-windows: Windows (Powershell)" |
| 91 | + |
| 92 | + ``` |
| 93 | + git clone https://github.com/zensical/ui.git |
| 94 | + New-Item -Type SymbolicLink -Path zensical\python\zensical\templates -Target ui\dist |
| 95 | + ``` |
| 96 | + |
| 97 | + __Note:__ You need the permission to create symbolic links to do this on |
| 98 | + Windows. |
| 99 | + |
| 100 | +## Building Zensical |
| 101 | + |
| 102 | +With these preparations out of the way, you can build Zensical by running: |
| 103 | + |
| 104 | +``` |
| 105 | +uv run maturin develop |
| 106 | +``` |
| 107 | + |
| 108 | +## Running Zensical |
| 109 | + |
| 110 | +To run Zensical within its own project folder, you can use `uv run zensical`. |
| 111 | +Alternatively, activate the project virtual environment so you can just run |
| 112 | +`zensical` and run it in other directories. |
| 113 | + |
| 114 | +If you want to install your compiled version of Zensical in another project, |
| 115 | +activate its virtual environment and run `pip install -e |
| 116 | +/path/to/zensical/project`. |
| 117 | + |
| 118 | +## Building the themes |
| 119 | + |
| 120 | +To build the themes (modern and classic), change into the project directory for |
| 121 | +the UI repository and run: |
| 122 | + |
| 123 | +``` |
| 124 | +npm install |
| 125 | +npm run build |
| 126 | +``` |
| 127 | + |
| 128 | +Since the `dist` directory is symlinked into the Zensical project, the build |
| 129 | +artifacts will be immediately picked up by any new runs of Zensical. |
0 commit comments