Skip to content

Commit

Permalink
Merge pull request #11 from Moo-Ack-Productions/finalize-0.4.0
Browse files Browse the repository at this point in the history
Finalize v0.4.0
  • Loading branch information
StandingPadAnimations authored Apr 26, 2024
2 parents 12d2dbc + a2550ff commit a0741ec
Show file tree
Hide file tree
Showing 6 changed files with 148 additions and 53 deletions.
59 changes: 59 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,64 @@
# Changelog


## [0.4.0] - 2024-04-18


### Fix: Add parent folder of script to sys.path



### Docs: Redone readme and made Getting Started

### Docs: added a getting started section

### Docs: added info on argument-less main

### Docs: removed working dir references in docs

### Docs: added info on post_install in tests for todo

### Docs: Added docs for Api object



### Feat: added backwards compat for old actions

### Feat: add path of missing file in error



### Refactor: removed circular import



### Style: Reduced indentation



### Test: MCprep tests now download in parallel

### Test: added MCprep tests for translation builds

### Test: added tests with MCprep's source tree

### Test: added proper check for post install hooks

### Test: added test checking for non-existent configs

### Test: added hooks test

### Tests: added build tests

### Tests: Modified actions to pass tests

### Test: added basic test for help argument

### Test: Moved test files


<!-- generated by git-cliff -->

## [0.3.0] - 2024-02-02


Expand Down
13 changes: 11 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This guide will assume you already know how to use Git and understand enough Pyt
# Building Bpy-Build
To make building the final package easier, we use [Poetry](https://python-poetry.org/). To build, you can use the following command:
```sh
poetry install
poetry build
```

Expand Down Expand Up @@ -71,6 +72,14 @@ This will make all commits use that template and perform verbose commits (where

# Pre-Commit Hooks
To make things easier for developers, we define pre-commit hooks that allow developers to commit changes and automatically have Mypy and Black run on said commit. This is not required
Set up [pre-commit](https://pre-commit.com/). This must be installed seperately and is not included in the Poetry dependencies. Then run `pre-commit install`. This will set up pre-commit hooks for the following:
Set up [pre-commit](https://pre-commit.com/). This must be installed separately and is not included in the Poetry dependencies. Then run `pre-commit install`. This will set up pre-commit hooks for the following:
- Mypy static checking
- Black code formatter
- Linting with Ruff
- Code formatting with Ruff

# Tests
BpyBuild has 2 sets of unittests, `test/tests.py` and `test/mcprep_tests.py`. The former tests every feature in BpyBuild, but isn't sophisticated. The latter clones the MCprep repo, which means less features are used, but the tests are more sophisticated and test for backwards compatibility (as required under [MCprep-first development](/docs/mcprep-first.md)).

To run with Poetry, the following commands can be used:
- Regular tests: `poetry run python -m unittest test.tests`
- MCprep tests: `poetry run python -m unittest test.mcprep_tests`
54 changes: 4 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,10 @@
# Bpy-build
A tool to make building addons faster
BpyBuild is a tool that makes building addons faster. It was created as part of the [MCprep](https://github.com/Moo-Ack-Productions/MCprep) project for the purposes of speeding up development, and is now available as a general tool. It is available under the BSD 3-Clause License.

# How to use
Install from PyPi:
`pip install bpy-addon-build`
Please check out our [Getting Started guide](/docs/getting-started.md) to get started with BpyBuild in your project.

First create a file called `bpy-build.yaml` and add the following contents:
```yaml
addon_folder: my_addon # the folder with the addon source code
build_name: my_addon
```
**Note: the addon source code must be in a subfolder! BpyBuild does not support using `.` for `addon_folder`**

Then run `bab`, your addon will be built in the `build` folder!

Now let's automatically install our addon:
```yaml
addon_folder: my_addon # the folder with the addon source code
build_name: my_addon
install_versions:
- 3.5
```

We can also do stuff during the build process:
```yaml
during_build:
# This will always be executed
default:
script: "default.py"
```

When we build, the default case will always run. We can also define cases we want to only run if we specify them:
```yaml
during_build:
# This will always be executed
default:
script: "default.py"
dev:
script: "dev.py"
# We can ignore files as
# well if we want to speed
# up build times for dev builds
ignore_filters:
- "*.blend"
```

To run the `dev` case, we pass the `-b` argument, like `bpy-addon-build -b dev`. Note that when making an action, the action is ran at the root of your addon folder.

Our addon will now automatically be installed in Blender 3.5! If it doesn't exist, `bpy-build` will just ignore it.
> [!NOTE]
> BpyBuild is in alpha. Although we've had great success using BpyBuild in production for MCprep, we're aware that there's still issues that need to be addressed. If you encounter any bugs, please report them on GitHub Issues.
```
BSD 3-Clause License
Expand Down
13 changes: 13 additions & 0 deletions docs/actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,16 @@ class BabContext:
```

- `current_path`: the path of the action's target directory. This can be thought of as the working directory for the action, though the working directory is not changed when running actions.

# Compatibility
> [!CAUTION]
> This is intended for MCprep through [MCprep-first development](/docs/mcprep-first.md)

For backwards compatibility, BpyBuild can run declarations of the `main` hook with no arguments, at the cost of not being allowed to return warnings or errors. If argument-less `main` exists, it will be ran with the working directory set to the build directory.

For example:
```py
def main() -> None:
# do stuff...
```

60 changes: 60 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Getting Started: Building your own addoon

To get started using bpy-build to manage building and reloading your own blender addon project, follow the steps below.
Install from PyPi:
`pip install bpy-addon-build`

First create a file called `bpy-build.yaml` and add the following contents:
```yaml
addon_folder: my_addon # the folder with the addon source code
build_name: my_addon
```
**Note: the addon source code must be in a subfolder! BpyBuild does not support using `.` for `addon_folder`**

Then run `bab`, your addon will be built in the `build` folder!

Now let's automatically install our addon:
```yaml
addon_folder: my_addon # the folder with the addon source code
build_name: my_addon
install_versions:
- 3.5
```

We can also do stuff during the build process. Let's add the following:
```py
# default.py
from bpy_addon_build.api import BabContext
def main(ctx: BabContext) -> None:
print("Hello World!")
```
```yaml
during_build:
# This will always be executed
default:
script: "default.py"
```

Check the [action docs](/docs/actions.md) for more information.

When we build, the default case will always run. We can also define cases we want to only run if we specify them:
```yaml
during_build:
# This will always be executed
default:
script: "default.py"
dev:
script: "dev.py"
# We can ignore files as
# well if we want to speed
# up build times for dev builds
ignore_filters:
- "*.blend"
```

To run the `dev` case, we pass the `-b` argument, like `bpy-addon-build -b dev`. Note that when making an action, the action is ran at the root of your addon folder.

Our addon will now automatically be installed in Blender 3.5! If it doesn't exist, `bpy-build` will just ignore it.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "bpy-addon-build"
version = "0.3.1"
version = "0.4.0"
description = "A build system to make building and testing Blender addons 10 times easier"
authors = ["StandingPad"]
license = "BSD-3-Clause"
Expand Down

0 comments on commit a0741ec

Please sign in to comment.