Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: update package metadata #3079

Merged
merged 4 commits into from
Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/actions/python_cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ runs:
with:
path: ${{ env.pythonLocation }}
# The cache will be rebuild every day and at every change of the dependency files
key: ${{ inputs.prefix }}-py${{ inputs.pythonVersion }}-${{ env.date }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/setup.cfg') }}-${{ hashFiles('**/pyproject.toml') }}
key: ${{ inputs.prefix }}-py${{ inputs.pythonVersion }}-${{ env.date }}-${{ hashFiles('**/pyproject.toml') }}

- name: Install dependencies
# NOTE: this action runs only on cache miss to refresh the dependencies and make sure the next Haystack install will be faster.
Expand All @@ -53,4 +53,4 @@ runs:
pip install .[all]
pip install rest_api/
pip install ui/
pip install torch-scatter -f https://data.pyg.org/whl/torch-1.12.0+cpu.html
pip install torch-scatter -f https://data.pyg.org/whl/torch-1.12.0+cpu.html
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repos:
#- id: pretty-format-json # indents and sorts JSON files # FIXME: JSON schema generator conflicts with this

- repo: https://github.com/psf/black
rev: 22.6.0 # IMPORTANT: keep this aligned with the black version in setup.cfg
rev: 22.6.0 # IMPORTANT: keep this aligned with the black version in pyproject.toml
hooks:
- id: black-jupyter

Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pip install --upgrade pip
# Install Haystack in editable mode
pip install -e '.[dev]'
```
Note that the `.[dev]` part is enough in many development scenarios when adding minor code fixes. However, if your changes require a schema change, then you'll need to install all dependencies with `pip install -e '.[all]' ` command. Introducing new components or changing their interface requires a schema change.
Note that the `.[dev]` part is enough in many development scenarios when adding minor code fixes. However, if your changes require a schema change, then you'll need to install all dependencies with `pip install -e '.[all]' ` command. Introducing new components or changing their interface requires a schema change.
This will install all the dependencies you need to work on the codebase, plus testing and formatting dependencies.

Last, install the pre-commit hooks with:
Expand Down Expand Up @@ -287,7 +287,7 @@ You can run it with `python -m black .` from the root folder.

### Mypy

Mypy currently runs with limited configuration options that can be found at the bottom of `setup.cfg`.
Mypy currently runs with limited configuration options that can be found at the bottom of `pyproject.toml`.

You can run it with `python -m mypy haystack/ rest_api/ ui/` from the root folder.

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ RUN wget --no-check-certificate https://dl.xpdfreader.com/xpdf-tools-linux-4.04.
# Copy Haystack code
COPY haystack /home/user/haystack/
# Copy package files & models
COPY setup.py setup.cfg pyproject.toml VERSION.txt LICENSE README.md models* /home/user/
COPY pyproject.toml VERSION.txt LICENSE README.md models* /home/user/
# Copy REST API code
COPY rest_api /home/user/rest_api/

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-GPU
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
# Copy Haystack code
COPY haystack /home/user/haystack/
# Copy package files & models
COPY setup.py setup.cfg pyproject.toml VERSION.txt LICENSE README.md models* /home/user/
COPY pyproject.toml VERSION.txt LICENSE README.md models* /home/user/
# Copy REST API code
COPY rest_api /home/user/rest_api/

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-GPU-minimal
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ RUN apt-get update && apt-get install -y software-properties-common && \
| tar -xvzf - -C /usr/local/bin --strip-components=2 xpdf-tools-linux-4.04/bin64/pdftotext

# Copy Haystack package files but not the source code
COPY setup.py setup.cfg pyproject.toml VERSION.txt LICENSE README.md /home/user/
COPY pyproject.toml VERSION.txt LICENSE README.md /home/user/

# Install all the dependencies, including ocr component
RUN pip3 install --upgrade --no-cache-dir pip && \
Expand Down
23 changes: 11 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</a>
<a href="https://twitter.com/intent/follow?screen_name=deepset_ai">
<img alt="Twitter" src="https://img.shields.io/twitter/follow/deepset_ai?style=social">
</a>
</a>
</p>

Haystack is an end-to-end framework that enables you to build powerful and production-ready pipelines for different search use cases.
Expand Down Expand Up @@ -99,7 +99,7 @@ If you cannot upgrade `pip` to version 21.3 or higher, you will need to replace:
- `'.[all]'` with `'.[sql,only-faiss,only-milvus1,weaviate,graphdb,crawler,preprocessing,ocr,onnx,ray,dev]'`
- `'.[all-gpu]'` with `'.[sql,only-faiss-gpu,only-milvus1,weaviate,graphdb,crawler,preprocessing,ocr,onnx-gpu,ray,dev]'`

For an complete list of the dependency groups available, have a look at the `haystack/setup.cfg` file.
For an complete list of the dependency groups available, have a look at the `haystack/pyproject.toml` file.

To install the REST API and UI, run the following from the root directory of the Haystack repo

Expand Down Expand Up @@ -130,15 +130,15 @@ GRPC_PYTHON_BUILD_SYSTEM_ZLIB=true pip install git+https://github.com/deepset-ai

**5. Learn More**

See our [installation guide](https://haystack.deepset.ai/overview/get-started) for more options.
You can find out more about our PyPi package on our [PyPi page](https://pypi.org/project/farm-haystack/).
See our [installation guide](https://haystack.deepset.ai/overview/get-started) for more options.
You can find out more about our PyPi package on our [PyPi page](https://pypi.org/project/farm-haystack/).

## :mortar_board: Tutorials

![image](https://raw.githubusercontent.com/deepset-ai/haystack/master/docs/img/concepts_haystack_handdrawn.png)

Follow our [introductory tutorial](https://haystack.deepset.ai/tutorials/first-qa-system)
to setup a question answering system using Python and start performing queries!
Follow our [introductory tutorial](https://haystack.deepset.ai/tutorials/first-qa-system)
to setup a question answering system using Python and start performing queries!
Explore the rest of our tutorials to learn how to tweak pipelines, train models and perform evaluation.

- Tutorial 1 - Basic QA Pipeline: [Jupyter notebook](https://github.com/deepset-ai/haystack/blob/master/tutorials/Tutorial1_Basic_QA_Pipeline.ipynb)
Expand Down Expand Up @@ -251,7 +251,7 @@ Explore the rest of our tutorials to learn how to tweak pipelines, train models
**Hosted**

Try out our hosted [Explore The World](https://haystack-demo.deepset.ai/) live demo here!
Ask any question on countries or capital cities and let Haystack return the answers to you.
Ask any question on countries or capital cities and let Haystack return the answers to you.

**Local**

Expand Down Expand Up @@ -280,7 +280,7 @@ With this you can begin calling it directly via the REST API or even interact wi
cd haystack
docker-compose pull
docker-compose up

# Or on a GPU machine: docker-compose -f docker-compose-gpu.yml up
```

Expand Down Expand Up @@ -318,15 +318,15 @@ Please note that the demo will [publish](https://docs.docker.com/config/containe
There is a very vibrant and active community around Haystack which we are regularly interacting with!
If you have a feature request or a bug report, feel free to open an [issue in Github](https://github.com/deepset-ai/haystack/issues).
We regularly check these and you can expect a quick response.
If you'd like to discuss a topic, or get more general advice on how to make Haystack work for your project,
If you'd like to discuss a topic, or get more general advice on how to make Haystack work for your project,
you can start a thread in [Github Discussions](https://github.com/deepset-ai/haystack/discussions) or our [Discord channel](https://haystack.deepset.ai/community/join).
We also check [Twitter](https://twitter.com/deepset_ai) and [Stack Overflow](https://stackoverflow.com/questions/tagged/haystack).


## :heart: Contributing

We are very open to the community's contributions - be it a quick fix of a typo, or a completely new feature!
You don't need to be a Haystack expert to provide meaningful improvements.
We are very open to the community's contributions - be it a quick fix of a typo, or a completely new feature!
You don't need to be a Haystack expert to provide meaningful improvements.
To learn how to get started, check out our [Contributor Guidelines](https://github.com/deepset-ai/haystack/blob/master/CONTRIBUTING.md) first.
You can also find instructions to run the tests locally there.

Expand All @@ -348,4 +348,3 @@ Here's a list of organizations who use Haystack. Don't hesitate to send a PR to
- [Etalab](https://www.etalab.gouv.fr/)
- [Infineon](https://www.infineon.com/)
- [Sooth.ai](https://sooth.ai/)

5 changes: 3 additions & 2 deletions haystack/utils/import_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
def safe_import(import_path: str, classname: str, dep_group: str):
"""
Method that allows the import of nodes that depend on missing dependencies.
These nodes can be installed one by one with extras_require (see setup.cfg)
but they need to be all imported in their respective package's __init__()
These nodes can be installed one by one with project.optional-dependencies
(see pyproject.toml) but they need to be all imported in their respective
package's __init__()

Therefore, in case of an ImportError, the class to import is replaced by
a hollow MissingDependency function, which will throw an error when
Expand Down
Loading