Skip to main content

Nyx Client SDK

Version License Build Read The Docs GitHub Repo stars Discord

🌟 Nyx Client SDK offers a simple API for interacting with data in your Nyx network. Subscribe, search and download data from across your federated network with ease, or if you're a publisher, easily created, update, or delete your existing data products programmatically!

If you're looking for an out of the box experience, try installing nyx-extras, to seamlessly and quickly build powerful AI applications, to interact with data from your Nyx network!

https://iotics.com

🚧 Status

The Nyx ecosystem is at an early stage of its development, please give us feedback through the Github issues.

What is the Nyx Client SDK

The Nyx Client SDK is a Python library that provides an API for easy interaction with the Nyx Platform. It enables end users to seamlessly connect their data to the Nyx ecosystem, search for data, subscribe to it, and consume it. With this SDK, users can ultimately build powerful AI applications.

Several examples of SDK usage in an AI context are available:

See also What is Nyx

🔥 Quick Start

Installation

The Nyx Client SDK is available on PyPI and can be installed via pip running the following command.

pip install nyx-client

First time set up

Once the library is installed you can run nyx-client init to generate the .env file. You'll be asked to provide your Nyx username, password and Nyx endpoint.

Example output
NYX_URL=<ENTER URL>
NYX_EMAIL=<ENTER EMAIL>
NYX_PASSWORD=<ENTER PASSWORD>

As a data producer

I want to connect my Data

from nyx_client import NyxClient

client = NyxClient()
client.create_data(
    name="MyData1",
    title="My Data #1",
    description="The description of the data #1",
    size=1080,
    genre="ai",
    categories=["cat1", "cat2", "cat3"],
    download_url="http://storage/dataset1.csv",
    content_type="text/csv",
    lang="fr",
    preview="col1, col2, col3\naaa, bbb, ccc",
    license_url="https://opensource.org/licenses/MIT",
)

I want to share data using the instance's storage to upload

from nyx_client import NyxClient

client = NyxClient()

# Open in binary mode with 'b', optionally
# you can supply and encoding if required
with open("somefile.csv", 'rb') as infile:
  client.create_data(
      name="MyData1",
      title="My Data #1",
      description="The description of the data #1",
      size=1080,
      genre="ai",
      categories=["cat1", "cat2", "cat3"],
      file=infile,
      content_type="text/csv",
      lang="fr",
      preview="col1, col2, col3\naaa, bbb, ccc",
      license_url="https://opensource.org/licenses/MIT",
  )

I want to delete/disconnect my Data

from nyx_client import NyxClient

client = NyxClient()
client.delete_data_by_name(name="MyData1")

As an application builder

I want to subscribe to some data

from nyx_client import NyxClient

client = NyxClient()
found_data = client.get_data(categories[genre="ai", categories=["cat1", "cat"], content_type="text/csv"])
for data in found_data:
  client.subscribe(data)

I want to consume the data

from nyx_client import NyxClient

client = NyxClient()
subscribed_data = client.my_subscriptions()
for data in subscribed_data:
  print(f"Downloading data {data.name}")
  content = data.as_string() # NOTE: If this is a binary file, use as_bytes() instead.

👉 Gotchas

  • If the Data has been deleted/disconnected from Nyx, the SDK will no longer be able to access it. Ensure that the data is still available.

The Nyx ecosystem is at an early stage of its development, please give us feedback through Github issues.

  • If you get the SSL error httpcore.ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate

then it may be that you need to set some environment variables like this before running your script:

CERT_PATH=$(python -m certifi)
export SSL_CERT_FILE=${CERT_PATH}
export REQUESTS_CA_BUNDLE=${CERT_PATH}

🐞 Troubleshooting

If you encounter any issues, ensure that:

  • Your virtual environment is activated.
  • All required dependencies are installed.
  • Environment variables are set correctly.
  • If an issue persists, check the Issues section on github

For further assistance:

🤝 Contributing

We welcome contributions! Please see our CONTRIBUTING.md for guidelines.

⚖️ Terms and conditions

https://www.get-nyx.io/terms

Metadata

Release files for nyx-client 0.2.5

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

Source distribution (sdist)

Source distribution for nyx-client 0.2.5
File Size Uploaded
nyx_client-0.2.5.tar.gz 18.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nyx-client 0.2.5
File Interpreter ABI Platform
nyx_client-0.2.5-py3-none-any.whl Python 3 none any Details

Total release size: 41.2 kB

Release files / nyx_client-0.2.5.tar.gz

Download URL nyx_client-0.2.5.tar.gz
Size 18.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f206ad2afe70e9185566c466406f8765ab0c9509cb9c074a5227daeaac379f8d
BLAKE2b-256 checksum
How to use checksums
86f9bb94767666404c7136965af91e2b9d1abe5e6256f1f4d7c7ab2f19e2f281
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 5, 2024.

Transparency log

Release files / nyx_client-0.2.5-py3-none-any.whl

Download URL nyx_client-0.2.5-py3-none-any.whl
Size 22.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
413155deabb87b0bfff96d0bf9e1195a448f0af68bba8534d615dbbe160d0d11
BLAKE2b-256 checksum
How to use checksums
e60647e13ca0e3b28068269c39f04845715a23bb9d078b220f403522851e0274
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 5, 2024.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.5 This release

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.16

2 release files

0.0.15

2 release files

0.0.14

2 release files

0.0.13

2 release files

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