python-pylan 0.0.1__tar.gz → 0.0.3__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.
Files changed (65) hide show
  1. python_pylan-0.0.3/.claude/rules/engineering.md +43 -0
  2. python_pylan-0.0.3/.editorconfig +21 -0
  3. python_pylan-0.0.3/.flake8 +8 -0
  4. python_pylan-0.0.3/.gemini/settings.json +8 -0
  5. python_pylan-0.0.3/.github/workflows/release.yml +33 -0
  6. {python_pylan-0.0.1 → python_pylan-0.0.3}/.gitignore +84 -80
  7. python_pylan-0.0.3/CLAUDE.md +19 -0
  8. python_pylan-0.0.3/GEMINI.md +74 -0
  9. {python_pylan-0.0.1 → python_pylan-0.0.3}/PKG-INFO +13 -3
  10. {python_pylan-0.0.1 → python_pylan-0.0.3}/README.md +24 -24
  11. python_pylan-0.0.3/TODO.md +86 -0
  12. python_pylan-0.0.3/assets/icon.ico +0 -0
  13. python_pylan-0.0.3/assets/icon.png +0 -0
  14. python_pylan-0.0.3/assets/logo.svg +51 -0
  15. python_pylan-0.0.3/pylan/__init__.py +18 -0
  16. python_pylan-0.0.3/pylan/__main__.py +29 -0
  17. python_pylan-0.0.3/pylan/cli/__init__.py +25 -0
  18. python_pylan-0.0.3/pylan/cli/cli.py +36 -0
  19. python_pylan-0.0.3/pylan/cli/receive.py +201 -0
  20. python_pylan-0.0.3/pylan/cli/scan.py +103 -0
  21. python_pylan-0.0.3/pylan/cli/send.py +106 -0
  22. python_pylan-0.0.3/pylan/client/__init__.py +14 -0
  23. python_pylan-0.0.3/pylan/core/__init__.py +103 -0
  24. python_pylan-0.0.3/pylan/core/discovery.py +475 -0
  25. python_pylan-0.0.3/pylan/core/handshake.py +145 -0
  26. python_pylan-0.0.3/pylan/core/models.py +77 -0
  27. python_pylan-0.0.3/pylan/core/net.py +88 -0
  28. python_pylan-0.0.3/pylan/core/protocol.py +132 -0
  29. python_pylan-0.0.3/pylan/core/transfer.py +420 -0
  30. python_pylan-0.0.3/pylan/errors/__init__.py +28 -0
  31. python_pylan-0.0.3/pylan/errors/base.py +13 -0
  32. python_pylan-0.0.3/pylan/main.py +6 -0
  33. python_pylan-0.0.3/pylan/ui/__init__.py +21 -0
  34. python_pylan-0.0.3/pylan/ui/app.py +188 -0
  35. python_pylan-0.0.3/pylan/ui/assets/icon.ico +0 -0
  36. python_pylan-0.0.3/pylan/ui/assets/icon.png +0 -0
  37. python_pylan-0.0.3/pylan/ui/assets/logo.svg +51 -0
  38. python_pylan-0.0.3/pylan/ui/components/__init__.py +14 -0
  39. python_pylan-0.0.3/pylan/ui/components/file_picker.py +243 -0
  40. python_pylan-0.0.3/pylan/ui/components/navbar.py +250 -0
  41. python_pylan-0.0.3/pylan/ui/components/peer_tile.py +152 -0
  42. python_pylan-0.0.3/pylan/ui/components/transfer_row.py +224 -0
  43. python_pylan-0.0.3/pylan/ui/state.py +823 -0
  44. python_pylan-0.0.3/pylan/ui/views/__init__.py +13 -0
  45. python_pylan-0.0.3/pylan/ui/views/home_view.py +245 -0
  46. python_pylan-0.0.3/pylan/ui/views/receive_view.py +249 -0
  47. python_pylan-0.0.3/pylan/ui/views/send_view.py +200 -0
  48. python_pylan-0.0.3/pylan/ui/views/settings_view.py +233 -0
  49. python_pylan-0.0.3/pylan/utils/utils.py +21 -0
  50. python_pylan-0.0.3/pyproject.toml +63 -0
  51. python_pylan-0.0.3/tests/__init__.py +6 -0
  52. python_pylan-0.0.3/tests/test_cli_receive.py +300 -0
  53. python_pylan-0.0.3/tests/test_cli_scan.py +118 -0
  54. python_pylan-0.0.3/tests/test_cli_send.py +224 -0
  55. python_pylan-0.0.3/tests/test_discovery.py +391 -0
  56. python_pylan-0.0.3/tests/test_errors.py +30 -0
  57. python_pylan-0.0.3/tests/test_handshake.py +147 -0
  58. python_pylan-0.0.3/tests/test_protocol.py +125 -0
  59. python_pylan-0.0.3/tests/test_transfer.py +289 -0
  60. python_pylan-0.0.3/tests/test_ui/__init__.py +1 -0
  61. python_pylan-0.0.3/tests/test_ui/test_state.py +517 -0
  62. python_pylan-0.0.3/uv.lock +3730 -0
  63. python_pylan-0.0.1/pylan/__init__.py +0 -3
  64. python_pylan-0.0.1/pyproject.toml +0 -25
  65. python_pylan-0.0.1/requirements.txt +0 -1
