Compare commits

..

No commits in common. "3924d43f75560565022b8fab554c61fd1f90d19f" and "69dfd731639bd83387dd5813e4ff5f0f2c78901d" have entirely different histories.

4 changed files with 25 additions and 122 deletions

View File

@ -1,11 +0,0 @@
## v0.3.0 (2025-01-15)
### Feat
- Better exceptions and parsing.
- Working app!
### Fix
- fixed Windows detection trying to detect Linux
- fixed --version and removed pip

126
README.md
View File

@ -1,123 +1,37 @@
# `blext` # `blext`
_NOTE: This software should be considered alpha aka. **unstable**. It is not ready for production use. The feature-set is incomplete. The documentation is still very sparse._ A fast, convenient project manager for Blender extensions.
_With that said, we already find it **quite useful**. We hope you'll consider sharing your experiences with us, good and bad - for example, in the Discussions / Issues sections!_ Quite experimental for the moment.
**Documentation TBD.**
A project manager for [Blender](https://www.blender.org/) extensions, facilitating rapid and reliable development. For now, install the `uv` package manager and run
## Features
- **All You Need is `uv`**: The absolute only prerequisite is [`uv`](https://docs.astral.sh/uv/getting-started/installation/) and `blender`.
_Another opinionated Python packager?_ Trust me, it's great.
- **Intuitive and Fast**: `uvx blext dev` runs Blender with your extension.
If you only changed some code, it runs nearly instantly!
- **Effortless Deps**: Need a Python package for your addon?
Just `uv add <pkgname>`.
The next time you run `blext dev`, your package will be available from your extension code.
- **Single Source of Truth**: Manage your Blender extension entirely from `pyproject.toml`, using the new table `[tool.blext]`.
`blext` is explicit about any mistakes you might make, and for your trouble, generates a correct `blender_manifest.toml` when making the addon.
- **Extension Analysis**: "Look inside" your extension with ease.
Need to check the generated `blender_manifest.toml`?
Re-run Blender's own extension validation?
Or just check a platform-specific deduction?
Just use `blext show`!
## Running `blext`
If you have `uv`, just run:
```bash ```bash
uvx blext uvx blext
``` ```
to try out `blext`.
A barebones help text should be available even now.
This relies on [`uv` tools](https://docs.astral.sh/uv/concepts/tools/), which is similar to `pipx`. # Contributing
## Tooling
This is the recommended way of using `blext`. - `uv`: Package and project manager.
- `ruff lint`: Linter. Currently not enforced.
## Using `blext` - `ruff fmt`: Linter. Currently enforced.
For now, see `examples/simple` in this repository for an example of a working Blender extension. - `mypy`: Static type analysis. Currently not enforced.
- `commitizen`: Commit and release conventions. Currently not enforced.
Particular attention should be paid to the `[tool.blext]` section of `pyproject.toml`. - `pre-commit`: Guarantees
More in-depth documentation TBD.
## Installing `blext`
Apart from `uvx`, installation can be one more or less as with any Python package:
- `pip install --user blext`: The standard `pip` package manager should work fine. _It is strongly suggested to use a venv._
- `uv tool install blext`: This allows running `blext` without prepending `uvx blext`.
- `uv add --dev blext`: This enables running `uv run blext` from any other `uv` project.
- **Install from Source**: See the `Contributing` section.
## Documentation
For now, run `blext` alone, or run `blext --help` explicitly.
Subcommands also have help text available.
For example, `blext dev --help`.
More documentation TBD
# Contributing to `blext`
## How do I...
**Get Started**?
```bash
# Install uv.
# Clone the Repository
git clone URL
cd blext
# Install pre-commit hooks
uvx pre-commit install
# That's it! Change some code!
```
**Test some Local Changes**?
```bash
# Run the Local 'blext'
## - Add any CLI options you want!
uv run blext
```
**Make a Commit**?
```bash
# Stage Files for the Commit
## - Generally, make sure that "one commit is one change".
git add ... ## 'git add -A' works too, due to thorough .gitignores.
# Use 'commitizen' for Semantic Commits
## - Commit messages **are** CHANGELOG messages, and can also ref/close issues.
## - So make them good! `cz c` makes that easy.
uv run cz c ## 'git commit' always works, but is less convenient.
# When pre-commit Makes Changes
## - For example, adding a license header or reformatting something.
## - Just re-stage and re-commit - `cz c` will remember the commit message.
git add ... ## 'git add -A' works too, due to thorough .gitignores.
uv run cz c
```
## Overview of Tools
Development of `blext` relies on the following tools:
- `uv`: Package and project manager. **Required**.
- `pre-commit`: Enforces conventions at commit-time. **Strongly suggested**.
- `commitizen`: Commit and release manager. **Enforced** by `pre-commit`.
- `ruff fmt`: Deterministic code formatter. **Enforced** by `pre-commit`.
- `ruff lint`: Code linter. **Not enforced** (planned).
- `mypy`: Static type analysis. **Not enforced** (planned).
## Making Commits ## Making Commits
Commits are subject to `pre-commit` hooks, if installed. Commits are subject to `pre-commit` hooks.
To set this up, simply run: To set this up, run:
```bash ```bash
uvx pre-commit install uvx pre-commit install
``` ```
Then, all pre-commit hooks will run after each commit.
Thereafter, it will run after each commit.
Sometimes it's nice to run all of the `pre-commit` hooks manually: Sometimes it's nice to run all of the `pre-commit` hooks manually:
```bash ```bash
uvx pre-commit run --all-files uvx pre-commit run --all-files
``` ```

View File

@ -50,9 +50,9 @@ def detect_local_blplatform() -> BLPlatform:
return BLPlatform.macos_x64 return BLPlatform.macos_x64
case ('darwin', arch) if arch.startswith(('aarch64', 'arm')): case ('darwin', arch) if arch.startswith(('aarch64', 'arm')):
return BLPlatform.macos_arm64 return BLPlatform.macos_arm64
case ('windows', 'x86_64' | 'amd64'): case ('linux', 'x86_64' | 'amd64'):
return BLPlatform.windows_x64 return BLPlatform.windows_x64
case ('windows', arch) if arch.startswith(('aarch64', 'arm')): case ('linux', arch) if arch.startswith(('aarch64', 'arm')):
return BLPlatform.windows_arm64 return BLPlatform.windows_arm64
msg = "Could not detect a local operating system supported by Blender from 'platform.system(), platform.machine() = {platform_system}, {platform_machine}'" msg = "Could not detect a local operating system supported by Blender from 'platform.system(), platform.machine() = {platform_system}, {platform_machine}'"
@ -104,7 +104,7 @@ def find_blender_exe() -> str:
msg = "Couldn't find executable command 'blender' on the system PATH. Is it installed?" msg = "Couldn't find executable command 'blender' on the system PATH. Is it installed?"
raise ValueError(msg) raise ValueError(msg)
case BLPlatform.macos_arm64 | BLPlatform.macos_x64: case BLPlatform.macos_arm64:
blender_exe = '/Applications/Blender.app/Contents/MacOS/Blender' blender_exe = '/Applications/Blender.app/Contents/MacOS/Blender'
if Path(blender_exe).is_file(): if Path(blender_exe).is_file():
return blender_exe return blender_exe
@ -112,7 +112,7 @@ def find_blender_exe() -> str:
msg = f"Couldn't find Blender executable at standard path. Is it installed? (searched '{blender_exe}')" msg = f"Couldn't find Blender executable at standard path. Is it installed? (searched '{blender_exe}')"
raise ValueError(msg) raise ValueError(msg)
case BLPlatform.windows_x64 | BLPlatform.windows_x64: case BLPlatform.windows_x64:
blender_exe = shutil.which('blender.exe') blender_exe = shutil.which('blender.exe')
if blender_exe is not None: if blender_exe is not None:
return blender_exe return blender_exe

View File

@ -1,6 +1,6 @@
[project] [project]
name = "blext" name = "blext"
version = "0.3.0" version = "0.2.1"
description = "A fast, convenient project manager for Blender extensions." description = "A fast, convenient project manager for Blender extensions."
authors = [ authors = [
{ name = "Sofus Albert Høgsbro Rose", email = "blext@sofusrose.com" }, { name = "Sofus Albert Høgsbro Rose", email = "blext@sofusrose.com" },