🔬 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:
- Fetch & Filter high-fidelity crystal structures from the Materials Project with advanced constraints.
- Featurize the materials extracting structural and compositional data.
- Predict properties (like Band Gap) using built-in ML models.
- Save datasets seamlessly to JSON or CSV.
✨ Features
- Ultra-Fast Setup: Powered by
uvfor 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:
- Go to Materials Project
- Sign up / Log in and copy your API Key.
- 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file matgraph_cli-0.2.0.tar.gz.
File metadata
- Download URL: matgraph_cli-0.2.0.tar.gz
- Upload date:
- Size: 373.2 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36550c9d35682d6d9c867e30eaa951d8719f88e76fdca45f025f558fa07ec034
|
|
| MD5 |
2c744221129a090cb24c370cbe1ab0a9
|
|
| BLAKE2b-256 |
c8db4bc8540c183e130ecb5e1c79aca6a33283db26ed3999737d9898a424e5c1
|
File details
Details for the file matgraph_cli-0.2.0-py3-none-any.whl.
File metadata
- Download URL: matgraph_cli-0.2.0-py3-none-any.whl
- Upload date:
- Size: 8.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d430c883cb41b72ebad0dfead39080ca954f86a3211ad849fb0dceab1d1ca4bb
|
|
| MD5 |
d248e3ca9be9fbd19a27737482e6f63d
|
|
| BLAKE2b-256 |
f0ec6a449ec3ed09038f7f311f8b5e34d88723a7fe46c1106d4d5d29f00fd5dd
|