@@ -6,6 +6,119 @@ documentation, we greatly value feedback and contributions from our community.
66Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
77information to effectively respond to your bug report or contribution.
88
9+ ## Dependencies
10+ Install [ hatch] ( https://hatch.pypa.io/dev/install/ ) .
11+
12+ ## Developer workflow
13+ These are all the checks you would typically do as you prepare a PR:
14+ ```
15+ # just test
16+ hatch test
17+
18+ # coverage
19+ hatch run test:cov
20+
21+ # type checks
22+ hatch run types:check
23+
24+ # static analysis
25+ hatch fmt
26+ ```
27+
28+ ## Set up your IDE
29+ Point your IDE at the hatch virtual environment to have it recognize dependencies
30+ and imports.
31+
32+ You can find the path to the hatch Python interpreter like this:
33+ ```
34+ echo "$(hatch env find)/bin/python"
35+ ```
36+
37+ ### VS Code
38+ If you're using VS Code, "Python: Select Interpreter" and use the hatch venv Python interpreter
39+ as found with the ` hatch env find ` command.
40+
41+ Hatch uses Ruff for static analysis.
42+
43+ You might want to install the [ Ruff extension for VS Code] ( https://github.com/astral-sh/ruff-vscode )
44+ to have your IDE interactively warn of the same linting and formatting rules.
45+
46+ These ` settings.json ` settings are useful:
47+ ```
48+ {
49+ "[python]": {
50+ "editor.formatOnSave": true,
51+ "editor.codeActionsOnSave": {
52+ "source.fixAll": "explicit",
53+ "source.organizeImports": "explicit"
54+ },
55+ "editor.defaultFormatter": "charliermarsh.ruff"
56+ }
57+ }
58+ "ruff.nativeServer": "on",
59+ ```
60+
61+ ## Testing
62+ ### How to run tests
63+ To run all tests:
64+ ```
65+ hatch test
66+ ```
67+
68+ To run a single test file:
69+ ```
70+ hatch test tests/path_to_test_module.py
71+ ```
72+
73+ To run a specific test in a module:
74+ ```
75+ hatch test tests/path_to_test_module.py::test_mytestmethod
76+ ```
77+
78+ To run a single test, or a subset of tests:
79+ ```
80+ $ hatch test -k TEST_PATTERN
81+ ```
82+
83+ This will run tests which contain names that match the given string expression (case-insensitive),
84+ which can include Python operators that use filenames, class names and function names as variables.
85+
86+ ### Debug
87+ To debug failing tests:
88+
89+ ```
90+ $ hatch test --pdb
91+ ```
92+
93+ This will drop you into the Python debugger on the failed test.
94+
95+ ### Writing tests
96+ Place test files in the ` tests/ ` directory, using file names that end with ` _test ` .
97+
98+ Mimic the package structure in the src/aws_durable_functions_sdk_python directory.
99+ Name your module so that src/mypackage/mymodule.py has a dedicated unit test file
100+ tests/mypackage/mymodule_test.py
101+
102+ ## Coverage
103+ ```
104+ hatch run test:cov
105+ ```
106+
107+ ## Linting and type checks
108+ Type checking:
109+ ```
110+ hatch run types:check
111+ ```
112+
113+ Static analysis (with auto-fix of known issues):
114+ ```
115+ hatch fmt
116+ ```
117+
118+ To do static analysis without auto-fixes:
119+ ```
120+ hatch fmt --check
121+ ```
9122
10123## Reporting Bugs/Feature Requests
11124
0 commit comments