Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: initial library setup #1

Merged
merged 4 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Ruff
on: [ push, pull_request ]
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Use ruff twice for linting and formatting.
# See https://github.com/astral-sh/ruff-action/issues/23#issuecomment-2525574730
- uses: astral-sh/ruff-action@v3
- uses: astral-sh/ruff-action@v3
with:
args: "format --check"
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
repos:
# pre-commit-hooks not yet in ruff: https://github.com/astral-sh/ruff/issues/4073
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: check-ast
- id: trailing-whitespace
- id: pretty-format-json
args:
- "--autofix"

- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.5.8
hooks:
- id: uv-lock

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.1
hooks:
# Run the linter.
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13
53 changes: 52 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,52 @@
# XLand
# XLand

## Development Instructions

Clone the project locally:

```shell
$ git clone [email protected]:lysj-cpu/icland.git
$ cd icland
```

### uv (recommended)

The project can be run via [uv](https://docs.astral.sh/uv/):

```shell
$ uv run python -c "import icland; print(icland.__doc__)"
Recreating Google DeepMind's XLand RL environment in JAX.
```

[Ruff](https://docs.astral.sh/ruff/) is used for formatting.

```shell
$ uv run ruff check # Linting
$ uv run ruff format # Formatting
```

You can also install [pre-commit](https://pre-commit.com/) hooks to automatically run validation checks when making a commit:

```shell
$ uv run pre-commit install
```

### pip

`uv` is [preferred](https://docs.astral.sh/uv/#highlights) over pip and also installs developer dependencies. However, pip might still be useful for small modifications.

First, we create and activate a [virtual environment](https://docs.python.org/3/library/venv.html):

```shell
$ python -m venv env
$ source env/bin/activate
```


Then install in [editable mode](https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs):

```shell
$ pip install -e .
$ python -c "import icland; print(icland.__doc__)"
Recreating Google DeepMind's XLand RL environment in JAX.
```
33 changes: 33 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[project]
name = "icland"
version = "0.1.0"
description = "Recreating Google DeepMind's XLand RL environment in JAX"
readme = "README.md"
authors = []
requires-python = ">=3.13"
dependencies = [
"brax>=0.12.1",
"mujoco>=3.2.6",
"mujoco-mjx>=3.2.6",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[dependency-groups]
dev = [
"pre-commit>=4.0.1",
"ruff>=0.9.1",
]

[tool.ruff]
target-version = "py313"

[tool.ruff.lint]
# Enable pydocstyle checks
# See: https://docs.astral.sh/ruff/rules/#pydocstyle-d
select = ["D"]

[tool.ruff.lint.pydocstyle]
convention = "google"
1 change: 1 addition & 0 deletions src/icland/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Recreating Google DeepMind's XLand RL environment in JAX."""
Empty file added src/icland/py.typed
Empty file.
954 changes: 954 additions & 0 deletions uv.lock

Large diffs are not rendered by default.

Loading