https://github.com/misode/gaia-beet
https://github.com/misode/gaia-beet
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/misode/gaia-beet
- Owner: misode
- License: mit
- Created: 2022-03-20T22:25:54.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-16T21:23:19.000Z (almost 4 years ago)
- Last Synced: 2025-02-28T12:07:31.405Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 282 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# gaia-beet
[](https://github.com/misode/gaia-beet/actions)
[](https://pypi.org/project/gaia-beet/)
[](https://pypi.org/project/gaia-beet/)
[](https://github.com/ambv/black)
[](https://discord.gg/98MdSGMm8j)
> Beet plugin to generate Minecraft worldgen files
## Introduction
Writing density functions in JSON by hand can be tiring and confusing. This package allows you to write them as natural looking expressions.
```py
gaia.df("basic:foo", abs(const(4) ** 3) + ref("basic:bar"))
```
## Installation
The package can be installed with `pip`.
```bash
$ pip install gaia-beet
```
## Getting started
When using with [`beet`](https://github.com/mcbeet/beet), a simple `beet.yml` is enough:
```yaml
output: out
pipeline:
- main
```
This references a `main.py` plugin file where the density functions will be defined:
```py
from beet import Context
from gaia_beet import Gaia
from gaia_beet.density_functions import *
def beet_default(ctx: Context):
gaia = ctx.inject(Gaia)
blah = slide(const(2))
foo = gaia.df("basic:foo", abs(const(4) ** 3) + blah)
gaia.df("basic:bar", blah * foo)
```
Then install beet and run the watch command:
```bash
$ pip install beet
$ beet watch
```
## Contributing
Contributions are welcome. Make sure to first open an issue discussing the problem or the new feature before creating a pull request. The project uses [`poetry`](https://python-poetry.org).
```bash
$ poetry install
```
You can run the tests with `poetry run pytest`.
```bash
$ poetry run pytest
```
The project must type-check with [`pyright`](https://github.com/microsoft/pyright). If you're using VSCode the [`pylance`](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance) extension should report diagnostics automatically. You can also install the type-checker locally with `npm install` and run it from the command-line.
```bash
$ npm run watch
$ npm run check
```
The code follows the [`black`](https://github.com/psf/black) code style. Import statements are sorted with [`isort`](https://pycqa.github.io/isort/).
```bash
$ poetry run isort gaia_beet examples tests
$ poetry run black gaia_beet examples tests
$ poetry run black --check gaia_beet examples tests
```
---
License - [MIT](https://github.com/misode/gaia-beet/blob/main/LICENSE)