Skip to content

Commit 0b2f542

Browse files
committed
document how to use development mode
1 parent 146569e commit 0b2f542

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

README.md

+46
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,52 @@ If `--no-compile` is NOT used, the precompiled bytecode cache may cause errors s
828828

829829
This is a common issue when using macro expanders in Python.
830830

831+
### Development mode (for developing `unpythonic` itself)
832+
833+
Starting with v0.15.5, `unpythonic` uses [PDM](https://pdm-project.org/en/latest/) to manage its dependencies. This allows easy installation of a development copy into an isolated venv (virtual environment), allowing you to break things without breaking anything else on your system (including apps and libraries that use an installed copy of `unpythonic`).
834+
835+
#### Install PDM in your Python environment
836+
837+
To develop `unpythonic`, if your Python environment does not have PDM, you will need to install it first:
838+
839+
```bash
840+
python -m pip install pdm
841+
```
842+
843+
Don't worry; it won't break `pip`, `poetry`, or other similar tools.
844+
845+
We will also need a Python for PDM venvs. This Python is independent of the Python that PDM itself runs on. It is the version of Python you would like to use for developing `unpythonic`.
846+
847+
For example, we can make Python 3.10 available with the command:
848+
849+
```bash
850+
pdm python install 3.10
851+
```
852+
853+
Specifying just a version number defaults to CPython (the usual Python implementation). If you want PyPy instead, you can use e.g. `[email protected]`.
854+
855+
#### Install the isolated venv
856+
857+
Now, we will auto-create the development venv, and install `unpythonic`'s dependencies into it. In a terminal that sees your Python environment, navigate to the `unpythonic` folder, and issue the command:
858+
859+
```bash
860+
pdm install
861+
```
862+
863+
This creates the development venv into the `.venv` hidden subfolder of the `unpythonic` folder.
864+
865+
If you are a seasoned pythonista, note that there is no `requirements.txt`; the dependency list lives in `pyproject.toml`.
866+
867+
#### Develop
868+
869+
To activate the development venv, in a terminal that sees your Python environment, navigate to the `unpythonic` folder, and issue the command:
870+
871+
```bash
872+
$(pdm venv activate)
873+
```
874+
875+
Note the Bash exec syntax `$(...)`; the command `pdm venv activate` just prints the actual internal activation command.
876+
831877
### Uninstall
832878

833879
```bash

0 commit comments

Comments
 (0)