@@ -0,0 +1,43 @@
1
+ # Engineering rules
2
+
3
+ ## Python and dependencies
4
+
5
+ - Support the declared minimum of Python 3.10; avoid syntax or library APIs
6
+ that require a newer version unless the project requirement is deliberately
7
+ changed.
8
+ - Follow neighboring code: four-space indentation, type annotations, clear
9
+ names, and concise docstrings on public APIs.
10
+ - Prefer the standard library and dependencies already declared in
11
+ `pyproject.toml`. When a dependency change is necessary, update
12
+ `pyproject.toml` and `uv.lock` consistently.
13
+ - Do not introduce lint, format, or type-check tooling as incidental cleanup.
14
+
15
+ ## Network behavior and privacy
16
+
17
+ - Treat UDP datagrams and TCP responses as untrusted input. Check the expected
18
+ structure and values before using them.
19
+ - Preserve the established message header and payload format unless the task
20
+ explicitly calls for a protocol change; account for compatibility when
21
+ doing so.
22
+ - Keep network resource cleanup explicit and async task/concurrency behavior
23
+ bounded. Surface actionable errors using the existing logging or return
24
+ conventions rather than silently masking new failure cases.
25
+ - Keep discovery and sharing local-network oriented. Do not add broad scans
26
+ or remote-service behavior beyond the requested scope.
27
+ - Avoid logging payloads, secrets, or unnecessary device-identifying data.
28
+ Describe security properties accurately; do not imply unfinished goals are
29
+ already guarantees.
30
+
31
+ ## Tests and changes
32
+
33
+ - Read the relevant code and tests before editing, and add tests for changed
34
+ behavior and important failure paths.
35
+ - Keep tests deterministic. Mock sockets, TCP streams, and timing instead of
36
+ relying on live network access.
37
+ - Run the most relevant test module first, followed by `uv run pytest` for
38
+ cross-cutting changes. If `uv` is unavailable, use `python -m pytest` in the
39
+ active project environment and state that substitution.
40
+ - Keep edits focused. Do not change unrelated code, generated files, or
41
+ documentation outside the scope of the behavior being changed.
42
+ - Review the diff before finishing and report the implementation, actual
43
+ validation results, and any known limitations.
@@ -0,0 +1,21 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ end_of_line = lf
6
+ insert_final_newline = true
7
+ indent_style = space
8
+ indent_size = 4
9
+ trim_trailing_whitespace = true
10
+
11
+ [*.{json,yml,yaml}]
12
+ indent_size = 2
13
+
14
+ [*.md]
15
+ trim_trailing_whitespace = false
16
+
17
+ [Makefile]
18
+ indent_style = tab
19
+
20
+ [{*.bat,*.cmd}]
21
+ end_of_line = crlf
@@ -0,0 +1,8 @@
1
+ [flake8]
2
+ exclude =
3
+ .git,
4
+ __pycache__,
5
+ .venv,
6
+ venv,
7
+ build,
8
+ dist
@@ -0,0 +1,8 @@
1
+ {
2
+ "context": {
3
+ "fileName": ["GEMINI.md"]
4
+ },
5
+ "fileFiltering": {
6
+ "respectGitIgnore": true
7
+ }
8
+ }
@@ -0,0 +1,33 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ jobs:
9
+ pypi-publish:
10
+ name: Build and publish Python distribution to PyPI
11
+ runs-on: ubuntu-latest
12
+ environment: pypi
13
+ permissions:
14
+ id-token: write
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Set up Python
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: "3.11"
23
+
24
+ - name: Install build tools
25
+ run: |
26
+ python -m pip install --upgrade pip
27
+ pip install build hatchling
28
+
29
+ - name: Build binary wheel and source tarball
30
+ run: python -m build
31
+
32
+ - name: Publish package distributions to PyPI
33
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -1,80 +1,84 @@
1
- # Python bytecode and interpreter cache files are generated automatically.
2
- __pycache__/
3
- *.py[cod]
4
- *$py.class
5
-
6
- # Virtual environments contain local interpreters and installed dependencies.
7
- # Create your own environment; do not commit it to the repository.
8
- .venv/
9
- venv/
10
- env/
11
- ENV/
12
- .env/
13
-
14
- # Local environment-variable files may contain secrets or machine-specific
15
- # settings. Keep shareable templates such as .env.example in version control.
16
- .env
17
- .env.*
18
- !.env.example
19
- !.env.*.example
20
-
21
- # Build and packaging output can be recreated from the source and project
22
- # configuration.
23
- build/
24
- dist/
25
- wheelhouse/
26
- *.egg-info/
27
- .eggs/
28
- pip-wheel-metadata/
29
-
30
- # Test runners and coverage tools write caches and reports locally.
31
- .pytest_cache/
32
- .tox/
33
- .nox/
34
- .coverage
35
- .coverage.*
36
- coverage.xml
37
- htmlcov/
38
- nosetests.xml
39
- test-results/
40
-
41
- # Type checkers and linters may create local caches.
42
- .mypy_cache/
43
- .dmypy.json
44
- .pyre/
45
- .pytype/
46
- .ruff_cache/
47
- .hypothesis/
48
- .pyright/
49
-
50
- # Documentation builds are generated output, not documentation source.
51
- docs/_build/
52
- site/
53
-
54
- # Notebook checkpoints are temporary working state.
55
- .ipynb_checkpoints/
56
-
57
- # Python REPL and tool history is specific to an individual contributor.
58
- .python_history
59
- .ipython/
60
-
61
- # Logs, temporary files, and local databases are usually runtime output.
62
- *.log
63
- *.tmp
64
- *.temp
65
- *.sqlite
66
- *.sqlite3
67
- *.db
68
-
69
- # Editor and IDE settings are often personal; commit shared project settings
70
- # only when the team intentionally decides to track them.
71
- .vscode/
72
- .idea/
73
- *.swp
74
- *.swo
75
-
76
- # Operating-system metadata files are not part of the project.
77
- .DS_Store
78
- ._*
79
- Thumbs.db
80
- Desktop.ini
1
+ # Python bytecode and interpreter cache files are generated automatically.
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # Virtual environments contain local interpreters and installed dependencies.
7
+ # Create your own environment; do not commit it to the repository.
8
+ .venv/
9
+ venv/
10
+ env/
11
+ ENV/
12
+ .env/
13
+
14
+ # Local environment-variable files may contain secrets or machine-specific
15
+ # settings. Keep shareable templates such as .env.example in version control.
16
+ .env
17
+ .env.*
18
+ !.env.example
19
+ !.env.*.example
20
+
21
+ # Build and packaging output can be recreated from the source and project
22
+ # configuration.
23
+ build/
24
+ dist/
25
+ wheelhouse/
26
+ *.egg-info/
27
+ .eggs/
28
+ pip-wheel-metadata/
29
+
30
+ # Test runners and coverage tools write caches and reports locally.
31
+ .pytest_cache/
32
+ .tox/
33
+ .nox/
34
+ .coverage
35
+ .coverage.*
36
+ coverage.xml
37
+ htmlcov/
38
+ nosetests.xml
39
+ test-results/
40
+
41
+ # Type checkers and linters may create local caches.
42
+ .mypy_cache/
43
+ .dmypy.json
44
+ .pyre/
45
+ .pytype/
46
+ .ruff_cache/
47
+ .hypothesis/
48
+ .pyright/
49
+
50
+ # Documentation builds are generated output, not documentation source.
51
+ docs/_build/
52
+ site/
53
+
54
+ # Notebook checkpoints are temporary working state.
55
+ .ipynb_checkpoints/
56
+
57
+ # Python REPL and tool history is specific to an individual contributor.
58
+ .python_history
59
+ .ipython/
60
+
61
+ # Logs, temporary files, and local databases are usually runtime output.
62
+ *.log
63
+ *.tmp
64
+ *.temp
65
+ *.sqlite
66
+ *.sqlite3
67
+ *.db
68
+
69
+ # Editor and IDE settings are often personal; commit shared project settings
70
+ # only when the team intentionally decides to track them.
71
+ .vscode/
72
+ .idea/
73
+ *.swp
74
+ *.swo
75
+
76
+ # Operating-system metadata files are not part of the project.
77
+ .DS_Store
78
+ ._*
79
+ Thumbs.db
80
+ Desktop.ini
81
+
82
+ # Flet
83
+ .flet/
84
+ .flet
@@ -0,0 +1,19 @@
1
+ # PyLan
2
+
3
+ PyLan is an early-stage Python package for local-network file and data
4
+ sharing. The package supports Python 3.10 and newer; dependency metadata is
5
+ maintained in `pyproject.toml`, with the resolved environment in `uv.lock`.
6
+
7
+ Before making changes, inspect the relevant implementation and tests. Follow
8
+ the project-specific requirements in [`.claude/rules/engineering.md`](.claude/rules/engineering.md).
9
+
10
+ The key implementation areas are `pylan/core/protocol.py` (message framing),
11
+ `pylan/core/models.py` (device models and storage), and
12
+ `pylan/core/discovery.py` (multicast discovery and TCP probes). Preserve the
13
+ existing public API and wire format unless the requested change requires an
14
+ explicitly compatible update.
15
+
16
+ Tests are under `tests/` and use `unittest` test cases, runnable with pytest.
17
+ Prefer deterministic tests that mock network operations. For relevant
18
+ changes, run the focused tests and then `uv run pytest` when practical. State
19
+ clearly which checks were run and their results.
@@ -0,0 +1,74 @@
1
+ # PyLan project guidance
2
+
3
+ ## Project overview
4
+
5
+ PyLan is an early-stage Python project for transferring files and other data
6
+ between nearby devices on a local network. It is intended to become both a
7
+ standalone application and a reusable package. Security and privacy are
8
+ important project goals, but do not describe planned or incomplete safeguards
9
+ as implemented.
10
+
11
+ The package requires Python 3.10 or newer. Dependencies and package metadata
12
+ are defined in `pyproject.toml`; `uv.lock` records the resolved environment.
13
+
14
+ ## Repository map
15
+
16
+ - `pylan/core/protocol.py` implements the binary message header and payload
17
+ serialization.
18
+ - `pylan/core/models.py` defines discovery data models and the in-memory
19
+ device store.
20
+ - `pylan/core/discovery.py` implements multicast discovery, TCP probing, and
21
+ subnet scanning.
22
+ - `pylan/main.py` is the current console-script entry point; keep its
23
+ intentionally limited behavior in mind when making CLI changes.
24
+ - `tests/` contains the unit tests for protocol framing and peer discovery.
25
+
26
+ Keep changes within the relevant layer. Preserve existing public names and the
27
+ wire format unless a requested change explicitly requires a compatible
28
+ protocol update.
29
+
30
+ ## Engineering expectations
31
+
32
+ - Match the surrounding Python style: four-space indentation, clear names,
33
+ useful type annotations, and focused docstrings for public APIs.
34
+ - Prefer small, testable changes and the standard library or existing
35
+ dependencies. Add a dependency only when the task requires it, and update
36
+ `pyproject.toml` and `uv.lock` together.
37
+ - Treat all network input as untrusted. Validate message shape and values
38
+ before using them; keep resource lifetimes explicit and asynchronous
39
+ concurrency bounded.
40
+ - Keep discovery and transfer behavior local-network scoped. Do not add
41
+ unrelated remote-service dependencies, broad network scanning, or claims
42
+ that the current implementation provides complete security.
43
+ - Avoid logging payload contents, secrets, or unnecessary personal/device
44
+ information.
45
+ - Tests should be deterministic and should mock sockets, connections, and
46
+ timing rather than depend on a live network.
47
+ - Do not add formatter, linter, or type-checker configuration unless requested
48
+ or needed for the change; the repository does not currently configure those
49
+ tools.
50
+
51
+ ## Validation
52
+
53
+ Run the smallest relevant test selection, then the full unit suite when the
54
+ change affects shared behavior:
55
+
56
+ ```sh
57
+ uv run pytest tests/test_protocol.py
58
+ uv run pytest tests/test_discovery.py
59
+ uv run pytest
60
+ ```
61
+
62
+ If `uv` is unavailable, use the project's active environment with
63
+ `python -m pytest` and report the command actually run. Do not claim a check
64
+ passed unless it was run successfully.
65
+
66
+ ## Change workflow
67
+
68
+ 1. Read the implementation and its tests before changing behavior.
69
+ 2. Add or update tests for observable behavior, including error paths where
70
+ appropriate.
71
+ 3. Keep the patch focused; do not rewrite unrelated files or generated
72
+ artifacts.
73
+ 4. Review the final diff for accidental changes and summarize behavior,
74
+ validation, and any remaining limitations.
@@ -1,14 +1,24 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: python-pylan
3
- Version: 0.0.1
3
+ Version: 0.0.3
4
4
  Summary: Cross-platform local network file and data sharing library.
