Skip to main content




From now on, you will be able to easily control IPFS System with IPyFS (IPFS Python CLI).

License Package version Supported Python versions





IPFS RPC APIs Documnets: https://docs.ipfs.io/reference/kubo/rpc

Source Code: https://github.com/837477/IPyFS


IPyFS is a Python-based IPFS CLI.

The key features are:

  • Base: IPyFS is built based on IPFS RPC APIs.
  • Easy: It is designed to be easy to use and learn. You can simply refer to the IPFS RPC APIs document.

Requirements

Python 3.7+

IPyFS stands on the shoulders of giants:

It's so obvious! Since IPyFS is a Python-based IPFS CLI, IPFS Server must be running.

Installation

$ pip install ipyfs

Example

Simple IPyFS usage

from ipyfs import Files, Swarm  # + Etc.

# Host and port can be modified for each IPyFS controller.
files = Files(
    host="http://localhost",  # Set IPFS Daemon Host
    port=5001  # Set IPFS Daemon Port
)
swarm = Swarm(
    host="http://sample.ipyfs.com",  # Set IPFS Daemon Host
    port=7477  # Set IPFS Daemon Port
)

The parameters of the IPyFS module are designed to be almost identical to the parameters of the IPFS RPC APIs.

Example of NFT Metadata Upload

  • You can check it in the sample.py file.
"""
Example of NFT Metadata Upload
"""
from ipyfs import Files
import json


# You can customize the host and port on any controller.
files = Files(
    host="http://localhost",  # Set IPFS Daemon Host
    port=5001  # Set IPFS Daemon Port
)

# Read the file and upload it to IPFS.
with open("ipyfs.png", "rb") as f:
    files.write(
        path=f"/{f.name}",
        file=f,
        create=True
    )

# Get the information of the uploaded file.
info = files.stat('/ipyfs.png')

# Generate NFT metadata.
metadata = {
    "name": "Sample NFT",
    "description": "Sample NFT Description",
    "image": f"ipfs://{info['result']['Hash']}"
}

# Upload the NFT metadata to IPFS.
files.write(
    path="/metadata.json",
    file=json.dumps(metadata),
    create=True
)

IPyFS is basically the same as the parameters of IPFS RPC APIs.

Let's practice together !
If you want to list the file in your IPFS Daemon:

The document needs parameters arg / long / u.
Likewise, IPyFS can use the same parameters. (path / long / u)
However, they are not exactly the same. In RPC, most parameter names are used as arg.

This is not a good way.
Therefore, IPyFS has slightly changed parameter names to suit their functions.

Importantly, only the name has changed, the purpose of the parameter is the same.

from ipyfs import Files


files = Files(
    host="http://localhost",  # Set IPFS Daemon Host
    port=5001  # Set IPFS Daemon Port
)

result = files.ls(
    path="/",
    long=True
)
print(result)

If you want to know what each parameter is, please refer to the IPFS RPC API documentation.

Contributing

The following is a set of guidelines for contributing to sejong-univ-auth. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.

  1. Please create a branch in this format, <Issue Number>-<Some name>
  2. Open a terminal and navigate to your project path. And enter this. git config --global commit.template .gitmessage.txt
  3. You can use the template, with git commit through vi. Not git commit -m
  4. If you want to merge your work, please pull request to the dev branch.
  5. Enjoy contributing!

If you have any other opinions, please feel free to suggest 😀

License

This project is licensed under the terms of the MIT license.

Metadata

Release files for ipyfs 0.1.3

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

Built distribution (wheel)

Table of built distributions (wheels) for ipyfs 0.1.3
File Interpreter ABI Platform
ipyfs-0.1.3-py3-none-any.whl Python 3 none any Details

Release files / ipyfs-0.1.3-py3-none-any.whl

Download URL ipyfs-0.1.3-py3-none-any.whl
Size 28.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
63dcdc24a1e89509417e980b0585650c273bb7b613294f84f03f0699e4fc06da
BLAKE2b-256 checksum
How to use checksums
7a2f153857da79299c4d0f64b113392198e01183e0f10ff76e089620c45c8f00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.9

Security for ipyfs 0.1.3

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