Skip to main content

🔬 MatGraph CLI & GraphQL API

MatGraph is the ultimate, open-source tool for Material Science researchers and Machine Learning engineers. It is a complete, production-ready product built for extreme usability and speed.

It abstracts away the complexity of the deep learning pipeline for material properties. With a single command or GraphQL query, you can:

  1. Fetch & Filter high-fidelity crystal structures from the Materials Project with advanced constraints.
  2. Featurize the materials extracting structural and compositional data.
  3. Predict properties (like Band Gap) using built-in ML models.
  4. Save datasets seamlessly to JSON or CSV.

✨ Features

  • Ultra-Fast Setup: Powered by uv for lightning-fast dependency resolution.
  • Advanced CLI Filters: Search by Band Gap (--min-gap, --max-gap) and Crystal System (--crystal-system).
  • Data Export: Instantly save your ML predictions and feature sets using --save data.csv --format csv.
  • Modern GraphQL Engine: Built with Strawberry & FastAPI. Fully asynchronous resolvers with nested metrics and filtering options.

🚀 Quick Start (Efficient with uv)

1. Installation

If you don't have uv installed:

curl -LsSf https://astral.sh/uv/install.sh | sh

Clone the repo and sync dependencies instantly:

git clone https://github.com/yourusername/matgraph-cli.git
cd matgraph-cli
uv sync

2. Signups and API Key (Important!)

You need an API key from the Materials Project:

  1. Go to Materials Project
  2. Sign up / Log in and copy your API Key.
  3. Set up your key in your environment:
export MP_API_KEY="YOUR_API_KEY"

🛠️ Usage: The Productive CLI

Basic Prediction:

uv run matgraph predict LiFePO4

Advanced Filtering: Filter for materials with a minimum band gap of 1.5 eV and a cubic crystal system:

uv run matgraph predict LiFePO4 --min-gap 1.5 --crystal-system Cubic

Export & Save Data: Save the extracted features and ML predictions directly to a dataset for offline training:

uv run matgraph predict LiFePO4 --min-gap 2.0 --save dataset.csv --format csv

🌐 Usage: The Modern GraphQL API

Spin up the async GraphQL server:

uv run matgraph serve --port 8000

Example GraphQL Query with Filters:

query {
  predictMaterial(formula: "NaCl", minGap: 1.0, crystalSystem: "Cubic", limit: 3) {
    materialId
    formula
    crystalSystem
    trueBandGap
    predictedBandGap
    features {
      density
      numElements
    }
  }
}

🏗️ Tech Stack

  • Packaging: uv (Astral) & Hatchling
  • CLI Framework: Typer + Rich
  • GraphQL Engine: Strawberry (Async) + FastAPI
  • Material Science: PyMatGen + MP-API

🤝 Contributing

Ready for the open-source community! Run tests with uv run pytest and submit PRs for custom model integrations (like PyTorch CGCNN!).

Download files

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

Source Distribution

matgraph_cli-0.1.0.tar.gz (347.6 kB view details)

Uploaded Source

Built Distribution

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

matgraph_cli-0.1.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file matgraph_cli-0.1.0.tar.gz.

File metadata

  • Download URL: matgraph_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 347.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for matgraph_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ff818a1f37ad152a0e187833bca682d9781d192e67c3c8cc6bc77a22ded5605a
MD5 c1cf8408f51fc63ae1e0d952f660e6d9
BLAKE2b-256 1a11ab332d1f58eb1dc0984446d9b82501a9b88016b736499b16a00af1930e5f

See more details on using hashes here.

File details

Details for the file matgraph_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: matgraph_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for matgraph_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f5617e2e38edec5558697b13517f880a23debebf8e1cc29f5fcffc6c991e5f33
MD5 aed0acea3f9ec7379137ce519ee4a2eb
BLAKE2b-256 4aa31d3efb1063fc8e64837c320bf5782ef1a0def2a149149ee7afcc2f607ab2

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