Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

python.mdc 1.3 KB

You have to be logged in to leave a comment. Sign In
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
  1. ---
  2. description: Guidelines for Python development
  3. globs: '**/*.py'
  4. alwaysApply: false
  5. ---
  6. # Python Development Guidelines
  7. Files: "\*_/_.py"
  8. This rule provides guidance for Python development in the promptfoo project.
  9. ## Python Guidelines
  10. - Use Python 3.9 or later
  11. - Follow the [Google Python Style Guide](mdc:https://google.github.io/styleguide/pyguide.html)
  12. - Use type hints to improve code readability and catch potential errors
  13. - Use `ruff` for linting and formatting
  14. - Run `ruff check --fix` for general linting
  15. - Run `ruff check --select I --fix` for import sorting
  16. - Run `ruff format` for formatting
  17. - Write unit tests for new Python functions using the built-in `unittest` module
  18. - Keep the Python codebase simple and minimal, without unnecessary external dependencies
  19. ## Examples and Custom Components
  20. - When adding Python examples, update relevant `requirements.txt` files
  21. - When implementing custom providers, prompts, or asserts in Python, follow the promptfoo API patterns
  22. - Place example Python code in the `examples/` directory with appropriate documentation
  23. ## Integration with TypeScript
  24. - Understand the interaction between Python components and the TypeScript core
  25. - Follow the patterns established in existing Python files for interfacing with the main codebase
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...