# mergething
App over syncthing that takes care merging things
Install using `pip install mergething`
## ipython/jupyter
Currently supports merging ipython/jupyter history files.
mergething will give each ipython/jupyter session it's own history file, so in contrast to vanilla ipython, you can run multiple ipython sessions at the same time without worrying about corruption. You can even use mergething on a single machine in order to get this benefit.
When a session is closed, its history file is marked "completed", and once it is incorporated into a new session, it will be deleted (only ever by the same device).
# IPython/jupyter History Sync
## 1. Configure Syncthing
Set up Syncthing to sync a directory across your machines (e.g., `~/syncthing/ipython_history`).
## 2a. Configure IPython using CLI tool
The following line will copy your exisiting history file to the directory and add lines to you `ipython_config.py` file to use mergething:
`mergething init ~/syncthing/ipython_history`
## 2b. Configure IPython manually
Alternatively, you can add these lines to the end of your IPython configuration file manually (`~/.ipython/profile_default/ipython_config.py`):
```python
try:
from mergething.ipython import sync_and_get_hist_file
c.HistoryManager.hist_file = sync_and_get_hist_file("~/syncthing/ipython_history", verbose=False)
except Exception:
print("mergething: Error syncing and getting history file, using default ipython behavior")
```
You can also pass the hostname you want files to use, this is useful when multiple devices have the same hostname:
```python
c.HistoryManager.hist_file = sync_and_get_hist_file("~/syncthing/ipython_history", verbose=False, hostname="mydevice")
```
For Android/Termux users where the hostname is always "localhost", you can specify a custom hostname:
```python
try:
from mergething.ipython import sync_and_get_hist_file
c.HistoryManager.hist_file = sync_and_get_hist_file("~/syncthing/ipython_history", verbose=False, hostname="my_phone")
except Exception:
print("mergething: Error syncing and getting history file, using default ipython behavior")
```
## Merging existing files
You can use the CLI tool to merge existing files:
`mergething merge history1.sqlite history2.sqlite ... historyn.sqlite merged_history.sqlite`
Raw data
{
"_id": null,
"home_page": null,
"name": "mergething",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "history, ipython, jupyter, merge, sync, syncthing",
"author": null,
"author_email": "Dror Speiser <drorspei@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/00/89/434d9042d1301cdf5523113af6d0f531738f4a8eaaf61019bf3ce079bd07/mergething-0.1.0.tar.gz",
"platform": null,
"description": "# mergething\n\nApp over syncthing that takes care merging things\n\nInstall using `pip install mergething`\n\n## ipython/jupyter\n\nCurrently supports merging ipython/jupyter history files.\n\nmergething will give each ipython/jupyter session it's own history file, so in contrast to vanilla ipython, you can run multiple ipython sessions at the same time without worrying about corruption. You can even use mergething on a single machine in order to get this benefit.\n\nWhen a session is closed, its history file is marked \"completed\", and once it is incorporated into a new session, it will be deleted (only ever by the same device).\n\n# IPython/jupyter History Sync\n\n## 1. Configure Syncthing\n\nSet up Syncthing to sync a directory across your machines (e.g., `~/syncthing/ipython_history`).\n\n## 2a. Configure IPython using CLI tool\n\nThe following line will copy your exisiting history file to the directory and add lines to you `ipython_config.py` file to use mergething:\n\n`mergething init ~/syncthing/ipython_history`\n\n## 2b. Configure IPython manually\n\nAlternatively, you can add these lines to the end of your IPython configuration file manually (`~/.ipython/profile_default/ipython_config.py`):\n\n```python\ntry:\n from mergething.ipython import sync_and_get_hist_file\n c.HistoryManager.hist_file = sync_and_get_hist_file(\"~/syncthing/ipython_history\", verbose=False)\nexcept Exception:\n print(\"mergething: Error syncing and getting history file, using default ipython behavior\")\n```\n\nYou can also pass the hostname you want files to use, this is useful when multiple devices have the same hostname:\n\n```python\n c.HistoryManager.hist_file = sync_and_get_hist_file(\"~/syncthing/ipython_history\", verbose=False, hostname=\"mydevice\")\n```\n\nFor Android/Termux users where the hostname is always \"localhost\", you can specify a custom hostname:\n\n```python\ntry:\n from mergething.ipython import sync_and_get_hist_file\n c.HistoryManager.hist_file = sync_and_get_hist_file(\"~/syncthing/ipython_history\", verbose=False, hostname=\"my_phone\")\nexcept Exception:\n print(\"mergething: Error syncing and getting history file, using default ipython behavior\")\n```\n\n## Merging existing files\n\nYou can use the CLI tool to merge existing files:\n\n`mergething merge history1.sqlite history2.sqlite ... historyn.sqlite merged_history.sqlite`\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "App over syncthing that takes care merging things",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/drorspei/mergething",
"Repository": "https://github.com/drorspei/mergething"
},
"split_keywords": [
"history",
" ipython",
" jupyter",
" merge",
" sync",
" syncthing"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "eeab507c6318368d498e623829bda8cd1a358b29251bca9d094dbe94b5fd067f",
"md5": "3471a55aa6f7a4026cf62da47b43a48c",
"sha256": "3d4e0faa391f25ae53114b7a4fccd2f4353d18ebe0b2962b0e29c76be4a3293d"
},
"downloads": -1,
"filename": "mergething-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3471a55aa6f7a4026cf62da47b43a48c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 9160,
"upload_time": "2025-08-23T13:41:14",
"upload_time_iso_8601": "2025-08-23T13:41:14.436099Z",
"url": "https://files.pythonhosted.org/packages/ee/ab/507c6318368d498e623829bda8cd1a358b29251bca9d094dbe94b5fd067f/mergething-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "0089434d9042d1301cdf5523113af6d0f531738f4a8eaaf61019bf3ce079bd07",
"md5": "6b86ace046ac2915d7d0ea9dc644cc27",
"sha256": "b487af165de5396c16b19ada0f4b8ed7843e170aed7db89a232fed07ed0b002e"
},
"downloads": -1,
"filename": "mergething-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "6b86ace046ac2915d7d0ea9dc644cc27",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 7796,
"upload_time": "2025-08-23T13:41:15",
"upload_time_iso_8601": "2025-08-23T13:41:15.618884Z",
"url": "https://files.pythonhosted.org/packages/00/89/434d9042d1301cdf5523113af6d0f531738f4a8eaaf61019bf3ce079bd07/mergething-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-23 13:41:15",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "drorspei",
"github_project": "mergething",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "mergething"
}