5
5
  Project-URL: Homepage, https://github.com/Aryan-202/python-pylan
6
- Author: Aryan Vishwakarma
6
+ Author-email: Aryan Vishwakarma <aryanvishwakarma275@gmail.com>
7
7
  Classifier: Development Status :: 2 - Pre-Alpha
8
8
  Classifier: Intended Audience :: Developers
9
9
  Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Programming Language :: Python :: 3
11
- Requires-Python: >=3.9
11
+ Requires-Python: >=3.10
12
+ Requires-Dist: asyncio>=4.0.0
13
+ Requires-Dist: bleak>=3.0.2
14
+ Requires-Dist: certifi>=2026.10.23
15
+ Requires-Dist: click>=8.5.0
16
+ Requires-Dist: flet>=1.0.5
17
+ Requires-Dist: psutil>=7.2.2
18
+ Requires-Dist: pytest>=9.1.1
19
+ Requires-Dist: qrcode>=8.2
20
+ Requires-Dist: scapy>=2.8.0
21
+ Requires-Dist: zeroconf>=0.151.5
12
22
  Description-Content-Type: text/markdown
13
23
 
14
24
  # PyLan
@@ -1,24 +1,24 @@
1
- # PyLan
2
-
3
- PyLan is a project for transferring files, folders, and other data between nearby devices connected to the same local network. It is being developed as a cross-platform application in Python, with the goal of making local sharing straightforward and accessible.
4
-
5
- ## Project goals
6
-
7
- The project aims to provide a practical way to move data between devices without relying on a remote file-sharing service. It is intended for situations where devices are nearby and can communicate over a local network, whether sharing a single file or a collection of files and folders.
8
-
9
- Security and privacy are central goals. The project is being built with care for the data people choose to share and the devices involved. These are development priorities, not a claim that every security feature is already complete.
10
-
11
- ## How it can be used
12
-
13
- The project is intended to support two ways of use:
14
-
15
- - As a standalone application for people who want to share data between nearby devices.
16
- - As a reusable module that developers can incorporate into larger projects.
17
-
18
- The standalone application is also intended to be distributable as a binary, so users may be able to run it without setting up a Python development environment.
19
-
20
- ## Development direction
21
-
22
- The project is transitioning to Python and is intended to run across multiple platforms. Its functionality and platform support will grow as development continues. The long-term aim is to make local data sharing convenient while keeping the experience focused, approachable, and respectful of user privacy.
23
-
24
- This project is open source and free to use. Contributions, feedback, and ideas that help improve its reliability, usability, and privacy are welcome.
1
+ # PyLan
2
+
3
+ PyLan is a project for transferring files, folders, and other data between nearby devices connected to the same local network. It is being developed as a cross-platform application in Python, with the goal of making local sharing straightforward and accessible.
4
+
5
+ ## Project goals
6
+
7
+ The project aims to provide a practical way to move data between devices without relying on a remote file-sharing service. It is intended for situations where devices are nearby and can communicate over a local network, whether sharing a single file or a collection of files and folders.
8
+
9
+ Security and privacy are central goals. The project is being built with care for the data people choose to share and the devices involved. These are development priorities, not a claim that every security feature is already complete.
10
+
11
+ ## How it can be used
12
+
13
+ The project is intended to support two ways of use:
14
+
15
+ - As a standalone application for people who want to share data between nearby devices.
16
+ - As a reusable module that developers can incorporate into larger projects.
17
+
18
+ The standalone application is also intended to be distributable as a binary, so users may be able to run it without setting up a Python development environment.
19
+
20
+ ## Development direction
21
+
22
+ The project is transitioning to Python and is intended to run across multiple platforms. Its functionality and platform support will grow as development continues. The long-term aim is to make local data sharing convenient while keeping the experience focused, approachable, and respectful of user privacy.
23
+
24
+ This project is open source and free to use. Contributions, feedback, and ideas that help improve its reliability, usability, and privacy are welcome.
@@ -0,0 +1,86 @@
1
+ # TODO.md — Things need to be fixed for PyLan v0.0.3
2
+
3
+ ## High Priority
4
+
5
+ - [ ] **Package & Dependency Decoupling (`pyproject.toml`)**
6
+ - [ ] Strip GUI (`flet`) and CLI (`click`, `rich`) dependencies out of core runtime requirements.
7
+ - [ ] Set up optional installation targets:
8
+ - [ ] `pip install pylan` (Core engine + lightweight SDK only)
9
+ - [ ] `pip install "pylan[cli]"` (Command-line tool)
10
+ - [ ] `pip install "pylan[ui]"` (Desktop graphical interface)
11
+ - [ ] `pip install "pylan[all]"` (Full bundle)
12
+ - [ ] Implement graceful import guards in entrypoints that suggest the missing extra if uninstalled.
13
+
14
+ - [ ] **Core Independence & Callback Extraction**
15
+ - [ ] Remove all UI and CLI imports from `pylan/core/`.
16
+ - [ ] Abstract progress tracking into standard callback protocols (`Callable[[int, int], None]`) instead of coupling to Rich or Flet UI widgets.
17
+ - [ ] Decouple `pylan/cli/` and `pylan/ui/` so both act purely as independent presentation layers consuming the public SDK.
18
+
19
+ ---
20
+
21
+ ## Exception Hierarchy (`pylan/errors/`)
22
+
23
+ - [ ] **Define Base Exception**
24
+ - [ ] `base.py`: Root exception for all PyLan-related failures.
25
+
26
+ - [ ] **Discovery Exceptions (`pylan/errors/discovery.py`)**
27
+ - [ ] `DiscoveryError`: Base class for peer discovery failures.
28
+ - [ ] `PeerNotFoundError`: Raised when the target peer name or ID cannot be discovered on the subnet.
29
+ - [ ] `DiscoveryTimeoutError`: Raised when discovery scan expires without finding devices.
30
+ - [ ] `NetworkInterfaceError`: Raised when bound interface or multicast socket is unavailable.
31
+ - [ ] `InvalidServiceRecordError`: Raised when mDNS/multicast packet contains malformed peer payload.
32
+
33
+ - [ ] **Connection & Handshake Exceptions (`pylan/errors/connection.py`)**
34
+ - [ ] `PylanConnectionError`: Base class for transport connection errors.
35
+ - [ ] `PeerUnreachableError`: Raised when the target IP/port is unreachable or drops socket connection.
36
+ - [ ] `HandshakeError`: Base class for handshake phase errors.
37
+ - [ ] `HandshakeRejectedError`: Raised when the receiver explicitly declines incoming transfer.
38
+ - [ ] `HandshakeTimeoutError`: Raised when peer does not respond to the handshake proposal within timeout.
39
+ - [ ] `ProtocolVersionMismatchError`: Raised when client and peer use incompatible protocol versions.
40
+ - [ ] `AuthenticationFailedError`: Raised if pre-shared key, PIN, or peer token validation fails.
41
+
42
+ - [ ] **Transfer & Payload Exceptions (`pylan/errors/transfer.py`)**
43
+ - [ ] `TransferError`: Base class for file streaming errors.
44
+ - [ ] `TransferFailedError`: Generic failure during chunk streaming or socket writing.
45
+ - [ ] `TransferAbortedError`: Raised when transfer is aborted mid-stream by peer or local user.
46
+ - [ ] `TransferTimeoutError`: Raised when data stream stalls past read/write timeout.
47
+ - [ ] `ChecksumMismatchError`: Raised when file integrity check fails after transfer completes.
48
+ - [ ] `InsufficientStorageError`: Raised by receiver if target disk has inadequate free space.
49
+ - [ ] `FileAccessError`: Base class for local file system permission or path errors.
50
+ - [ ] `TransportFileNotFoundError`: Raised when requested payload does not exist on disk.
51
+ - [ ] `FileReadError`: Raised when local sender fails to read chunks from disk.
52
+ - [ ] `FileWriteError`: Raised when receiver fails to write chunks to disk.
53
+
54
+ - [ ] **Protocol & Framing Exceptions (`pylan/errors/protocol.py`)**
55
+ - [ ] `ProtocolError`: Base class for packet serialization and framing errors.
56
+ - [ ] `InvalidPacketError`: Raised when receiving corrupted or malformed packet header/body.
57
+ - [ ] `PacketHeaderTooShortError`: Raised when socket read delivers incomplete struct header.
58
+ - [ ] `MagicBytesMismatchError`: Raised when packet header magic header does not match expected signature.
59
+ - [ ] `PayloadTooLargeError`: Raised when incoming frame size exceeds protocol buffer limit.
60
+
61
+ - [ ] **Integrate Exceptions Across Modules**
62
+ - [ ] Export all exception classes through `pylan/errors/__init__.py`.
63
+ - [ ] Re-export top-level exceptions in `pylan/__init__.py` for public SDK consumption.
64
+ - [ ] Audit `pylan/core/discovery.py`, `pylan/core/handshake.py`, and `pylan/core/protocol.py` to replace generic exceptions with domain-specific classes.
65
+
66
+ ---
67
+
68
+ ## Public Client API
69
+
70
+ - [ ] **Design High-Level Interface (`pylan/client.py` & `pylan/__init__.py`)**
71
+ - [ ] Implement sync wrapper methods:
72
+ - [ ] `pylan.send_file(file_path: Path | str, peer_name: str | None = None, peer_ip: str | None = None, port: int = ..., timeout: float = 30.0, on_progress: Callable | None = None) -> TransferResult`
73
+ - [ ] `pylan.receive_file(save_dir: Path | str = "./downloads", accept_all: bool = False, timeout: float | None = None, on_progress: Callable | None = None) -> TransferResult`
74
+ - [ ] `pylan.scan(timeout: float = 3.0) -> list[Peer]`
75
+ - [ ] Implement object-oriented client class:
76
+ - [ ] `PyLanClient` (Context manager supporting `.scan()`, `.connect()`, `.send()`, `.receive()`).
77
+ - [ ] Event callbacks: `on_peer_found`, `on_handshake_request`, `on_progress`, `on_complete`.
78
+ - [ ] Implement async equivalents (`AsyncPyLanClient`) for event loops, UI runtimes, and web services.
79
+
80
+ ---
81
+
82
+ ## Verification & Tests
83
+
84
+ - [ ] Add isolated unit tests in `tests/test_errors.py` ensuring all custom exceptions inherit from `PyLanError`.
85
+ - [ ] Add packaging tests in `tests/test_packaging.py` validating `import pylan` runs in headless environments without `flet` or `click`.
86
+ - [ ] Add integration tests in `tests/test_public_api.py` validating `pylan.send_file` and `pylan.scan` error states.
Binary file
Binary file
@@ -0,0 +1,51 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 100" width="400" height="100">
2
+ <defs>
3
+ <linearGradient id="pylan-grad" x1="0%" y1="0%" x2="100%" y2="100%">
4
+ <stop offset="0%" stop-color="#00E5FF" />
5
+ <stop offset="50%" stop-color="#2979FF" />
6
+ <stop offset="100%" stop-color="#7C4DFF" />
7
+ </linearGradient>
8
+ <linearGradient id="glow-grad" x1="0%" y1="0%" x2="100%" y2="0%">
9
+ <stop offset="0%" stop-color="#00E5FF" stop-opacity="0.8" />
10
+ <stop offset="100%" stop-color="#2979FF" stop-opacity="0.2" />
11
+ </linearGradient>
12
+ <filter id="glow" x="-20%" y="-20%" width="140%" height="140%">
13
+ <feGaussianBlur stdDeviation="4" result="blur" />
14
+ <feComposite in="SourceGraphic" in2="blur" operator="over" />
15
+ </filter>
16
+ </defs>
17
+
18
+ <!-- Node Icon Group -->
19
+ <g transform="translate(15, 10)">
20
+ <!-- Interconnecting Data Paths -->
21
+ <path d="M 40 25 L 65 55" stroke="url(#pylan-grad)" stroke-width="4" stroke-linecap="round" stroke-dasharray="2 6" opacity="0.8" />
22
+ <path d="M 40 25 L 15 55" stroke="url(#pylan-grad)" stroke-width="4" stroke-linecap="round" />
23
+ <path d="M 15 55 L 65 55" stroke="url(#pylan-grad)" stroke-width="4" stroke-linecap="round" />
24
+ <path d="M 40 55 L 40 30" stroke="#00E5FF" stroke-width="3" stroke-linecap="round" />
25
+
26
+ <!-- Top Node -->
27
+ <circle cx="40" cy="22" r="14" fill="#0D1117" stroke="url(#pylan-grad)" stroke-width="4" filter="url(#glow)" />
28
+ <circle cx="40" cy="22" r="6" fill="#00E5FF" />
29
+
30
+ <!-- Left Bottom Node -->
31
+ <circle cx="15" cy="58" r="12" fill="#0D1117" stroke="#2979FF" stroke-width="3.5" />
32
+ <circle cx="15" cy="58" r="5" fill="#2979FF" />
33
+
34
+ <!-- Right Bottom Node -->
35
+ <circle cx="65" cy="58" r="12" fill="#0D1117" stroke="#7C4DFF" stroke-width="3.5" />
36
+ <circle cx="65" cy="58" r="5" fill="#7C4DFF" />
37
+
38
+ <!-- Pulse Ring -->
39
+ <circle cx="40" cy="22" r="19" fill="none" stroke="#00E5FF" stroke-width="1.5" opacity="0.4" stroke-dasharray="4 4" />
40
+ </g>
41
+
42
+ <!-- Typography -->
43
+ <g transform="translate(110, 62)">
44
+ <text font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="44" font-weight="800" fill="#FFFFFF" letter-spacing="0.5">
45
+ Py<tspan fill="url(#pylan-grad)">Lan</tspan>
46
+ </text>
47
+ <text x="145" y="-2" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="12" font-weight="600" fill="#00E5FF" letter-spacing="1.5" text-transform="uppercase">
48
+ LAN SHARE
49
+ </text>
50
+ </g>
51
+ </svg>
@@ -0,0 +1,18 @@
1
+ """PyLan - Fast, cross-platform local network file and data sharing.
2
+
3
+ PyLan provides peer discovery, framing protocols, and data transfer
4
+ mechanisms designed for local network environments. It operates both as an
5
+ extensible Python package and as a standalone command-line application or
6
+ graphical user interface.
7
+
8
+ Subpackages:
9
+ cli: Command-line interfaces for scanning, sending, and receiving.
10
+ core: Protocol framing, peer discovery engine, and data models.
11
+ ui: Flet desktop and web graphical user interface module.
12
+ """
13
+
14
+ __version__: str = "0.0.3"
15
+
16
+ __all__: list[str] = [
17
+ "__version__",
18
+ ]
@@ -0,0 +1,29 @@
1
+ """Main package entrypoint handling CLI vs GUI dispatch for PyLan."""
2
+
3
+ import sys
4
+
5
+
6
+ def main() -> None:
7
+ """Dispatch execution to GUI or CLI based on command-line arguments."""
8
+ if len(sys.argv) > 1 and sys.argv[1] == "gui":
9
+ sys.argv.pop(1)
10
+ from pathlib import Path
11
+
12
+ import flet as ft
13
+
14
+ from pylan.ui.app import main as ui_main
15
+
16
+ assets_dir = str(Path(__file__).parent / "ui" / "assets")
17
+ app_fn = getattr(ft, "app", None)
18
+ if callable(app_fn):
19
+ app_fn(target=ui_main, assets_dir=assets_dir)
20
+ else:
21
+ ft.run(ui_main, assets_dir=assets_dir)
22
+ else:
23
+ from pylan.cli.cli import cli
24
+
25
+ cli()
26
+
27
+
28
+ if __name__ == "__main__":
29
+ main()