Skip to content
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
3 changes: 3 additions & 0 deletions .changelog/16.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Made the scripts in the tools folder return an error code when something goes wrong
Updated toolchain to use UV
Updated GitHub actions to use UV
28 changes: 16 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,27 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
python-version: ['3.11']
python-version: ['3.12']

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Set up Python
run: uv python install ${{ matrix.python-version }}

- name: Install dependencies
run: |
pip install -e ".[lint]"

run: uv sync --extra lint

- name: Lint with ruff
run: |
ruff check .
ruff format --check .
uv run ruff check .
uv run ruff format --check .

- name: Type check with mypy
run: mypy .
run: uv run mypy .
16 changes: 6 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,16 @@ jobs:
exit 1
fi

- name: Set up Python
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: '3.x'

- name: Install build dependencies
run: |
python -m pip install -e ".[dist]"
enable-cache: true

- name: Build package
run: python -m build --wheel
run: uv build

- name: Store the distribution packages
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
Expand All @@ -75,7 +71,7 @@ jobs:

steps:
- name: Download all the dists
uses: actions/download-artifact@v6
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

## Requirements ⚙️

- Python 3.10 or newer
- Python 3.12 or newer
- Windows (primary target; other platforms may work)
- Unreal Engine (project-specific; config in `Config/`)

Expand Down Expand Up @@ -161,15 +161,18 @@ How the script works:

## Development & Testing 🧪

- Install [Astral UV](https://docs.astral.sh/uv/)
- Setup dev environment and install dependencies:

```powershell
.\setup_venv.ps1
.\setup-venv.ps1
```

- Linting & formatting
- Use `ruff check .` and `ruff format .` Add checks to CI as required.
- Use `mypy .`
- Use `uv run ruff check .` and `uv run ruff format .` Add checks to CI as required.
- Use `uv run mypy .`

To create a new release, you must be on the `develop` branch, and call `invoke create_release`

---

Expand Down
3 changes: 3 additions & 0 deletions setup-env.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
uv sync --python 3.12 --link-mode=copy --extra dev

. .\.venv\Scripts\Activate.ps1
122 changes: 0 additions & 122 deletions setup_venv.ps1

This file was deleted.

4 changes: 4 additions & 0 deletions src/uepyscripts/tools/ue/close_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ def main() -> None:
if choice == "Y" or choice == "y":
proc.kill()
break


if __name__ == "__main__":
main()
33 changes: 22 additions & 11 deletions src/uepyscripts/tools/ue/compile_editor.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
import sys

from uepyscripts.context import engine, project


def main() -> None:
print("Compiling Unreal Editor...")
engine.build(
[
f"{project.project_name}Editor",
"Win64",
"Development",
f"-project={project.uproject_path}",
"-WaitMutex",
"-FromMsBuild",
f"-log={project.root_folder}/Saved/Logs/Compile_Editor_Development_Win64.log",
]
)
if (
engine.build(
[
f"{project.project_name}Editor",
"Win64",
"Development",
f"-project={project.uproject_path}",
"-WaitMutex",
"-FromMsBuild",
f"-log={project.root_folder}/Saved/Logs/Compile_Editor_Development_Win64.log",
]
)
!= 0
):
print("Failed to compile Unreal Editor.")
sys.exit(1)


if __name__ == "__main__":
main()
8 changes: 6 additions & 2 deletions src/uepyscripts/tools/ue/generate_solution.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import sys

from uepyscripts.context import engine, project


def main() -> int:
return engine.ubt(["-projectfiles", f"-project={project.uproject_path}", "-game", "-rocket", "-progress"])
def main() -> None:
if engine.ubt(["-projectfiles", f"-project={project.uproject_path}", "-game", "-rocket", "-progress"]) != 0:
print("Failed to generate project files.")
sys.exit(1)


if __name__ == "__main__":
Expand Down
10 changes: 9 additions & 1 deletion src/uepyscripts/tools/ue/run_editor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import sys

from uepyscripts.context import engine


def main() -> None:
print("Starting Unreal Editor...")
engine.run_editor()
if engine.run_editor() != 0:
print("Failed to start Unreal Editor.")
sys.exit(1)


if __name__ == "__main__":
main()
Loading
Loading