build: Migrate to uv #17

Merged
aniva merged 2 commits from build/uv into main 2025-07-04 16:11:41 -07:00
4 changed files with 2800 additions and 4040 deletions

View File

@ -1,34 +1,74 @@
# Cosplay
This is the design repository for NorCal Hakkero Factory No. 1, where we use
parametric CAD to make cosplay props.
parametric CAD to make cosplay props. We design cosplay props based on an
engineering point of view.
> NorCal Hakkero Factory № 1
>
> 北加国営八卦炉第一工場
Most cosplay schematics are created with Blender, CadQuery, and Inkscape.
## Development
Most cosplay schematics are created with Blender, CadQuery, and Inkscape. To
enter into a CadQuery environment, install `poetry` and use
```sh
poetry install
poetry shell
Install `uv`, and then execute
``` sh
uv sync
```
and this should succeed
```sh
python3 -c "import nhf"
To get a development environment, run
``` sh
uv venv
```
Then, either follow the instruction to activate this venv, or install `direnv`
and create the file
``` sh
# .envrc
source .venv/bin/activate
```
Test the environment with `python3 -c "import nhf"`
To visualize an object, create a file `visualize.py`, and run `cq-editor`:
``` sh
python3 -m cq_editor visualize.py
```
## Testing
### Folder Structure
- `nhf/parts/`: Ready-made parts
- `nhf/$WORK/$CHARACTER`: Design for an individual character
For each individual character, the `__init__.py` script stores the overall build
entry point and the entry point for all unit tests.
### Testing
Run all tests with
``` sh
python3 -m unittest
unittest-parallel
```
## Troubleshooting
### Wayland
If there is the error
```
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 3 (X_GetWindowAttributes)
Resource id in failed request: 0x3
Serial number of failed request: 28
Current serial number in output stream: 29
```
Export the environment variable
``` sh
export QT_QPA_PLATFORM=xcb
```

4010
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,28 +1,34 @@
[tool.poetry]
[project]
name = "nhf"
version = "0.1.0"
description = "NorCal Hakkero Factory No. 1 Cosplay Designs"
authors = ["Leni Aniva <v@leni.sh>"]
authors = [{ name = "Leni Aniva", email = "aniva@stanford.edu" }]
requires-python = ">=3.10,<3.13"
readme = "README.md"
dependencies = [
"cadquery==2.5.2",
"numpy>=2,<3",
"colorama>=0.4.6,<0.5",
"multimethod~=1.12",
"scipy>=1.14.0,<2",
"typish>=1.9.3,<2",
]
[tool.poetry.dependencies]
python = ">=3.10,<3.13"
cadquery = "2.5.2"
numpy = ">=2,<3"
colorama = "^0.4.6"
[dependency-groups]
dev = [
"cq-editor",
"pyqt5>=5.15.11,<6",
"logbook>=1.8.0,<2",
"spyder>=5,<6",
"pyqtgraph>=0.13.7,<0.14",
"unittest-parallel>=1.7.4",
]
# cadquery dependency
multimethod = "^1.12"
scipy = "^1.14.0"
typish = "^1.9.3"
[tool.uv]
[tool.poetry.group.dev.dependencies]
cq-editor = {git = "https://github.com/CadQuery/CQ-editor.git"}
pyqt5 = "^5.15.11"
logbook = "^1.8.0"
spyder = "^5"
pyqtgraph = "^0.13.7"
[tool.uv.sources]
cq-editor = { git = "https://github.com/CadQuery/CQ-editor.git" }
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
requires = ["hatchling"]
build-backend = "hatchling.build"

2724
uv.lock Normal file

File diff suppressed because it is too large Load Diff