From f50cc95405bf1b8c3908aa0e4dcfdce1b8af8969 Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Wed, 21 May 2025 16:17:41 -0400 Subject: [PATCH] Add Cursor rules --- .cursor/rules/coding-guide.mdc | 29 +++++++++++++++++++++++++++++ .cursor/rules/makefile-commands.mdc | 7 +++++++ .cursor/rules/run-examples.mdc | 8 ++++++++ .gitignore | 3 --- 4 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 .cursor/rules/coding-guide.mdc create mode 100644 .cursor/rules/makefile-commands.mdc create mode 100644 .cursor/rules/run-examples.mdc diff --git a/.cursor/rules/coding-guide.mdc b/.cursor/rules/coding-guide.mdc new file mode 100644 index 00000000..6251f889 --- /dev/null +++ b/.cursor/rules/coding-guide.mdc @@ -0,0 +1,29 @@ +--- +description: Code in Python and Cython +globs: +alwaysApply: false +--- +- Follow PEP 8 rules +- When you write imports, split system, 3rd-party, and local imports with a new line +- Have two empty lines between the import block and the rest of the code +- Have an empty line (\n) at the end of every file +- If a file is supposed to be run, always add ``if __name__ == 'main'`` +- Always follow a consistent pattern of using double or single quotes +- When there is a class without a docblock, leave one blank line before its members, e.g.: +```python +class Container(containers.DeclarativeContainer): + + service = providers.Factory(Service) +``` + +- Avoid shortcuts in names unless absolutely necessarry, exceptions: +``` +arg +args +kwarg +kwargs +obj +cls +``` + +- Avoid inline comments unless absolutely necessarry diff --git a/.cursor/rules/makefile-commands.mdc b/.cursor/rules/makefile-commands.mdc new file mode 100644 index 00000000..b43fb75b --- /dev/null +++ b/.cursor/rules/makefile-commands.mdc @@ -0,0 +1,7 @@ +--- +description: Build and run tests +globs: +alwaysApply: false +--- +- Use Makefile commands to build, test, lint and other similar operations when they are available. +- Activate virtualenv before running any commands by ``. venv/bin/actvate`` diff --git a/.cursor/rules/run-examples.mdc b/.cursor/rules/run-examples.mdc new file mode 100644 index 00000000..f5f3b703 --- /dev/null +++ b/.cursor/rules/run-examples.mdc @@ -0,0 +1,8 @@ +--- +description: Run examples +globs: +alwaysApply: false +--- +- When you run an example from the ``examples/`` folder, switch to the example folder and run it from there. +- If there are instructions on running the examples or its tests in readme, follow them +- Activate virtualenv before running any commands by ``. venv/bin/actvate`` diff --git a/.gitignore b/.gitignore index eef3cb91..a9f80bee 100644 --- a/.gitignore +++ b/.gitignore @@ -73,6 +73,3 @@ src/**/*.html .workspace/ .vscode/ - -# Cursor project files -.cursor