Skip to content

Conversation

FranklinBarto
Copy link

@FranklinBarto FranklinBarto commented Jul 10, 2025

Reason for this pull request

...

The documentation on the opendatacube website instructs users to install test dependencies using:

pip install --upgrade -e '.[test]'

However, the pyproject.toml file does not define the test. The following intergration tests section will fail

Proposed changes

  • Add missing test = [...] group under [project.optional-dependencies] in pyproject.toml to ensure test dependencies are installed.

  • Closes #xxxx

  • Tests added / passed

  • Pull Request Title will make sense in ODC Release Notes


📚 Documentation preview 📚: https://opendatacube--2029.org.readthedocs.build/en/2029/

@pjonsson
Copy link
Contributor

pjonsson commented Jul 10, 2025

Thank you for your contribution.

Unfortunately it's the documentation that is lagging behind the code, the easiest way to run the tests right now is probably through docker compose which is what the CI uses:

export LOCAL_UID=$(id -u $USER)
export LOCAL_GID=$(id -g $USER)
docker compose up --quiet-pull --wait -d
docker compose exec --user ubuntu -T core /bin/bash --login -c \
"source /app/bin/activate && \
rio --show-versions && \
pytest -r a \
--cov datacube \
--cov-report=xml \
--doctest-ignore-import-errors \
--durations=5 \
datacube \
tests \
integration_tests"
docker compose down

I only use the docker image, but if you want to run things locally, I think uv run pytest <parameters> will do the trick.

Edit: if your use-case is for regular use of the package rather than developing datacube-core itself, what I just wrote isn't relevant. I'm guessing you want pip install --upgrade -e . --group dev, but the support for dependency groups requires a really modern pip.

@FranklinBarto
Copy link
Author

I prefer to keep away from using docker in this instance as I already have a dedicated vm to host the datacube and it is long term, Ive had it for 3 years now. I found that this simple addition brings the website back in sync with my environment. In my case I was following the documentation from the https://opendatacube.readthedocs.io/en/latest/installation/setup/ubuntu.html. Adding test means I can just run the code as is on the website. i.e 'pip install --upgrade -e '.[test]'

@SpacemanPaul
Copy link
Contributor

SpacemanPaul commented Jul 11, 2025

Thanks Franklin. There was a commit in #2027 which I just merged which updates the README to advise running pip install --upgrade -e . --group dev before attempting to run integration tests (instead of .[test] which as you and @pjonsson note above no longer works).

The dev dependency group includes everything needed to run tests AND everything needed to run the various code checks.

Do you have a use case for being able to run integration tests in an environment that should not be cluttered with the various code check and type stub libraries?

@FranklinBarto
Copy link
Author

FranklinBarto commented Jul 11, 2025

Hey SpacemanPaul,

The core issue seems to be a mismatch between the Open Data Cube documentation and the current codebase. Ideally, updating the website would be the simplest fix, but I'm unsure if it's open to public contributions.

My suggestion for adding the test dependency was a workaround to address the documentation gap, even though I agree it creates some unnecessary clutter. I believe accurate documentation is more critical than a clean dependency list in this case.

Edit: I noticed the line pip install --upgrade -e '.[test]' is also referenced in the latest README

datacube-core/README.rst

Lines 82 to 95 in b04cccf

5. Run unit tests + PyLint
Install test dependencies using:
``pip install --upgrade -e '.[test]'``
If install for these fails, please lodge them as issues.
Run unit tests with:
``./check-code.sh``
(this script approximates what is run by GitHub Actions. You can
alternatively run ``pytest`` yourself).

@SpacemanPaul
Copy link
Contributor

Thanks for spotting that. I will update shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants