mmmmxa commented on code in PR #3825: URL: https://github.com/apache/iggy/pull/3825#discussion_r3735245389
########## foreign/python/README.md: ########## @@ -38,33 +39,111 @@ pip install apache-iggy ### Local Development -```bash -# Start server for testing using docker -docker compose -f docker-compose.test.yml up --build - -# Or use cargo -cargo run --bin iggy-server -- --with-default-root-credentials --fresh - -# Using uv: -uv sync --all-extras -uv run maturin develop -uv run pytest tests/ -v # Run tests (requires iggy-server running) - -# Using pip: -python3 -m venv .venv -source .venv/bin/activate -pip install -e ".[all]" -maturin develop -pytest tests/ -v # Run tests (requires iggy-server running) -``` +1. Build a project for development + + With `uv`: + + > Create a venv: Review Comment: The intention to keep these separate was to make it easier for the readers of the rendered file to copy the commands by clicking the button to copy the code in the code block. I find copying and pasting from a bigger block much less convenient. About the blockquotes -- that was a problem with linted which messed up enumeration in the file because it considered enumeration to be separate and put all 1's instead of enumeration I wanted. I have applied the changes you requested in order to get this PR through quicker, but if you agree with my idea about ease of copying, I'd return it back. If you don't have time for this -- let's just move on and leave it at that. ########## foreign/python/README.md: ########## @@ -38,33 +39,111 @@ pip install apache-iggy ### Local Development -```bash -# Start server for testing using docker -docker compose -f docker-compose.test.yml up --build - -# Or use cargo -cargo run --bin iggy-server -- --with-default-root-credentials --fresh - -# Using uv: -uv sync --all-extras -uv run maturin develop -uv run pytest tests/ -v # Run tests (requires iggy-server running) - -# Using pip: -python3 -m venv .venv -source .venv/bin/activate -pip install -e ".[all]" -maturin develop -pytest tests/ -v # Run tests (requires iggy-server running) -``` +1. Build a project for development + + With `uv`: + + > Create a venv: + > + > ```bash + > uv venv + > ``` + > + > Sync the environment without updating it: + > + > ```bash + > uv sync --frozen --all-extras --no-install-project + > ``` + > + > Build the project - this runs cargo build and performs an editable install: + > + > ```bash + > uv run maturin develop + > ``` + + With `pip`: + + > Create a venv: + > + > ```bash + > python3 -m venv .venv + > ``` + > + > Activate the venv: + > + > ```bash + > source .venv/bin/activate + > ``` + > + > Install the dependencies with `pip`: + > + > ```bash + > pip install -e ".[all]" + > ``` + +2. Run the server to be able to run the tests + + ```bash + cargo run --bin iggy-server -- --with-default-root-credentials --fresh + ``` + +3. Run the tests + + `uv`: + + ```bash + uv run --no-sync pytest tests/ -v + ``` + + `pip`: + + ```bash + pytest tests/ -v # make sure iggy-server is running and the venv is activated + ``` + +4. To update the stubs, use + + ```bash + cargo run --bin stub_gen + ``` + +5. Before committing, test the pre-commit and pre-push hooks. `prek` only inspects staged content, so stage your work first: + + ```bash + git add -A + prek run # runs pre-commit hooks + prek run --hook-stage pre-push + ``` + + These are some of the essential commands prek is running, so it's recommended to run them manually before running prek / committing / pushing. This list is not exhaustive and other hook failures are possible. + + ```bash + ruff format . + ``` + + ```bash + ruff check --fix . + ``` + + ```bash + cargo fmt --all + ``` + + ```bash + cargo clippy --all-targets --all-features -- -D warnings + ``` + + ```bash + ./scripts/ci/markdownlint.sh --fix # read the diff after applying this, sometimes it gives unwanted results, e.g. messing up enumerations + ``` ## Examples Refer to the [examples/python/](https://github.com/apache/iggy/tree/master/examples/python) directory for usage examples. ## Contributing -See [CONTRIBUTING.md](https://github.com/apache/iggy/blob/master/foreign/python/CONTRIBUTING.md) for development setup and guidelines. +See [CONTRIBUTING.md](https://github.com/apache/iggy/blob/master/CONTRIBUTING.md) for development setup and guidelines. Review Comment: done -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
