diff --git a/.cursor/rules/coding.mdc b/.cursor/rules/coding.mdc new file mode 100644 index 000000000..3344454e1 --- /dev/null +++ b/.cursor/rules/coding.mdc @@ -0,0 +1,28 @@ +--- +description: writing code +globs: *.py +alwaysApply: false +--- +# Coding Style + +- Always prefer simple solutions +- Avoid having files over 200-300 lines of code. Refactor at that point +- Use single quotes for strings in Python +- Use f-strings wherever possible for better readability (except in performance-critical sections which should be marked with "NOTE:" comments) +- Follow autopep8 formatting with 120 character line length +- Each sentence in documentation should be on a new line +- Use ruff for linting and code checks + +# Workflow + +- Never overwrite .env file without first asking and confirming +- Avoid duplication of code whenever possible, which means checking for other areas of the codebase that might already have similar code and functionality +- Be careful to only make changes that are requested or are well understood and related to the change being requested +- When fixing an issue or bug, do not introduce a new pattern or technology without first exhausting all options for the existing implementation. And if you finally do this, make sure to remove the old implementation afterwards so we don't have duplicate logic +- Keep the codebase very clean and organized +- Write tests for new features +- Run tests before submitting any changes +- Format code using autopep8 before submitting changes +- Use pre-commit hooks to ensure coding style compliance +- When adding new features, include corresponding tests +- For documentation changes, ensure each sentence is on a new line diff --git a/.cursor/rules/general.mdc b/.cursor/rules/general.mdc new file mode 100644 index 000000000..752150511 --- /dev/null +++ b/.cursor/rules/general.mdc @@ -0,0 +1,21 @@ +--- +description: General overview and context +globs: +alwaysApply: true +--- +# Project Description + +This is the official NiceGUI repository. With NiceGUI you can write graphical user interfaces which run in the browser. It has a very gentle learning curve while still offering the option for advanced customizations. NiceGUI follows a backend-first philosophy: it handles all the web development details for the developer, so they can focus on writing Python code. This makes it ideal for a wide range of projects including short scripts, dashboards, robotics projects, IoT solutions, smart home automation, and machine learning. + +# Technical Stack + +- Python/FastAPI for the backend +- Vue/Quasar in the frontend +- socket.io for communication between frontend and backend + +# Design Decisions + +- All user interactions are send to the backend and invoke the proper Python functions. +- Unlike Streamlit the framework took much care to allow easy integration with any other Python libraries. +- NiceGUI only uses one uvicorn worker (to not have to implement/support tricky synchronization). +- The socket.io library is used for managing web sockets. After the initial content is loaded a web socket connection is established and kept open for communication as long as the web page is shown. diff --git a/.dockerignore b/.dockerignore index e8f70510b..df0fcc5ce 100644 --- a/.dockerignore +++ b/.dockerignore @@ -19,6 +19,7 @@ demo.py tests/.pytest_cache/**/* **/.ruff_cache **/*.pyc +**/.cursor **/.DS_Store **/.idea **/.vscode diff --git a/.syncignore b/.syncignore index f6db5e440..bb62f4ec3 100644 --- a/.syncignore +++ b/.syncignore @@ -10,6 +10,7 @@ venv .idea .nicegui/ *.sqlite* +.cursor/ .DS_Store .pytest_cache/ .vscode/