Skip to main content

PyGorse

CI

Python SDK for gorse recommender system.

Install

  • Install from PyPI:
pip install PyGorse
  • Install from source:
git clone https://github.com/gorse-io/PyGorse.git
cd PyGorse
pip install .

Usage

Create a client by the entrypoint and api key.

from gorse import Gorse

client = Gorse('http://127.0.0.1:8087', 'api_key')

# Insert a user
client.insert_user({
    'UserId': 'bob',
    'Labels': {
        'gender': 'M',
        'age': 24
    },
    'Comment': 'my user'
})

# Insert items
client.insert_item({
    'ItemId': 'vuejs:vue',
    'IsHidden': False,
    'Labels': {
        'language': 'JavaScript'
    },
    'Categories': ['framework'],
    'Timestamp': '2022-02-24T00:00:00Z',
    'Comment': 'Vue.js framework'
})

# Insert feedbacks
client.insert_feedbacks([
    { 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'vuejs:vue', 'Timestamp': '2022-02-24T00:00:00Z' },
    { 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'd3:d3', 'Timestamp': '2022-02-25T00:00:00Z' },
    { 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'dogfalo:materialize', 'Timestamp': '2022-02-26T00:00:00Z' },
    { 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'mozilla:pdf.js', 'Timestamp': '2022-02-27T00:00:00Z' },
    { 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'moment:moment', 'Timestamp': '2022-02-28T00:00:00Z' }
])

# Get recommendation
client.get_recommend('bob', n=10)

The Python SDK implements the async client as well:

from gorse import AsyncGorse

client = AsyncGorse('http://127.0.0.1:8087', 'api_key')

# Insert a user
await client.insert_user({
    'UserId': 'bob',
    'Labels': {
        'gender': 'M',
        'age': 24
    },
    'Comment': 'my user'
})

# Insert items
await client.insert_item({
    'ItemId': 'vuejs:vue',
    'IsHidden': False,
    'Labels': {
        'language': 'JavaScript'
    },
    'Categories': ['framework'],
    'Timestamp': '2022-02-24T00:00:00Z',
    'Comment': 'Vue.js framework'
})

# Insert feedbacks
await client.insert_feedbacks([
    { 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'vuejs:vue', 'Timestamp': '2022-02-24T00:00:00Z' },
    { 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'd3:d3', 'Timestamp': '2022-02-25T00:00:00Z' },
    { 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'dogfalo:materialize', 'Timestamp': '2022-02-26T00:00:00Z' },
    { 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'mozilla:pdf.js', 'Timestamp': '2022-02-27T00:00:00Z' },
    { 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'moment:moment', 'Timestamp': '2022-02-28T00:00:00Z' }
])

# Get recommendation
await client.get_recommend('bob', n=10)

Metadata

Release files for PyGorse 0.5.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 PyGorse 0.5.1
File Size Uploaded Provenance Actions
pygorse-0.5.1.tar.gz 9.3 kB Without provenance Details for pygorse-0.5.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for PyGorse 0.5.1
File Interpreter ABI Platform Actions
pygorse-0.5.1-py3-none-any.whl Python 3 none any Details for pygorse-0.5.1-py3-none-any.whl

Total release size: 17.7 kB

Release files / pygorse-0.5.1.tar.gz

Download URL pygorse-0.5.1.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6dbeb242fba8cbbc89c4de425fa619933830f4ba4dbba18e82dbc3c059cbbce3
BLAKE2b-256 checksum
How to use checksums
f618d33b977b74657dd709f6ce3385b6c4c1d809a59f4a18386c39c3cb3888bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Release files / pygorse-0.5.1-py3-none-any.whl

Download URL pygorse-0.5.1-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3f28709a9d959dc28f54b7149dfeb619c4c912fd8972be72d2dfb3502411c106
BLAKE2b-256 checksum
How to use checksums
2cdd84d50653d7111f269c1b3c817d689fd36da92d15ccb14e736125755f202f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Security for PyGorse 0.5.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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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