Metadata-Version: 2.4
Name: cnlab
Version: 0.1.0
Summary: Write standalone Python computer networks lab programs by ID.
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# Computer networks lab programs

Install with `python -m pip install cnlab`. Requires Python 3.9 or later.

```python
import cnlab

cnlab.crc()                     # writes crc/crc.py
cnlab.dns()                     # writes dns/server.py and dns/client.py
cnlab.write("udpchat", "chat")  # writes chat/chat_a.py and chat/chat_b.py
```

Each function returns a list of pathlib.Path objects. The optional argument is the exact output directory. Existing identical files can be reused. A file with different contents raises FileExistsError. The scripts are bundled and can be exported offline.

| Function or ID | Files in the output directory |
| --- | --- |
| distancevector | distancevector.py |
| crc | crc.py |
| dns, tcpsensor, tcporder, tcpfile | server.py and client.py for each lab |
| tcphttp | tcphttp.py |
| udpchat | chat_a.py and chat_b.py |
| arprarp | server.py and client.py |

For client/server labs, open two terminals and run the server first, then the client. For udpchat, start chat_b.py first. The tcphttp exercise connects to example.com. The arprarp exercise simulates lookups in a static table over localhost TCP.

## Publish directly to PyPI

The project archive includes a prebuilt wheel and source distribution in dist/. Open a terminal in the folder containing pyproject.toml and run:

```sh
python -m pip install --upgrade twine
python -m twine check dist/*
python -m twine upload --repository pypi --username __token__ dist/*
```

Enter your PyPI token at the hidden prompt. For a first release of a new project, use a token with account-wide scope. For later releases, increment the version in pyproject.toml and move previous distributions out of dist/ before building:

```sh
python -m pip install --upgrade build
python -m build
```
