diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e0ba3d0368..08bd09c43a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -194,29 +194,16 @@ $ hatch version #### Run the linter -Every time you change the code, it's a good practice to run the linter, that will ensure your code is well formatted -and the static checker is happy with the typing: +Every time you change the code, it's a good practice to format the code and perform linting (with automatic fixes): ```console -$ hatch run lint:all +$ hatch run fmt ``` -If you see Hatch reporting problems, you can try fixing them with: +To check for static type errors, run: ```console -$ hatch run lint:fmt -``` - -You can also run the code formatter and the static checker separated: - -```console -$ hatch run lint:style -``` - -and - -```console -$ hatch run lint:typing +$ hatch run test:types ``` #### Run the tests @@ -224,18 +211,23 @@ $ hatch run lint:typing It's important your tests pass before contributing code. To run all the tests locally: ```console -$ hatch run test +$ hatch run test:all ``` > [!IMPORTANT] The command above will run ALL the tests, including integration tests; some of those often need you to > run a certain service in background (e.g. a Vector Database) or provide credentials to external services (e.g. OpenAI) > in order to pass. -If you want to run only a portion of the tests, for example including integration tests, Hatch will happily take the -same options you would pass to `pytest` directly, in this case a marker with the option `-m`: +To run the unit tests only, run: + +```console +$ hatch run test:unit +``` + +For integration tests, run: ```console -$ hatch run test -m"not integration" +$ hatch run test:integration ``` #### Create a new integration diff --git a/README.md b/README.md index c76df70532..db505a15a6 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ For example, to run the tests suite for the Chroma document store, from the root ```sh $ cd integrations/chroma -$ hatch run test +$ hatch run test:all ``` Hatch will take care of setting up an isolated Python environment and run the tests. diff --git a/integrations/amazon_bedrock/README.md b/integrations/amazon_bedrock/README.md index 3a689ef3ba..4dcb1e0158 100644 --- a/integrations/amazon_bedrock/README.md +++ b/integrations/amazon_bedrock/README.md @@ -26,13 +26,18 @@ pip install hatch With `hatch` installed, to run all the tests: ``` -hatch run test +hatch run test:all ``` -> Note: there are no integration tests for this project. -To run the linters `ruff` and `mypy`: +To format your code and perform linting using Ruff (with automatic fixes), run: ``` -hatch run lint:all +hatch run fmt +``` + +To check for static type errors, run: + +```console +$ hatch run test:types ``` ## License diff --git a/integrations/amazon_sagemaker/README.md b/integrations/amazon_sagemaker/README.md index 3afbca4f21..f3ab44527e 100644 --- a/integrations/amazon_sagemaker/README.md +++ b/integrations/amazon_sagemaker/README.md @@ -26,7 +26,7 @@ pip install hatch With `hatch` installed, to run all the tests: ``` -hatch run test +hatch run test:all ``` > Note: You need to export your AWS credentials for Sagemaker integration tests to run (`AWS_ACCESS_KEY_ID` and @@ -39,12 +39,18 @@ hatch run test:unit To only run integration tests: ``` -hatch run test -m "integration" +hatch run test:integration ``` -To run the linters `ruff` and `mypy`: +To format your code and perform linting using Ruff (with automatic fixes), run: ``` -hatch run lint:all +hatch run fmt +``` + +To check for static type errors, run: + +```console +$ hatch run test:types ``` ## License diff --git a/integrations/anthropic/README.md b/integrations/anthropic/README.md index 2ed55d4af0..5fa2346e0f 100644 --- a/integrations/anthropic/README.md +++ b/integrations/anthropic/README.md @@ -27,13 +27,18 @@ pip install hatch With `hatch` installed, to run all the tests: ``` -hatch run test +hatch run test:all ``` -> Note: there are no integration tests for this project. -To run the linters `ruff` and `mypy`: +To format your code and perform linting using Ruff (with automatic fixes), run: ``` -hatch run lint:all +hatch run fmt +``` + +To check for static type errors, run: + +```console +$ hatch run test:types ``` ## Examples diff --git a/integrations/chroma/README.md b/integrations/chroma/README.md index c119208ea4..caab40d3bf 100644 --- a/integrations/chroma/README.md +++ b/integrations/chroma/README.md @@ -2,7 +2,7 @@ [![PyPI - Version](https://img.shields.io/pypi/v/chroma-haystack.svg)](https://pypi.org/project/chroma-haystack) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/chroma-haystack.svg)](https://pypi.org/project/chroma-haystack) -[![test](https://github.com/masci/chroma-haystack/actions/workflows/test.yml/badge.svg)](https://github.com/masci/chroma-haystack/actions/workflows/test.yml) +[![test](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/chroma.yml/badge.svg)](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/chroma.yml) ----- diff --git a/integrations/cohere/README.md b/integrations/cohere/README.md index ca3922615c..18de68b3ac 100644 --- a/integrations/cohere/README.md +++ b/integrations/cohere/README.md @@ -27,39 +27,30 @@ pip install hatch With `hatch` installed, to run all the tests: ``` -hatch run test +hatch run test:all ``` > Note: integration tests will be skipped unless the env var COHERE_API_KEY is set. The api key needs to be valid > in order to pass the tests. To only run unit tests: ``` -hatch run test -m"not integration" +hatch run test:unit ``` -To only run embedders tests: +For integration tests, run: ``` -hatch run test -m"embedders" +hatch run test:integration ``` -To only run generators tests: +To format your code and perform linting using Ruff (with automatic fixes), run: ``` -hatch run test -m"generators" +hatch run fmt ``` -To only run ranker tests: -``` -hatch run test -m"ranker" -``` +To check for static type errors, run: -Markers can be combined, for example you can run only integration tests for embedders with: -``` -hatch run test -m"integrations and embedders" -``` - -To run the linters `ruff` and `mypy`: -``` -hatch run lint:all +```console +$ hatch run test:types ``` ## License diff --git a/integrations/deepeval/README.md b/integrations/deepeval/README.md index bc8be43940..3fc3791a62 100644 --- a/integrations/deepeval/README.md +++ b/integrations/deepeval/README.md @@ -24,7 +24,7 @@ For more information about the deepeval evaluation framework, please refer to th ## Testing ```console -hatch run test +hatch run test:all ``` ## Examples diff --git a/integrations/elasticsearch/README.md b/integrations/elasticsearch/README.md index 9900f46b15..fa30e5bd5b 100644 --- a/integrations/elasticsearch/README.md +++ b/integrations/elasticsearch/README.md @@ -24,7 +24,7 @@ docker-compose up Then run tests: ```console -hatch run test +hatch run test:all ``` ## License diff --git a/integrations/google_vertex/README.md b/integrations/google_vertex/README.md index 17a445c029..0748df4e67 100644 --- a/integrations/google_vertex/README.md +++ b/integrations/google_vertex/README.md @@ -29,13 +29,19 @@ pip install hatch With `hatch` installed, to run all the tests: ``` -hatch run test +hatch run test:all ``` -To run the linters `ruff` and `mypy`: +To format your code and perform linting using Ruff (with automatic fixes), run: ``` -hatch run lint:all +hatch run fmt +``` + +To check for static type errors, run: + +```console +$ hatch run test:types ``` ## License diff --git a/integrations/langfuse/README.md b/integrations/langfuse/README.md index 5c0c9c619b..5d5beeafe0 100644 --- a/integrations/langfuse/README.md +++ b/integrations/langfuse/README.md @@ -111,12 +111,18 @@ pip install hatch With `hatch` installed, run all the tests: ``` -hatch run test +hatch run test:all ``` -Run the linters `ruff` and `mypy`: +To format your code and perform linting using Ruff (with automatic fixes), run: ``` -hatch run lint:all +hatch run fmt +``` + +To check for static type errors, run: + +```console +$ hatch run test:types ``` ## License diff --git a/integrations/mongodb_atlas/README.md b/integrations/mongodb_atlas/README.md index f305b99586..bc7dec3905 100644 --- a/integrations/mongodb_atlas/README.md +++ b/integrations/mongodb_atlas/README.md @@ -24,19 +24,26 @@ pip install mongodb-atlas-haystack pip install hatch ``` -To run the linters `ruff` and `mypy`: +To run all the tests: ``` -hatch run lint:all +hatch run test:all ``` -To run all the tests: +> Note: you need your own MongoDB Atlas account to run the tests: you can make one here: +> https://www.mongodb.com/cloud/atlas/register. Once you have it, export the connection string +> to the env var `MONGO_CONNECTION_STRING`. If you forget to do so, all the tests will be skipped. + +To format your code and perform linting using Ruff (with automatic fixes), run: +``` +hatch run fmt ``` -hatch run test + +To check for static type errors, run: + +```console +$ hatch run test:types ``` -Note: you need your own MongoDB Atlas account to run the tests: you can make one here: -https://www.mongodb.com/cloud/atlas/register. Once you have it, export the connection string -to the env var `MONGO_CONNECTION_STRING`. If you forget to do so, all the tests will be skipped. ## License diff --git a/integrations/nvidia/README.md b/integrations/nvidia/README.md index 897febebf0..d42a1db5af 100644 --- a/integrations/nvidia/README.md +++ b/integrations/nvidia/README.md @@ -29,7 +29,7 @@ pip install hatch With `hatch` installed, to run all the tests: ``` -hatch run test +hatch run test:all ``` > Note: integration tests will be skipped unless the env var NVIDIA_API_KEY is set. The api key needs to be valid @@ -41,10 +41,16 @@ To only run unit tests: hatch run test:unit ``` -To run the linters `ruff` and `mypy`: +To format your code and perform linting using Ruff (with automatic fixes), run: ``` -hatch run lint:all +hatch run fmt +``` + +To check for static type errors, run: + +```console +$ hatch run test:types ``` ## License diff --git a/integrations/ollama/README.md b/integrations/ollama/README.md index a8ec1d5264..c26d93d6b0 100644 --- a/integrations/ollama/README.md +++ b/integrations/ollama/README.md @@ -33,7 +33,7 @@ docker exec ollama ollama pull Then run tests: ```console -hatch run test +hatch run test:all ``` The default model used here is ``orca-mini`` for generation and ``nomic-embed-text`` for embeddings \ No newline at end of file diff --git a/integrations/opensearch/README.md b/integrations/opensearch/README.md index 40a2f8eaa7..b9f2e9a47c 100644 --- a/integrations/opensearch/README.md +++ b/integrations/opensearch/README.md @@ -24,7 +24,7 @@ docker-compose up Then run tests: ```console -hatch run test +hatch run test:all ``` ## License diff --git a/integrations/pgvector/README.md b/integrations/pgvector/README.md index 4859762f9d..d385253ec9 100644 --- a/integrations/pgvector/README.md +++ b/integrations/pgvector/README.md @@ -28,13 +28,7 @@ docker run -d -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgr then run the tests: ```console -hatch run test -``` - -To run the coverage report: - -```console -hatch run cov +hatch run test:all ``` ## License diff --git a/integrations/pinecone/README.md b/integrations/pinecone/README.md index bf48e1e66a..e5bb893774 100644 --- a/integrations/pinecone/README.md +++ b/integrations/pinecone/README.md @@ -16,7 +16,7 @@ pip install pinecone-haystack ## Testing ```console -hatch run test +hatch run test:all ``` ## License diff --git a/integrations/qdrant/README.md b/integrations/qdrant/README.md index 18bf5b7a89..5bd81d86c3 100644 --- a/integrations/qdrant/README.md +++ b/integrations/qdrant/README.md @@ -20,7 +20,7 @@ pip install qdrant-haystack The test suites use Qdrant's in-memory instance. No additional steps required. ```console -hatch run test +hatch run test:all ``` ## License diff --git a/integrations/ragas/README.md b/integrations/ragas/README.md index fd0dd43d40..c11495b7c2 100644 --- a/integrations/ragas/README.md +++ b/integrations/ragas/README.md @@ -24,7 +24,7 @@ For more information about the Ragas evaluation framework, please refer to their ## Testing ```console -hatch run test +hatch run test:all ``` ## Examples diff --git a/integrations/unstructured/README.md b/integrations/unstructured/README.md index db74c5306a..42346439b8 100644 --- a/integrations/unstructured/README.md +++ b/integrations/unstructured/README.md @@ -33,5 +33,5 @@ docker run -p 8000:8000 -d --rm --name unstructured-api quay.io/unstructured-io/ Then run tests: ```console -hatch run test +hatch run test:all ``` \ No newline at end of file diff --git a/integrations/weaviate/README.md b/integrations/weaviate/README.md index da956f53e6..ac0d6d050c 100644 --- a/integrations/weaviate/README.md +++ b/integrations/weaviate/README.md @@ -18,10 +18,8 @@ pip install weaviate-haystack ## Testing -TODO - ```console -hatch run test +hatch run test:all ``` ## License