Skip to main content

# Suggestive

Magically add auto-complete to your python project.

Suggestive is a very simple python library that allows you to easily add the auto-complete feature to your project. It works for any kind of python project, even if it’s not web based.

## Talk is cheap show me the code

Well, usually you have follow two steps to get your auto-complete running properly. First, you need to index things, then you can search for them. Let’s see examples for both steps separately.

### Indexing `python >>> data = [ ... {"id": 0, "name": "Lincoln", "score": 123}, ... {"id": 1, "name": "Livia", "score": 12345}, ... {"id": 5, "name": "Linus", "score": 123456}, # Rita's brother! :) ... ] >>> import redis >>> from suggestive import Suggestive, RedisBackend >>> s = Suggestive('names', RedisBackend(conn=redis.StrictRedis())) >>> s.index(data, field='name') `

That’s it. Your data is cached inside of redis.

### Querying

Things are fairly easier in this step. You just need to setup the suggestive instance and use the suggest method:

`python >>> import redis >>> from suggestive import Suggestive, RedisBackend >>> s = Suggestive('names', RedisBackend(conn=redis.StrictRedis())) >>> s.suggest('lin') [{u'score': 123456, u'id': 5, u'name': u'Linus'}, {u'score': 123, u'id': 0, u'name': u'Lincoln'}] `

### Outro

Our API is not pretty stable yet, the way we choose the pass the backend instance to the Suggestive instance will be changed to use a uri. But we will definitely keep the compatibility with this version, since it makes things way easier when writing tests.

There are some very simple things that we’re not doing either, like adding limit and offset parameters to the suggest() method. We’re planning to add this feature and some others as soon as the rest of the code gets more stable.

Metadata

Release files for suggestive 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for suggestive 0.2.1
File Size Uploaded Provenance
suggestive-0.2.1.tar.gz 5.5 kB Without provenance Details

Release files / suggestive-0.2.1.tar.gz

Download URL suggestive-0.2.1.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b24e4b3841bc3d32a39e90c8d7ab3386961093fec561d92a475a59668bb51adb
BLAKE2b-256 checksum
How to use checksums
802683951aa9b5f7244a9491bb0d0048ebe8060c3f37eba5c8f6edc3b569bd88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for suggestive 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.2.1 This release

1 release file No provenance

0.0.1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page