Skip to content

Commit 98383d4

Browse files
Add documentation site with Zensical (#173)
* Add documentation site with Zensical - Add docs/ directory with documentation pages (index, getting-started, usage, backup-strategy, contributing) - Add zensical.toml configuration for the docs site - Add docs.yml workflow for building and deploying to GitHub Pages - Update update-readme.yml to use uv instead of pip - Add docs shield badge to README.md - Add section markers to README.md for markdown-code-runner integration - Add Plausible analytics integration - Domain: rsync-time-machine.nijho.lt * Update README.md * Fix pre-commit linting issues * Update Plausible analytics script * Use README sections for contributing.md content * chore(docs): update TOC * Move Questions section to README for consistency * chore(docs): update TOC * Fix heading levels in contributing section Changed headings from ### to ## to maintain proper heading hierarchy (# Contributing → ## How to Contribute, ## Development Setup, etc.) * chore(docs): update TOC --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: basnijholt <[email protected]>
1 parent 0221b98 commit 98383d4

File tree

14 files changed

+2000
-9
lines changed

14 files changed

+2000
-9
lines changed

.github/workflows/docs.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: false
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v6
24+
25+
- name: Set up Python
26+
uses: actions/setup-python@v6
27+
with:
28+
python-version: '3.14.2'
29+
30+
- name: Install uv
31+
uses: astral-sh/setup-uv@v7
32+
33+
- name: Install dependencies
34+
run: |
35+
uv sync --group docs
36+
uv pip install -e .
37+
38+
- name: Generate docs content
39+
run: uv run python docs/generate.py
40+
41+
- name: Build documentation
42+
run: uv run zensical build
43+
44+
- name: Upload artifact
45+
uses: actions/upload-pages-artifact@v4
46+
with:
47+
path: ./site
48+
49+
deploy:
50+
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
51+
environment:
52+
name: github-pages
53+
url: ${{ steps.deployment.outputs.page_url }}
54+
runs-on: ubuntu-latest
55+
needs: build
56+
steps:
57+
- name: Deploy to GitHub Pages
58+
id: deployment
59+
uses: actions/deploy-pages@v4

.github/workflows/update-readme.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,12 @@ jobs:
1818

1919
- name: Set up Python
2020
uses: actions/setup-python@v6
21-
with:
22-
python-version: '3.14.2'
2321

24-
- name: Install Python dependencies
25-
run: |
26-
python -m pip install --upgrade pip
27-
pip install markdown-code-runner
28-
pip install -e .
22+
- name: Install uv
23+
uses: astral-sh/setup-uv@v7
2924

3025
- name: Run markdown-code-runner
31-
run: markdown-code-runner README.md
26+
run: uvx --with . markdown-code-runner README.md
3227

3328
- name: Commit updated README.md
3429
id: commit

README.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,18 @@
99
[![License](https://img.shields.io/github/license/basnijholt/rsync-time-machine.py)](https://github.com/basnijholt/rsync-time-machine.py/blob/main/LICENSE)
1010
[![Downloads](https://img.shields.io/pypi/dm/rsync-time-machine)](https://pypi.python.org/pypi/rsync-time-machine)
1111
![Open Issues](https://img.shields.io/github/issues-raw/basnijholt/rsync-time-machine.py)
12+
[![Docs](https://img.shields.io/badge/docs-rsync--time--machine.nijho.lt-blue)](https://rsync-time-machine.nijho.lt)
13+
14+
<!-- SECTION:intro:START -->
1215

1316
Introducing `rsync-time-machine.py` - a Python port of the [`rsync-time-backup`](https://github.com/laurent22/rsync-time-backup) script, offering Time Machine-style backups using rsync. It creates incremental backups of files and directories to the destination of your choice. The backups are structured in a way that makes it easy to recover any file at any point in time. 🚀
1417

1518
It works on Linux, macOS, and Windows (via WSL or Cygwin). The main advantage over Time Machine is flexibility, as it can backup from/to any filesystem and works on any platform. You can also backup to a Truecrypt drive without any problem. 😃
1619

1720
`rsync-time-machine.py` is fully tested, has no external dependencies (only Python ≥3.7 🐍), is fully compatible with [`rsync-time-backup`](https://github.com/laurent22/rsync-time-backup), offers pretty terminal output, and is fully typed! 🎉
1821

22+
<!-- SECTION:intro:END -->
23+
1924
<details><summary><b><u>[ToC]</u></b> 📚</summary>
2025

2126
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
@@ -33,11 +38,17 @@ It works on Linux, macOS, and Windows (via WSL or Cygwin). The main advantage ov
3338
- [:arrows_counterclockwise: How to Restore](#arrows_counterclockwise-how-to-restore)
3439
- [:star: Featured on](#star-featured-on)
3540
- [:heart: Support and Contributions](#heart-support-and-contributions)
41+
- [How to Contribute](#how-to-contribute)
42+
- [Development Setup](#development-setup)
43+
- [Code Style](#code-style)
44+
- [Questions?](#questions)
3645

3746
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
3847

3948
</details>
4049

50+
<!-- SECTION:features:START -->
51+
4152
## :star2: Features
4253

4354
* 📁 Each backup is in its own folder named after the current timestamp.
@@ -49,6 +60,8 @@ It works on Linux, macOS, and Windows (via WSL or Cygwin). The main advantage ov
4960
* 🧹 Automatically purge old backups based on a configurable expiration strategy.
5061
* 🔗 "latest" symlink that points to the latest successful backup.
5162

63+
<!-- SECTION:features:END -->
64+
5265
## :books: Usage
5366

5467
To use `rsync-time-machine.py`, you'll need to provide source and destination paths, along with any desired options:
@@ -130,6 +143,8 @@ options:
130143
131144
Please refer to the original [`rsync-time-backup`](https://github.com/laurent22/rsync-time-backup) README for a list of options, as they have been preserved in the Python port.
132145
146+
<!-- SECTION:installation:START -->
147+
133148
## :hammer_and_wrench: Installation
134149
135150
To install `rsync-time-machine.py`, simply clone the repository:
@@ -147,6 +162,10 @@ wget https://raw.githubusercontent.com/basnijholt/rsync-time-machine.py/main/rsy
147162
```
148163
and use it like `./rsync_time_machine.py --help`
149164
165+
<!-- SECTION:installation:END -->
166+
167+
<!-- SECTION:examples:START -->
168+
150169
## :bulb: Examples
151170
152171
* Backup the home folder to backup_drive:
@@ -163,10 +182,18 @@ and use it like `./rsync_time_machine.py --help`
163182
164183
For more examples and detailed usage instructions, please refer to the original [`rsync-time-backup`](https://github.com/laurent22/rsync-time-backup) README.
165184
185+
<!-- SECTION:examples:END -->
186+
187+
<!-- SECTION:expiration:START -->
188+
166189
## :calendar: Backup Expiration Logic
167190
168191
Backup sets are automatically deleted following a simple expiration strategy defined with the `--strategy` flag. The default strategy is `1:1 30:7 365:30`. Please see the original README for a detailed explanation.
169192
193+
<!-- SECTION:expiration:END -->
194+
195+
<!-- SECTION:exclusion:START -->
196+
170197
## :page_facing_up: Exclusion File
171198
172199
An optional exclude file can be provided as a third parameter, compatible with the `--exclude-from` parameter of rsync.
@@ -210,18 +237,34 @@ See [this tutorial](https://web.archive.org/web/20230126121643/https://sites.goo
210237
211238
</details>
212239
240+
<!-- SECTION:exclusion:END -->
241+
242+
<!-- SECTION:lock:START -->
243+
213244
## :lock: Built-in Lock
214245
215246
The script is designed so that only one backup operation can be active for a given directory, avoiding conflicts.
216247
248+
<!-- SECTION:lock:END -->
249+
250+
<!-- SECTION:rsync-options:START -->
251+
217252
## :gear: Rsync Options
218253
219254
To display, add, or remove rsync options, use the `--rsync-get-flags`, `--rsync-append-flags`, or `--rsync-set-flags` options.
220255
256+
<!-- SECTION:rsync-options:END -->
257+
258+
<!-- SECTION:no-auto-expire:START -->
259+
221260
## :no_entry_sign: No Automatic Backup Expiration
222261
223262
Use the `--no-auto-expire` flag to disable the default behavior of purging old backups when out of space.
224263
264+
<!-- SECTION:no-auto-expire:END -->
265+
266+
<!-- SECTION:restore:START -->
267+
225268
## :arrows_counterclockwise: How to Restore
226269
227270
Restoring files from the backup is simple, as the script creates a backup in a regular directory. You can easily copy the files back to the original directory using a command like:
@@ -234,14 +277,63 @@ Consider using the `--dry-run` option to check what exactly is going to be copie
234277
235278
You can also restore files using any file explorer, including Finder on macOS or the command line.
236279
280+
<!-- SECTION:restore:END -->
281+
282+
<!-- SECTION:featured:START -->
283+
237284
## :star: Featured on
238285
239286
- the Real Python podcast: [Episode 158: Building Python CI With Docker & Applying for a Hacker Initiative Grant @ 00:26:28](https://realpython.com/podcasts/rpp/158/#t=1588)
240287
- Y Combinator Hacker News: [Python Port of 600 Line Bash Script: rsync-time-machine.py for Rsync Backups](https://news.ycombinator.com/item?id=35933238) (self-posted)
241288
- Reddit /rpython: [Ported a popular (untested) 600+ Line Bash Script 📜 to Python 🐍: Introducing rsync-time-machine.py for Time Machine-Style Backups Using Rsync 🔄⏰](https://www.reddit.com/r/Python/comments/13gtmz2/ported_a_popular_untested_600_line_bash_script_to/) (self-posted)
242289
290+
<!-- SECTION:featured:END -->
291+
292+
<!-- SECTION:support:START -->
293+
243294
## :heart: Support and Contributions
244295
245296
We appreciate your feedback and contributions! If you encounter any issues or have suggestions for improvements, please file an issue on the GitHub repository. We also welcome pull requests for bug fixes or new features.
246297
298+
<!-- SECTION:support:END -->
299+
300+
<!-- SECTION:contributing:START -->
301+
302+
## How to Contribute
303+
304+
1. **Report Issues**: Found a bug or have a feature request? [Open an issue](https://github.com/basnijholt/rsync-time-machine.py/issues)
305+
2. **Submit Pull Requests**: Bug fixes and new features are welcome
306+
3. **Improve Documentation**: Help us make the docs better
307+
308+
## Development Setup
309+
310+
```bash
311+
# Clone the repository
312+
git clone https://github.com/basnijholt/rsync-time-machine.py.git
313+
cd rsync-time-machine.py
314+
315+
# Install development dependencies with uv
316+
uv sync --group dev
317+
318+
# Run tests
319+
uv run pytest
320+
321+
# Run linting
322+
uv run ruff check .
323+
```
324+
325+
## Code Style
326+
327+
This project uses:
328+
329+
- **Ruff** for linting and formatting
330+
- **pytest** for testing
331+
- Type hints throughout the codebase
332+
333+
## Questions?
334+
335+
Join the [GitHub Discussions](https://github.com/basnijholt/rsync-time-machine.py/discussions) for help and community support.
336+
337+
<!-- SECTION:contributing:END -->
338+
247339
Happy backing up! 💾🕰️🎉

docs/CNAME

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rsync-time-machine.nijho.lt

docs/backup-strategy.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
icon: lucide/calendar
3+
---
4+
5+
# Backup Strategy
6+
7+
rsync-time-machine uses an intelligent backup expiration strategy to manage disk space while keeping important historical snapshots.
8+
9+
## Backup Expiration Logic
10+
11+
<!-- CODE:START -->
12+
<!-- from generate import readme_section -->
13+
<!-- print(readme_section("expiration")) -->
14+
<!-- CODE:END -->
15+
<!-- OUTPUT:START -->
16+
<!-- ⚠️ This content is auto-generated by `markdown-code-runner`. -->
17+
Backup sets are automatically deleted following a simple expiration strategy defined with the `--strategy` flag. The default strategy is `1:1 30:7 365:30`. Please see the original README for a detailed explanation.
18+
19+
<!-- OUTPUT:END -->
20+
21+
## No Automatic Backup Expiration
22+
23+
<!-- CODE:START -->
24+
<!-- from generate import readme_section -->
25+
<!-- print(readme_section("no-auto-expire")) -->
26+
<!-- CODE:END -->
27+
<!-- OUTPUT:START -->
28+
<!-- ⚠️ This content is auto-generated by `markdown-code-runner`. -->
29+
Use the `--no-auto-expire` flag to disable the default behavior of purging old backups when out of space.
30+
31+
<!-- OUTPUT:END -->

docs/contributing.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
icon: lucide/heart-handshake
3+
---
4+
5+
# Contributing
6+
7+
<!-- CODE:START -->
8+
<!-- from generate import readme_section -->
9+
<!-- print(readme_section("support")) -->
10+
<!-- CODE:END -->
11+
<!-- OUTPUT:START -->
12+
<!-- ⚠️ This content is auto-generated by `markdown-code-runner`. -->
13+
We appreciate your feedback and contributions! If you encounter any issues or have suggestions for improvements, please file an issue on the GitHub repository. We also welcome pull requests for bug fixes or new features.
14+
15+
<!-- OUTPUT:END -->
16+
17+
<!-- CODE:START -->
18+
<!-- from generate import readme_section -->
19+
<!-- print(readme_section("contributing")) -->
20+
<!-- CODE:END -->
21+
<!-- OUTPUT:START -->
22+
<!-- ⚠️ This content is auto-generated by `markdown-code-runner`. -->
23+
1. **Report Issues**: Found a bug or have a feature request? [Open an issue](https://github.com/basnijholt/rsync-time-machine.py/issues)
24+
2. **Submit Pull Requests**: Bug fixes and new features are welcome
25+
3. **Improve Documentation**: Help us make the docs better
26+
27+
## Development Setup
28+
29+
```bash
30+
# Clone the repository
31+
git clone https://github.com/basnijholt/rsync-time-machine.py.git
32+
cd rsync-time-machine.py
33+
34+
# Install development dependencies with uv
35+
uv sync --group dev
36+
37+
# Run tests
38+
uv run pytest
39+
40+
# Run linting
41+
uv run ruff check .
42+
```
43+
44+
## Code Style
45+
46+
This project uses:
47+
48+
- **Ruff** for linting and formatting
49+
- **pytest** for testing
50+
- Type hints throughout the codebase
51+
52+
## Questions?
53+
54+
Join the [GitHub Discussions](https://github.com/basnijholt/rsync-time-machine.py/discussions) for help and community support.
55+
56+
<!-- OUTPUT:END -->

0 commit comments

Comments
 (0)