Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Mypy

on:
pull_request:
branches:
- '*'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install uv
uses: astral-sh/setup-uv@v6

- name: Install dependencies
run: uv sync --dev

- name: Analysing the code with mypy
run: uv run mypy
30 changes: 30 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Pytest

on:
pull_request:
branches:
- '*'
workflow_dispatch:

jobs:
testing:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install uv
uses: astral-sh/setup-uv@v6

- name: Install the project
run: |
uv sync --dev

- name: Run unittests with pytest
run: |
uv run pytest
30 changes: 30 additions & 0 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Ruff

on:
pull_request:
branches:
- '*'
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install uv
uses: astral-sh/setup-uv@v6

- name: Install the project
run: |
uv sync --dev

- name: Analysing the code with ruff
run: |
uv run ruff check
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**/__pycache__
**/.idea
**/*.c
**/*.pyd
**/build
**/dist
**/*.egg-info
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.9
Empty file added LICENSE
Empty file.
4 changes: 4 additions & 0 deletions Manifest.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
prune tests
include LICENSE
include README.md
recursive-include py.typed
72 changes: 71 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,47 @@ A Python implementation of the BitChat decentralized, peer-to-peer, encrypted ch
* [Setup environment](#clone-and-setup-editable-environment-using-uv)
* [Build](#build-sdist-and-wheel)

## Installation
With pip
```shell
pip install git+https://github.com/kaganisildak/bitchat-python
```

With [`uv` package and project manager](https://docs.astral.sh/uv/)
```Shell
uv tool install git+https://github.com/kaganisildak/bitchat-python.git
```

With [`pipx` standalone python apps panager](https://github.com/pypa/pipx)
```Shell
pipx install git+https://github.com/kaganisildak/bitchat-python.git
```


## Usage

### Simple start
Installed with `pip`, `uv tool`, `pipx`
```Shell
python3 bitchat.py
bitchat-python
```

With `uvx` command
> [!NOTE]
> This will only work once the project is published to the PyPI index.
```Shell
uvx bitchat-python
```

### CLI startup options
```shell
-h, --help show this help message and exit
-d, --debug enable BASIC debug (connection info)
-v, --verbose enable FULL debug (verbose output)
-u, --usage show usage info
-V, --version show program`s version number and exit
--log [LOG] log file path. If no path is provided, logs to 'bitchat.log'. If --log is omitted, no logging occurs.
```

### BitChat Commands

Expand Down Expand Up @@ -81,3 +112,42 @@ Privacy & Security Commands
* `/unblock @user` : Unblock a user
```


## Clone, Develop and Build
> [!TIP]
> [`uv` package and project manager](https://docs.astral.sh/uv/) usage recommended for this step

### Clone and setup editable environment using `uv`
```Shell
git clone https://github.com/kaganisildak/bitchat-python.git
cd bitchat-python
uv sync --dev
.venv/bin/activate
```

### Type checking with
```Shell
uv run mypy
```

### Linting and Formatting
Lint
```Shell
uv run ruff check
```

Format
```Shell
uv run ruff format
```

### Build sdist and wheel
```Shell
uv build
```




[//]: # (Old README.md content)
[//]: # (pip install bleak>=0.22.3 cryptography>=44.0.0 lz4>=4.3.3 aioconsole>=0.8.1 pybloom-live>=4.0.0)
1 change: 1 addition & 0 deletions VERSION.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.dev18+g35a4355.d20250727
26 changes: 0 additions & 26 deletions compression.py

This file was deleted.

87 changes: 87 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
[build-system]
requires = ["setuptools>=80.1.0", "setuptools-scm[toml]>=8"]
build-backend = "setuptools.build_meta"

[project]
name = "bitchat-python"
authors = [
{ name = "Kağan IŞILDAK" }
]
description = "A Python implementation of the BitChat decentralized, peer-to-peer, encrypted chat application over BLE."
readme = "README.md"
requires-python = ">=3.9"
keywords = ["bitchat", "BLE", "BLE-mesh", "IRC-vibes", "chat-application", "p2p-chat"]
license = { file = "LICENSE" }
classifiers = [
"Intended Audience :: Developers",
"Natural Language :: English",
"Programming Language :: Python",
"Topic :: Software Development :: Libraries :: Python Modules",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
]
dependencies = [
"aioconsole>=0.8.1",
"bleak>=0.22.3",
"cryptography>=44.0.0",
"pybloom-live>=4.0.0",

# "lz4>=4.3.3", # uses build-in zlib by default for minimal environments support, where only pure python and built-in modules are supported, a.g. micropython and pythonista
# "typing_extensions>=4.12.2; python_version<'3.11'"", # uncomment to make annotations backward compatibility
]
dynamic = ["version"]

[project.optional-dependencies]
full = [
"lz4>=4.3.3",
]

[project.urls]
"Homepage" = "https://github.com/kaganisildak/bitchat-python"
"Bug Reports" = "https://github.com/kaganisildak/bitchat-python/issues"
"Source" = "https://github.com/kaganisildak/bitchat-python"

[tool.setuptools.packages.find]
where = ["src"]
include = ["bitchat_python*"]

[tool.setuptools_scm]
version_file = "VERSION.txt"

#[tool.setuptools.dynamic]
#version = { file = "VERSION" }

# default entry point
[project.scripts]
bitchat-python = "bitchat_python.__main__:main"


# uncomment to configure pytest
[tool.pytest]
testpaths = ["tests"]

[tool.mypy]
packages = ["bitchat_python"]

# uncomment to configure ruff linter/formatter
[tool.ruff]
include = [
"pyproject.toml",
"src/**/*.py"
]
extend-exclude = ["__init__.py"]

# uncomment/add deps to allow setup dev dependencies
[dependency-groups]
dev = [
"mypy>=1.15.0",
"pytest>=8.4.1",
"ruff>=0.12.1",
# "pytest-cov>=6.2.1",
]
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# fallback to `setup.py`
from setuptools import setup, find_packages

setup()
Empty file added src/bitchat_python/__init__.py
Empty file.
14 changes: 14 additions & 0 deletions src/bitchat_python/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import asyncio

from bitchat_python import bitchat


def main() -> None:
try:
asyncio.run(bitchat.main())
except KeyboardInterrupt:
print("\n[+] Exiting...")


if __name__ == "__main__":
main()
1 change: 1 addition & 0 deletions src/bitchat_python/_compat/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .ainput import ainput
Loading