A flexible data layer for applications working with Magic: the Gathering cards, decks, and tournaments.
Project description
scooze
A flexible data layer for applications working with Magic: the Gathering cards, decks, and tournaments.
In this README 👇
Features
🎛️ CLI to manage a local database of Scryfall data
📊 Robust data models for representing Magic: the Gathering cards, decks, and tournaments
- Cards - follows the Scryfall standard
- Decks - main deck/sideboard/command zone, format legality, average words, and more
- Tournaments - coming soon!
🐍 Python and REST APIs for interacting with the scooze database
- Note: v1 is local only
Usage
Initial setup
-
Download and install this package from PyPi.
pip install scooze
-
Set up the database
-
Using Docker:
Make sure Docker Desktop is running.
scooze setup docker
- This will pull the latest MongoDB issued image for your machine's distribution, and spin up the container with port 27017 bound to the host's port 27017.
- After this, you can continue to (3) below.
-
Running MongoDB locally:
Scooze depends on MongoDB to run your local database. Download and install MongoDB.
You can use scooze without MongoDB if you don't intend to use any of its database-related features.
Your local database can be stored wherever you want, but make sure you create the directory first. This is commonly stored at
/data/db
Run the MongoDB server with
mongod --dbpath path/to/db/
-
-
Run the scooze CLI tool (installed with pip install) to add some data to your local database.
scooze -h scooze load-cards oracle scooze run
-
Use scooze in your application code!
from scooze.api import ScoozeApi from scooze.catalogs import Color with ScoozeApi() as s: # get 10 arbitrary green cards green_cards = s.get_cards_by("colors", [Color.GREEN], paginated=True, page_size=10) # get _all_ green cards green_cards = s.get_cards_by("colors", [Color.GREEN]) # get all cards from a particular set woe_cards = s.get_cards_by_set("woe") # get a specific card black_lotus = s.get_card_by_name("Black Lotus") print(black_lotus.total_words()) # and more!
Contributing
If you find a bug 🐛, please open a bug report. If you have an idea for an improvement or new feature 🚀, please open a feature request.
If you find a security vulnerability, please follow the instructions here.
Developer setup
-
Install Poetry
-
Make sure it worked
poetry --version
-
Fork and clone the scooze GitHub repo
Read more about forking here.
git clone https://www.github.com/link/to/fork cd ./scooze poetry install
-
You're ready to develop!
-
When you have changes you'd like the team to review, please submit a pull request!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.