1- ## Development and maintenance
1+ # Development and maintenance
22
33First install ` uv ` (e.g. ` pipx install uv ` ), then set up a dev environment with ` make venv ` , or equivalently:
44
@@ -18,9 +18,27 @@ With `make format-fix` the style and imports are autofixed (by `ruff`)
1818Features must be thoroughly covered in tests (have a look at ` tests/* ` to infer
1919naming convention and module structure).
2020
21- ### Running tests
21+ ## astrapy-repl
2222
23- #### Typical testing
23+ Astrapy comes with a REPL, a customized Python interactive shell, which pre-loads
24+ all relevant imports and comes with ` client ` and ` database ` objects instantiated and
25+ ready-to-use.
26+
27+ Just ensure you have defined the environment variable as you would need for testing (see below),
28+ or set them as command-line parameters. Start the shell with:
29+
30+ ```
31+ astrapy-repl
32+ ```
33+
34+ Try ` -h ` for more guidance on passing options. In a local development environment, you will
35+ have to launch it as ` uv run astrapy-repl ` .
36+
37+ ![ AstraPy, REPL screenshot] ( https://raw.githubusercontent.com/datastax/astrapy/main/pictures/astrapy_repl.png )
38+
39+ ## Running tests
40+
41+ ### Typical testing
2442
2543In most cases you want to run the "base" test suite (the one in the CI/CD automation) against either Astra DB or a local Data API + HCD.
2644
3048- Export variables as in the ` tests/env_templates/env.vectorize-minimal.template ` example.
3149- Run: ` uv venv --python ">=3.8<3.13" && uv run pytest tests/base `
3250
33- #### All available tests/targets
51+ ### All available tests/targets
3452
3553Tests are grouped in:
3654- "base", covering general-purpose astrapy functionality. Divided in unit/integration;
@@ -60,18 +78,18 @@ and comment the environment flag that suppresses them (see the base Astra env te
6078For non-Astra, the reranking-related tests run only if one sets
6179` HEADER_RERANKING_API_KEY_NVIDIA="AstraCS:<dev token...> ` (as shown in the Local/DockerCompose base env templates).
6280
63- #### Docker vs. Podman
81+ ### Docker vs. Podman
6482
6583In case you use a different Docker-compatible container runtime (e.g. ` podman ` ) and are running against the
6684"DockerCompose" target make sure to export the environment variable such as ` DOCKER_COMMAND_NAME="podman" `
6785to maek the test startup logic work properly.
6886
69- #### Keyspaces
87+ ### Keyspaces
7088
7189You shoud never need to worry about keyspaces. Tests use two keyspaces, which are created if not found, with default names.
7290The env templates show how to override those names, if you want to.
7391
74- #### Multiple Python versions
92+ ### Multiple Python versions
7593
7694If may be useful to run e.g. unit tests with multiple Python versions. You can have ` uv `
7795create more than one venv and specify the version, e.g. for each one:
@@ -89,7 +107,7 @@ assuming you activated a certain virtual env, you can run e.g.: `make format VEN
89107
90108** Warning: Python 3.13+ currently not supported to run integration tests! (but the package itself is all right).**
91109
92- #### Adding/changing dependencies
110+ ### Adding/changing dependencies
93111
94112After editing the ` pyproject.toml ` , make sure you run
95113
@@ -100,7 +118,7 @@ uv sync --dev
100118
101119and then commit the new ` uv.lock ` to the repo as well.
102120
103- #### Sample testing commands
121+ ### Sample testing commands
104122
105123Base:
106124
@@ -141,18 +159,18 @@ uv run pytest [...] -o log_cli=0
141159uv run pytest [...] -o log_cli=1 --log-cli-level=10
142160```
143161
144- ### Special tests
162+ ## Special tests
145163
146164The following are special provision to manage features under evolution or not
147165entirely deployed to all environments. Typically they require manually passing
148166certain environment variables, otherwise the associated tests are excluded from CI.
149167
150- #### Cutting-edge features on ` main `
168+ ### Cutting-edge features on ` main `
151169
152170Prepend tests with a ` ASTRAPY_TEST_LATEST_MAIN=y ` for features found on ` main ` that are not released anywhere.
153171_ (Tip: run a code search first to see what is currently marked as such. Chances are nothing is.)_
154172
155- ### Publish-and-release
173+ ## Publish-and-release
156174
157175Releasing a new version happens through the Github ` release ` workflow, which includes all necessary testing
158176plus a publish step to the test-PyPI.
0 commit comments