Skip to main content

A custom Haystack component that uppercases text

Project description

Custom Component Template

A template repository for creating custom Haystack components and publishing them as standalone Python packages.

For more details, see the Haystack documentation on creating custom components and creating custom document stores.

How to use this template

  1. Click Use this template to create a new repository.

  2. Rename the package directory from src/haystack_integrations/components/example/ to match your integration. See Namespace convention below for the correct path.

  3. Update pyproject.toml — search for TODO comments and replace:

    • name: your package name, following the <technology>-haystack convention (e.g. opensearch-haystack)
    • description, authors, keywords, project.urls
    • dependencies: add your integration-specific dependencies
    • tool.hatch.version.raw-options: if you renamed directories, the version path is still derived from git tags so no change is needed here
  4. Add your component code in the renamed directory and export your classes from __init__.py.

  5. Add tests in tests/ — see the skeleton in tests/test_example.py.

  6. Search for all TODO comments across the project and address them.

Namespace convention

Haystack integrations use the haystack_integrations namespace package. The directory structure under src/ determines the import path for your component.

Components (converters, embedders, generators, rankers, etc.) use:

src/haystack_integrations/components/<type>/<name>/

Import path: from haystack_integrations.components.<type>.<name> import MyComponent

Common component types: converters, embedders, generators, rankers, retrievers, connectors, tools, websearch

Document stores use a separate namespace:

src/haystack_integrations/document_stores/<name>/

Import path: from haystack_integrations.document_stores.<name> import MyDocumentStore

Development

This project uses Hatch for build and environment management.

# Install Hatch
pip install hatch

# Format and lint
hatch run fmt        # auto-fix
hatch run fmt-check  # check only

# Run tests
hatch run test:unit         # unit tests only
hatch run test:integration  # integration tests only
hatch run test:all          # all tests
hatch run test:cov          # with coverage

Publishing to PyPI

This template includes a GitHub Actions workflow that publishes your package to PyPI when you push a version tag.

  1. Add a PYPI_API_TOKEN secret to your repository settings (Settings > Secrets and variables > Actions).

  2. Create a version tag and push it:

    git tag v0.1.0
    git push origin v0.1.0
    

The release workflow will build and publish the package automatically.

License

Apache-2.0 - See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uppercaser_haystack-1.0.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uppercaser_haystack-1.0.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file uppercaser_haystack-1.0.0.tar.gz.

File metadata

  • Download URL: uppercaser_haystack-1.0.0.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.5 cpython/3.13.12 HTTPX/0.28.1

File hashes

Hashes for uppercaser_haystack-1.0.0.tar.gz
Algorithm Hash digest
SHA256 1b3cc5c17367f102cc588af025390aa0cabbce5ade9d63efa78bc8d0311c0cd1
MD5 634f7700992c69b8a8d5be897e90aa2f
BLAKE2b-256 88241d3d4c0bae31783c24fdb618bc0f155729bd909267399472e616edfb6015

See more details on using hashes here.

File details

Details for the file uppercaser_haystack-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for uppercaser_haystack-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f492d75c334e9044cf1239be71e9d9a213e21cd30b469ad97b41a67deb877710
MD5 2ae979d38eeec614889c7a49d8d59b20
BLAKE2b-256 a8250ee98a2290c2a60d40c5eedf8cb08175d7a0d76d02bae2d730b36a9a6e75

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page