Skip to content

Commit e674e43

Browse files
Add nix flake and convert to modern pyproject
1 parent 1b9a5e7 commit e674e43

10 files changed

Lines changed: 604 additions & 130 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.egg-info

MANIFEST.in

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,24 @@ Xfer is a utility to allow out-of-band sending of arbitrary data, using animated
55
## Installation
66

77
1. Clone the repository
8-
2. Run `pip install -r requirements.txt` (may be `pip3`, in place of `pip`, depending on your OS).
8+
2. Install with `pip install .`
9+
3. Run the CLI with `xfer --help`
910

1011
## Workflow
12+
1113
The workflow looks something like this:
1214

13-
1. Alice runs Xfer on their local machine, as such: `cat 'This is a message to send' | python3 xfer.py write --outfile send.gif`
14-
2. Alice opens `send.gif` and records the output on a mobile device.
15+
1. Alice runs Xfer on their local machine, as such: `echo 'This is a message to send' | xfer write --outfile send.gif`
16+
2. Alice opens `send.gif` and records the output on a mobile device.
1517
3. Alice send a message, via a third party service, such as Signal, to Bob.
16-
4. Bob runs `python3 xfer.py read` on his laptop.
18+
4. Bob runs `xfer read` on his laptop.
1719
5. Bob plays the recording of the animated gif, and captures the video on their laptop's webcam.
1820
6. Once Xfer has captured all the individual frames, it will output the original message on Bob's screen.
19-
21+
2022
## How it works
2123

2224
1. `xfer write` breaks the source message down into chunks. By default these are 256 byte chunks. This is not supported as a flag, because the relationship between chunk size and QR code dimensions are not clear. The values can be seen at the top of the `xfer` script, but should not be changed unless you know what you are doing!
23-
2. Each chunk is then encoded to a static QR code, with it's frame number for reassembly.
25+
2. Each chunk is then encoded to a static QR code, with it's frame number for reassembly.
2426
3. A keyframe is added to the start of the sequence, to instruct the receiving application on the number of frames it should expect.
2527
4. The collection of static images is then compiled into an animated GIF.
2628

@@ -31,7 +33,7 @@ The workflow looks something like this:
3133
## Limitations
3234

3335
- Xfer was not written to be secure. It can be used as part of a secure workflow, if PGP keys are shared beforehand and the data transmitted is encrypted.
34-
- Xfer does not compress data; repeated data will be encoded as is.
36+
- Xfer does not compress data; repeated data will be encoded as is.
3537

3638
## Future work
3739

flake.lock

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
description = "xfer - Utility to allow out-of-band sending of arbitrary data";
3+
4+
inputs = {
5+
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
};
8+
9+
outputs =
10+
{
11+
self,
12+
nixpkgs,
13+
flake-utils,
14+
}:
15+
flake-utils.lib.eachDefaultSystem (
16+
system:
17+
let
18+
pkgs = import nixpkgs { inherit system; };
19+
python = pkgs.python313;
20+
pythonEnv = python.withPackages (ps: [
21+
ps.click
22+
ps.imageio
23+
ps.numpy
24+
ps."opencv-python"
25+
ps.pillow
26+
ps.pyzbar
27+
ps.qrcode
28+
]);
29+
xfer-package = python.pkgs.buildPythonApplication {
30+
pname = "xfer";
31+
version = "0.0.5";
32+
format = "pyproject";
33+
src = self;
34+
35+
nativeBuildInputs = with python.pkgs; [
36+
setuptools
37+
wheel
38+
];
39+
propagatedBuildInputs = [
40+
python.pkgs.click
41+
python.pkgs.imageio
42+
python.pkgs.numpy
43+
python.pkgs."opencv-python"
44+
python.pkgs.pillow
45+
python.pkgs.pyzbar
46+
python.pkgs.qrcode
47+
];
48+
49+
pythonImportsCheck = [ "xfer" ];
50+
};
51+
52+
in
53+
{
54+
packages.default = xfer-package;
55+
apps.default = flake-utils.lib.mkApp { drv = xfer-package; };
56+
57+
devShells.default = pkgs.mkShell {
58+
packages = [
59+
pythonEnv
60+
xfer-package
61+
];
62+
};
63+
}
64+
);
65+
}

pyproject.toml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
[build-system]
2+
requires = ["setuptools>=69", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "xfer"
7+
version = "0.0.5"
8+
description = "Utility to allow out-of-band sending of arbitrary data"
9+
readme = "README.md"
10+
requires-python = ">=3.10"
11+
license = { file = "LICENSE.md" }
12+
authors = [{ name = "Chorus One", email = "tech@chorus.one" }]
13+
classifiers = [
14+
"Operating System :: OS Independent",
15+
"Programming Language :: Python",
16+
"Programming Language :: Python :: 3",
17+
"Natural Language :: English",
18+
"Intended Audience :: Developers",
19+
"Intended Audience :: Financial and Insurance Industry",
20+
]
21+
dependencies = [
22+
"click>=8.0",
23+
"imageio>=2.9",
24+
"numpy>=1.26",
25+
"opencv-python>=4.10",
26+
"pillow>=10.0",
27+
"pyzbar>=0.1.9",
28+
"qrcode>=7.4",
29+
]
30+
31+
[project.urls]
32+
Homepage = "https://chorus.one"
33+
34+
[project.scripts]
35+
xfer = "xfer:main"
36+
37+
[dependency-groups]
38+
dev = []
39+
40+
[tool.setuptools]
41+
py-modules = ["xfer"]

requirements.txt

Lines changed: 0 additions & 10 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)