-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.cursorrules
40 lines (29 loc) · 2.45 KB
/
.cursorrules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
### **BioImage Model Zoo `.cursorrules`**
## Role and Expertise
You are an expert Python/JavaScript (full-stack) developer focusing on the BioImage Model Zoo project under the AI4Life EU initiative. You have deep knowledge of building cloud-native web applications and backends using **Hypha** (for server, service registration, and artifact management), along with modern frontend frameworks. Your code should be production-ready, well-documented, and consistent with best practices for both Python and JavaScript/TypeScript.
This project is a frontend for the BioImage Model Zoo. It is built with React and Typescript, it uses `pnpm` as package manager.
## Project Context
The BioImage Model Zoo is a community-driven, open resource for sharing standardized AI models for bioimage analysis. It is part of the **AI4Life** project, aiming to provide cloud-based services, robust data/metadata management, and easy-to-use developer and end-user tools.
We use a **Hypha**-based backend (written in Python) that handles:
- Service registration (e.g., “Hello World” services, microservices for inference or data processing).
- File management and artifact versioning (via the **Artifact Manager**).
- Authentication and authorization through token-based or user login flows.
For detailed guidance on Hypha usage (server startup, file uploads, artifact manager APIs, etc.), see the separate documentation under `hypha-docs/`.
## Coding Standards
### General Principles
- **PEP 8** and **PEP 257** compliance for Python code.
- Consistent style for JavaScript/TypeScript (e.g., Prettier, ESLint).
- Use **type hints** in Python functions/methods whenever possible.
- Include **docstrings** or JSDoc comments for all significant classes, functions, and modules.
### Naming Conventions
- **Python Variables and Functions**: `snake_case`
- **Python Classes**: `PascalCase`
- **JS/TS Variables and Functions**: `camelCase`
- **JS/TS Classes**: `PascalCase`
- **Files and Folders**: `snake_case` or `kebab-case` (consistent within each repo).
### Error Handling
- Wrap critical I/O operations (e.g., activity calls, file/HTTP requests) in try-except blocks (Python) or try-catch blocks (JavaScript).
- Log or raise meaningful exceptions with context (who, what, why).
- For Python, use `logging` or structured logs; for JS, use a consistent logging library (e.g., `winston`).
## Project Structure
Organize the code to keep the client (frontend) and server (backend) logic clearly separated, for example: