beam-lan 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- beam_lan-0.1.0/.gitignore +10 -0
- beam_lan-0.1.0/CHANGELOG.md +19 -0
- beam_lan-0.1.0/LICENSE +21 -0
- beam_lan-0.1.0/PKG-INFO +252 -0
- beam_lan-0.1.0/README.md +196 -0
- beam_lan-0.1.0/pyproject.toml +59 -0
- beam_lan-0.1.0/src/beam/__init__.py +31 -0
- beam_lan-0.1.0/src/beam/_cloud.py +187 -0
- beam_lan-0.1.0/src/beam/_crypto.py +93 -0
- beam_lan-0.1.0/src/beam/_files.py +125 -0
- beam_lan-0.1.0/src/beam/_protocol.py +161 -0
- beam_lan-0.1.0/src/beam/_starter.py +276 -0
- beam_lan-0.1.0/src/beam/packer.py +105 -0
- beam_lan-0.1.0/src/beam/py.typed +0 -0
- beam_lan-0.1.0/src/beam/transfer.py +396 -0
- beam_lan-0.1.0/tests/test_online.py +129 -0
- beam_lan-0.1.0/tests/test_roundtrip.py +310 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
First release.
|
|
6
|
+
|
|
7
|
+
- `beam.send(folder)` zips a project, encrypts it (AES-256-GCM) and uploads it
|
|
8
|
+
to a free temporary file host. It returns a code that works from anywhere
|
|
9
|
+
for 3 days with `beam.receive(code)`. The key is part of the code and never
|
|
10
|
+
reaches the host.
|
|
11
|
+
- `beam.send(folder, lan=True)` sends directly to a laptop on the same network
|
|
12
|
+
instead. The receiver finds the sender by the code alone.
|
|
13
|
+
- `beam.pack(folder)` only makes the zip.
|
|
14
|
+
- `exclude=[".mp4", ".log"]` leaves file types out. `.venv`, `.git`,
|
|
15
|
+
`__pycache__`, `node_modules`, `.env` and similar are skipped by default.
|
|
16
|
+
- The zip includes a `start.bat` that creates a virtual environment, installs
|
|
17
|
+
requirements (read from the project's imports when it has no
|
|
18
|
+
`requirements.txt`) and runs the project. It handles plain Python,
|
|
19
|
+
Streamlit, Django, Node and static-HTML projects.
|
beam_lan-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nylonxd
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
beam_lan-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: beam-lan
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Zip a project and send it to anyone, anywhere, with a start.bat that sets it up and runs it.
|
|
5
|
+
Project-URL: Homepage, https://github.com/NYLONXD/beam
|
|
6
|
+
Project-URL: Source, https://github.com/NYLONXD/beam
|
|
7
|
+
Project-URL: Issues, https://github.com/NYLONXD/beam/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/NYLONXD/beam/blob/main/CHANGELOG.md
|
|
9
|
+
Author-email: Nylonxd <Himanshujha202005@gmail.com>
|
|
10
|
+
License: MIT License
|
|
11
|
+
|
|
12
|
+
Copyright (c) 2026 Nylonxd
|
|
13
|
+
|
|
14
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
16
|
+
in the Software without restriction, including without limitation the rights
|
|
17
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
18
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
19
|
+
furnished to do so, subject to the following conditions:
|
|
20
|
+
|
|
21
|
+
The above copyright notice and this permission notice shall be included in all
|
|
22
|
+
copies or substantial portions of the Software.
|
|
23
|
+
|
|
24
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
26
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
27
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
28
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
29
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
30
|
+
SOFTWARE.
|
|
31
|
+
License-File: LICENSE
|
|
32
|
+
Keywords: encrypted,file-transfer,lan,project,share,start.bat,zip
|
|
33
|
+
Classifier: Development Status :: 3 - Alpha
|
|
34
|
+
Classifier: Intended Audience :: Developers
|
|
35
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
36
|
+
Classifier: Operating System :: OS Independent
|
|
37
|
+
Classifier: Programming Language :: Python :: 3
|
|
38
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
41
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
42
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
43
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
44
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
45
|
+
Classifier: Topic :: Communications :: File Sharing
|
|
46
|
+
Classifier: Topic :: System :: Archiving
|
|
47
|
+
Classifier: Typing :: Typed
|
|
48
|
+
Requires-Python: >=3.9
|
|
49
|
+
Requires-Dist: cryptography>=42
|
|
50
|
+
Provides-Extra: dev
|
|
51
|
+
Requires-Dist: build; extra == 'dev'
|
|
52
|
+
Requires-Dist: pytest>=7; extra == 'dev'
|
|
53
|
+
Requires-Dist: ruff>=0.4; extra == 'dev'
|
|
54
|
+
Requires-Dist: twine; extra == 'dev'
|
|
55
|
+
Description-Content-Type: text/markdown
|
|
56
|
+
|
|
57
|
+
# beam
|
|
58
|
+
|
|
59
|
+
Zip a project and send it to anyone, anywhere, from Python. The zip includes
|
|
60
|
+
a `start.bat`: the other person double-clicks it and the project is set up
|
|
61
|
+
and running, with no manual installs.
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
import beam
|
|
65
|
+
|
|
66
|
+
beam.send("D:/projects/my_app", exclude=[".mp4", ".log"])
|
|
67
|
+
# code : tqWFGE-RX2oLb5xjRDX8d0M
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
The other person, on any network, any time in the next 3 days:
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
import beam
|
|
74
|
+
|
|
75
|
+
beam.receive("tqWFGE-RX2oLb5xjRDX8d0M")
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Python 3.9+. Works on Windows, macOS and Linux (`start.bat` is for Windows).
|
|
79
|
+
|
|
80
|
+
## Install
|
|
81
|
+
|
|
82
|
+
On both laptops:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pip install beam-lan
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Send a project
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
import beam
|
|
92
|
+
|
|
93
|
+
code = beam.send(
|
|
94
|
+
"D:/projects/my_app", # the project folder
|
|
95
|
+
exclude=[".mp4", ".log"], # file types to leave out (optional)
|
|
96
|
+
main="app.py", # what start.bat runs (optional, auto-detected)
|
|
97
|
+
)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
It zips the folder, encrypts it, uploads it, and prints a code. Send the code
|
|
101
|
+
to the other person however you like: WhatsApp, email, chat. You can close
|
|
102
|
+
your laptop straight after; the other person can download it any time within
|
|
103
|
+
3 days.
|
|
104
|
+
|
|
105
|
+
To send a file you already have, such as a zip or a PDF, pass its path instead
|
|
106
|
+
of a folder. It is sent as it is.
|
|
107
|
+
|
|
108
|
+
## Receive it
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
import beam
|
|
112
|
+
|
|
113
|
+
beam.receive("tqWFGE-RX2oLb5xjRDX8d0M") # saves my_app.zip here
|
|
114
|
+
beam.receive("tqWFGE-RX2oLb5xjRDX8d0M", out="D:/Downloads") # or somewhere else
|
|
115
|
+
beam.receive("tqWFGE-RX2oLb5xjRDX8d0M", extract=True) # also unzip it
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
An existing `my_app.zip` is never overwritten: the new one becomes
|
|
119
|
+
`my_app (1).zip` unless you pass `overwrite=True`.
|
|
120
|
+
|
|
121
|
+
## Same Wi-Fi, direct
|
|
122
|
+
|
|
123
|
+
For big folders on the same network, skip the internet:
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
beam.send("D:/projects/my_app", lan=True) # prints a short code, e.g. ab3f9c
|
|
127
|
+
beam.receive("ab3f9c") # on the other laptop, same Wi-Fi
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
This mode has no size limit and uploads nothing, and the receiver finds the
|
|
131
|
+
sender by itself. Both laptops must be on at the same time, and `send` waits
|
|
132
|
+
until the other laptop has the file.
|
|
133
|
+
|
|
134
|
+
## Only make the zip
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
beam.pack("D:/projects/my_app") # -> D:/projects/my_app.zip
|
|
138
|
+
beam.pack("D:/projects/my_app", output="D:/share/app.zip", exclude=[".csv"])
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## What goes in the zip
|
|
142
|
+
|
|
143
|
+
- **Your files**, minus things that should not travel: `.venv`, `venv`,
|
|
144
|
+
`__pycache__`, `.git`, `node_modules`, `.env` (secrets) and similar caches.
|
|
145
|
+
Virtual environments do not work when copied to another computer; `start.bat`
|
|
146
|
+
builds a fresh one instead.
|
|
147
|
+
- **Your `exclude` list.** `".mp4"`, `"mp4"` and `"*.mp4"` all skip mp4 files.
|
|
148
|
+
A plain name such as `"data"` skips a file or folder with that name. A
|
|
149
|
+
`.beamignore` file in the project adds more patterns, one per line.
|
|
150
|
+
- **`start.bat`**, which does the setup and starts the project.
|
|
151
|
+
- **`requirements.txt`**. Your own is used if the project has one. Otherwise
|
|
152
|
+
beam reads the project's `import` lines and writes one (for example
|
|
153
|
+
`import cv2` becomes `opencv-python`). Pass `requirements=["flask", "numpy"]`
|
|
154
|
+
to set the list yourself.
|
|
155
|
+
|
|
156
|
+
## What start.bat does
|
|
157
|
+
|
|
158
|
+
| Project | start.bat |
|
|
159
|
+
| --- | --- |
|
|
160
|
+
| Python (`main.py`, `app.py`, `run.py`, ... or `main=`) | creates `.venv`, installs `requirements.txt`, runs the script |
|
|
161
|
+
| Streamlit app | same setup, then `streamlit run app.py` |
|
|
162
|
+
| Django (`manage.py`) | same setup, then `manage.py runserver` |
|
|
163
|
+
| Node (`package.json`) | `npm install`, then `npm start` |
|
|
164
|
+
| Website (`index.html`) | opens it in the browser |
|
|
165
|
+
|
|
166
|
+
The setup runs once. After that, `start.bat` goes straight to starting the
|
|
167
|
+
project. If Python or Node.js is missing, it says where to download it. To
|
|
168
|
+
start over, delete the `.venv` folder.
|
|
169
|
+
|
|
170
|
+
Turn it off with `start_script=False`.
|
|
171
|
+
|
|
172
|
+
## How the internet transfer works
|
|
173
|
+
|
|
174
|
+
1. The zip is encrypted on your laptop with AES-256-GCM, using a random key.
|
|
175
|
+
2. The encrypted file is uploaded to a free temporary file host:
|
|
176
|
+
[temp.sh](https://temp.sh) (up to 4 GB, kept 3 days), or
|
|
177
|
+
[uguu.se](https://uguu.se) (up to 128 MB, kept 3 hours) if temp.sh is down.
|
|
178
|
+
3. The code is `<where it is>-<the key>`. The key never goes to the host, so
|
|
179
|
+
the host only ever stores unreadable data.
|
|
180
|
+
4. `receive` downloads it, checks it has not been changed, and decrypts it.
|
|
181
|
+
|
|
182
|
+
Anyone who has the whole code can download the file, so send it only to the
|
|
183
|
+
person it is for.
|
|
184
|
+
|
|
185
|
+
## All options
|
|
186
|
+
|
|
187
|
+
`beam.send(path, ...)` and `beam.pack(path, ...)`
|
|
188
|
+
|
|
189
|
+
| Option | Default | Effect |
|
|
190
|
+
| --- | --- | --- |
|
|
191
|
+
| `exclude` | none | file types or names to leave out |
|
|
192
|
+
| `main` | auto | script that `start.bat` runs |
|
|
193
|
+
| `start_script` | `True` | add `start.bat` (and `requirements.txt` if needed) |
|
|
194
|
+
| `requirements` | auto | pip packages `start.bat` installs |
|
|
195
|
+
| `use_default_excludes` | `True` | skip `.venv`, `.git`, `__pycache__`, ... |
|
|
196
|
+
| `max_size_mb` | none | skip files bigger than this |
|
|
197
|
+
| `quiet` | `False` | print nothing |
|
|
198
|
+
|
|
199
|
+
`beam.pack` only: `output` sets where the zip goes (default `<folder>.zip`
|
|
200
|
+
next to the folder).
|
|
201
|
+
|
|
202
|
+
`beam.send` only: `lan=True` sends directly over the same Wi-Fi. With
|
|
203
|
+
`lan=True`, `code` picks your own code, `timeout` sets how many seconds to
|
|
204
|
+
wait for the other laptop, and `port` sets the network port (default 8765,
|
|
205
|
+
another free port is used if it is taken).
|
|
206
|
+
|
|
207
|
+
`beam.receive(code, ...)`: `out` sets the folder to save into, `extract` also
|
|
208
|
+
unzips it, and `overwrite` replaces existing files. For LAN codes, `host="IP"`
|
|
209
|
+
or `host="IP:port"` skips the search and `wait` sets how many seconds to
|
|
210
|
+
search (default 15).
|
|
211
|
+
|
|
212
|
+
Errors raise `beam.BeamError`.
|
|
213
|
+
|
|
214
|
+
## Troubleshooting
|
|
215
|
+
|
|
216
|
+
**`nothing found for this code ... expired`**: the file is older than 3 days
|
|
217
|
+
(3 hours if it went to uguu.se), or the code was not copied completely.
|
|
218
|
+
Send it again.
|
|
219
|
+
|
|
220
|
+
**`could not decrypt: wrong code`**: part of the code is missing or mistyped.
|
|
221
|
+
|
|
222
|
+
**`upload failed on every host`**: check the internet connection. If the hosts
|
|
223
|
+
are down, use `beam.pack` and share the zip another way.
|
|
224
|
+
|
|
225
|
+
**LAN mode: `no sender with code ... found`**
|
|
226
|
+
|
|
227
|
+
- Check both laptops are on the same Wi-Fi. Guest and office networks often
|
|
228
|
+
block devices from seeing each other.
|
|
229
|
+
- On Windows, click **Allow** when the firewall asks about Python on the
|
|
230
|
+
sending laptop.
|
|
231
|
+
- Use the address the sender prints: `beam.receive("ab3f9c", host="192.168.1.42:8765")`.
|
|
232
|
+
|
|
233
|
+
## Limits
|
|
234
|
+
|
|
235
|
+
- Internet mode depends on free third-party hosts. They can change their rules
|
|
236
|
+
or go offline; beam falls back from temp.sh to uguu.se, but it cannot promise
|
|
237
|
+
either is up. Files over 4 GB need `lan=True`.
|
|
238
|
+
- `start.bat` is for Windows. On macOS or Linux, unzip the file and install
|
|
239
|
+
`requirements.txt` yourself.
|
|
240
|
+
|
|
241
|
+
## Development
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
pip install -e ".[dev]"
|
|
245
|
+
pytest
|
|
246
|
+
ruff check .
|
|
247
|
+
python -m build
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## License
|
|
251
|
+
|
|
252
|
+
MIT
|
beam_lan-0.1.0/README.md
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# beam
|
|
2
|
+
|
|
3
|
+
Zip a project and send it to anyone, anywhere, from Python. The zip includes
|
|
4
|
+
a `start.bat`: the other person double-clicks it and the project is set up
|
|
5
|
+
and running, with no manual installs.
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
import beam
|
|
9
|
+
|
|
10
|
+
beam.send("D:/projects/my_app", exclude=[".mp4", ".log"])
|
|
11
|
+
# code : tqWFGE-RX2oLb5xjRDX8d0M
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The other person, on any network, any time in the next 3 days:
|
|
15
|
+
|
|
16
|
+
```python
|
|
17
|
+
import beam
|
|
18
|
+
|
|
19
|
+
beam.receive("tqWFGE-RX2oLb5xjRDX8d0M")
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Python 3.9+. Works on Windows, macOS and Linux (`start.bat` is for Windows).
|
|
23
|
+
|
|
24
|
+
## Install
|
|
25
|
+
|
|
26
|
+
On both laptops:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install beam-lan
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Send a project
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
import beam
|
|
36
|
+
|
|
37
|
+
code = beam.send(
|
|
38
|
+
"D:/projects/my_app", # the project folder
|
|
39
|
+
exclude=[".mp4", ".log"], # file types to leave out (optional)
|
|
40
|
+
main="app.py", # what start.bat runs (optional, auto-detected)
|
|
41
|
+
)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
It zips the folder, encrypts it, uploads it, and prints a code. Send the code
|
|
45
|
+
to the other person however you like: WhatsApp, email, chat. You can close
|
|
46
|
+
your laptop straight after; the other person can download it any time within
|
|
47
|
+
3 days.
|
|
48
|
+
|
|
49
|
+
To send a file you already have, such as a zip or a PDF, pass its path instead
|
|
50
|
+
of a folder. It is sent as it is.
|
|
51
|
+
|
|
52
|
+
## Receive it
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
import beam
|
|
56
|
+
|
|
57
|
+
beam.receive("tqWFGE-RX2oLb5xjRDX8d0M") # saves my_app.zip here
|
|
58
|
+
beam.receive("tqWFGE-RX2oLb5xjRDX8d0M", out="D:/Downloads") # or somewhere else
|
|
59
|
+
beam.receive("tqWFGE-RX2oLb5xjRDX8d0M", extract=True) # also unzip it
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
An existing `my_app.zip` is never overwritten: the new one becomes
|
|
63
|
+
`my_app (1).zip` unless you pass `overwrite=True`.
|
|
64
|
+
|
|
65
|
+
## Same Wi-Fi, direct
|
|
66
|
+
|
|
67
|
+
For big folders on the same network, skip the internet:
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
beam.send("D:/projects/my_app", lan=True) # prints a short code, e.g. ab3f9c
|
|
71
|
+
beam.receive("ab3f9c") # on the other laptop, same Wi-Fi
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
This mode has no size limit and uploads nothing, and the receiver finds the
|
|
75
|
+
sender by itself. Both laptops must be on at the same time, and `send` waits
|
|
76
|
+
until the other laptop has the file.
|
|
77
|
+
|
|
78
|
+
## Only make the zip
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
beam.pack("D:/projects/my_app") # -> D:/projects/my_app.zip
|
|
82
|
+
beam.pack("D:/projects/my_app", output="D:/share/app.zip", exclude=[".csv"])
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## What goes in the zip
|
|
86
|
+
|
|
87
|
+
- **Your files**, minus things that should not travel: `.venv`, `venv`,
|
|
88
|
+
`__pycache__`, `.git`, `node_modules`, `.env` (secrets) and similar caches.
|
|
89
|
+
Virtual environments do not work when copied to another computer; `start.bat`
|
|
90
|
+
builds a fresh one instead.
|
|
91
|
+
- **Your `exclude` list.** `".mp4"`, `"mp4"` and `"*.mp4"` all skip mp4 files.
|
|
92
|
+
A plain name such as `"data"` skips a file or folder with that name. A
|
|
93
|
+
`.beamignore` file in the project adds more patterns, one per line.
|
|
94
|
+
- **`start.bat`**, which does the setup and starts the project.
|
|
95
|
+
- **`requirements.txt`**. Your own is used if the project has one. Otherwise
|
|
96
|
+
beam reads the project's `import` lines and writes one (for example
|
|
97
|
+
`import cv2` becomes `opencv-python`). Pass `requirements=["flask", "numpy"]`
|
|
98
|
+
to set the list yourself.
|
|
99
|
+
|
|
100
|
+
## What start.bat does
|
|
101
|
+
|
|
102
|
+
| Project | start.bat |
|
|
103
|
+
| --- | --- |
|
|
104
|
+
| Python (`main.py`, `app.py`, `run.py`, ... or `main=`) | creates `.venv`, installs `requirements.txt`, runs the script |
|
|
105
|
+
| Streamlit app | same setup, then `streamlit run app.py` |
|
|
106
|
+
| Django (`manage.py`) | same setup, then `manage.py runserver` |
|
|
107
|
+
| Node (`package.json`) | `npm install`, then `npm start` |
|
|
108
|
+
| Website (`index.html`) | opens it in the browser |
|
|
109
|
+
|
|
110
|
+
The setup runs once. After that, `start.bat` goes straight to starting the
|
|
111
|
+
project. If Python or Node.js is missing, it says where to download it. To
|
|
112
|
+
start over, delete the `.venv` folder.
|
|
113
|
+
|
|
114
|
+
Turn it off with `start_script=False`.
|
|
115
|
+
|
|
116
|
+
## How the internet transfer works
|
|
117
|
+
|
|
118
|
+
1. The zip is encrypted on your laptop with AES-256-GCM, using a random key.
|
|
119
|
+
2. The encrypted file is uploaded to a free temporary file host:
|
|
120
|
+
[temp.sh](https://temp.sh) (up to 4 GB, kept 3 days), or
|
|
121
|
+
[uguu.se](https://uguu.se) (up to 128 MB, kept 3 hours) if temp.sh is down.
|
|
122
|
+
3. The code is `<where it is>-<the key>`. The key never goes to the host, so
|
|
123
|
+
the host only ever stores unreadable data.
|
|
124
|
+
4. `receive` downloads it, checks it has not been changed, and decrypts it.
|
|
125
|
+
|
|
126
|
+
Anyone who has the whole code can download the file, so send it only to the
|
|
127
|
+
person it is for.
|
|
128
|
+
|
|
129
|
+
## All options
|
|
130
|
+
|
|
131
|
+
`beam.send(path, ...)` and `beam.pack(path, ...)`
|
|
132
|
+
|
|
133
|
+
| Option | Default | Effect |
|
|
134
|
+
| --- | --- | --- |
|
|
135
|
+
| `exclude` | none | file types or names to leave out |
|
|
136
|
+
| `main` | auto | script that `start.bat` runs |
|
|
137
|
+
| `start_script` | `True` | add `start.bat` (and `requirements.txt` if needed) |
|
|
138
|
+
| `requirements` | auto | pip packages `start.bat` installs |
|
|
139
|
+
| `use_default_excludes` | `True` | skip `.venv`, `.git`, `__pycache__`, ... |
|
|
140
|
+
| `max_size_mb` | none | skip files bigger than this |
|
|
141
|
+
| `quiet` | `False` | print nothing |
|
|
142
|
+
|
|
143
|
+
`beam.pack` only: `output` sets where the zip goes (default `<folder>.zip`
|
|
144
|
+
next to the folder).
|
|
145
|
+
|
|
146
|
+
`beam.send` only: `lan=True` sends directly over the same Wi-Fi. With
|
|
147
|
+
`lan=True`, `code` picks your own code, `timeout` sets how many seconds to
|
|
148
|
+
wait for the other laptop, and `port` sets the network port (default 8765,
|
|
149
|
+
another free port is used if it is taken).
|
|
150
|
+
|
|
151
|
+
`beam.receive(code, ...)`: `out` sets the folder to save into, `extract` also
|
|
152
|
+
unzips it, and `overwrite` replaces existing files. For LAN codes, `host="IP"`
|
|
153
|
+
or `host="IP:port"` skips the search and `wait` sets how many seconds to
|
|
154
|
+
search (default 15).
|
|
155
|
+
|
|
156
|
+
Errors raise `beam.BeamError`.
|
|
157
|
+
|
|
158
|
+
## Troubleshooting
|
|
159
|
+
|
|
160
|
+
**`nothing found for this code ... expired`**: the file is older than 3 days
|
|
161
|
+
(3 hours if it went to uguu.se), or the code was not copied completely.
|
|
162
|
+
Send it again.
|
|
163
|
+
|
|
164
|
+
**`could not decrypt: wrong code`**: part of the code is missing or mistyped.
|
|
165
|
+
|
|
166
|
+
**`upload failed on every host`**: check the internet connection. If the hosts
|
|
167
|
+
are down, use `beam.pack` and share the zip another way.
|
|
168
|
+
|
|
169
|
+
**LAN mode: `no sender with code ... found`**
|
|
170
|
+
|
|
171
|
+
- Check both laptops are on the same Wi-Fi. Guest and office networks often
|
|
172
|
+
block devices from seeing each other.
|
|
173
|
+
- On Windows, click **Allow** when the firewall asks about Python on the
|
|
174
|
+
sending laptop.
|
|
175
|
+
- Use the address the sender prints: `beam.receive("ab3f9c", host="192.168.1.42:8765")`.
|
|
176
|
+
|
|
177
|
+
## Limits
|
|
178
|
+
|
|
179
|
+
- Internet mode depends on free third-party hosts. They can change their rules
|
|
180
|
+
or go offline; beam falls back from temp.sh to uguu.se, but it cannot promise
|
|
181
|
+
either is up. Files over 4 GB need `lan=True`.
|
|
182
|
+
- `start.bat` is for Windows. On macOS or Linux, unzip the file and install
|
|
183
|
+
`requirements.txt` yourself.
|
|
184
|
+
|
|
185
|
+
## Development
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
pip install -e ".[dev]"
|
|
189
|
+
pytest
|
|
190
|
+
ruff check .
|
|
191
|
+
python -m build
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## License
|
|
195
|
+
|
|
196
|
+
MIT
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "beam-lan"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Zip a project and send it to anyone, anywhere, with a start.bat that sets it up and runs it."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = { file = "LICENSE" }
|
|
12
|
+
authors = [{ name = "Nylonxd", email = "Himanshujha202005@gmail.com" }]
|
|
13
|
+
keywords = ["file-transfer", "share", "zip", "project", "encrypted", "lan", "start.bat"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 3 - Alpha",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
20
|
+
"Programming Language :: Python :: 3.9",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
"Programming Language :: Python :: 3.14",
|
|
26
|
+
"Operating System :: OS Independent",
|
|
27
|
+
"Typing :: Typed",
|
|
28
|
+
"Topic :: Communications :: File Sharing",
|
|
29
|
+
"Topic :: System :: Archiving",
|
|
30
|
+
]
|
|
31
|
+
dependencies = ["cryptography>=42"]
|
|
32
|
+
|
|
33
|
+
[project.optional-dependencies]
|
|
34
|
+
dev = ["pytest>=7", "ruff>=0.4", "build", "twine"]
|
|
35
|
+
|
|
36
|
+
[project.urls]
|
|
37
|
+
Homepage = "https://github.com/NYLONXD/beam"
|
|
38
|
+
Source = "https://github.com/NYLONXD/beam"
|
|
39
|
+
Issues = "https://github.com/NYLONXD/beam/issues"
|
|
40
|
+
Changelog = "https://github.com/NYLONXD/beam/blob/main/CHANGELOG.md"
|
|
41
|
+
|
|
42
|
+
[tool.hatch.version]
|
|
43
|
+
path = "src/beam/__init__.py"
|
|
44
|
+
|
|
45
|
+
[tool.hatch.build.targets.wheel]
|
|
46
|
+
packages = ["src/beam"]
|
|
47
|
+
|
|
48
|
+
[tool.hatch.build.targets.sdist]
|
|
49
|
+
include = ["src/beam", "tests", "README.md", "LICENSE", "CHANGELOG.md"]
|
|
50
|
+
|
|
51
|
+
[tool.pytest.ini_options]
|
|
52
|
+
testpaths = ["tests"]
|
|
53
|
+
|
|
54
|
+
[tool.ruff]
|
|
55
|
+
line-length = 88
|
|
56
|
+
target-version = "py39"
|
|
57
|
+
|
|
58
|
+
[tool.ruff.lint]
|
|
59
|
+
select = ["E", "F", "I", "UP", "B"]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""beam - zip a project and send it to another laptop, anywhere.
|
|
2
|
+
|
|
3
|
+
import beam
|
|
4
|
+
|
|
5
|
+
code = beam.send("D:/projects/my_app", exclude=[".mp4", ".log"]) # laptop A
|
|
6
|
+
beam.receive(code) # laptop B
|
|
7
|
+
|
|
8
|
+
beam.send("D:/projects/my_app", lan=True) # direct, same Wi-Fi only
|
|
9
|
+
beam.pack("D:/projects/my_app") # only make my_app.zip
|
|
10
|
+
|
|
11
|
+
The zip carries a start.bat that installs what the project needs and runs it.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
__version__ = "0.1.0" # before the imports: _cloud reads it for its User-Agent
|
|
15
|
+
|
|
16
|
+
from ._files import DEFAULT_EXCLUDES # noqa: E402
|
|
17
|
+
from ._protocol import DEFAULT_PORT, BeamError, find_sender, lan_ip # noqa: E402
|
|
18
|
+
from .packer import pack # noqa: E402
|
|
19
|
+
from .transfer import receive, send # noqa: E402
|
|
20
|
+
|
|
21
|
+
__all__ = [
|
|
22
|
+
"send",
|
|
23
|
+
"receive",
|
|
24
|
+
"pack",
|
|
25
|
+
"find_sender",
|
|
26
|
+
"lan_ip",
|
|
27
|
+
"BeamError",
|
|
28
|
+
"DEFAULT_EXCLUDES",
|
|
29
|
+
"DEFAULT_PORT",
|
|
30
|
+
"__version__",
|
|
31
|
+
]
|