@@ -25,6 +25,17 @@ upstream docker images or developing using local code.
2525 installing in each configured project
2626
2727
28+ ## Development
29+
30+ To develop pydc-control itself, you'll need to set up the development environment:
31+
32+ 1 . Install [ uv] ( https://docs.astral.sh/uv/ ) if you haven't already
33+ 2 . Clone the repository and navigate to the project directory
34+ 3 . Install dependencies: ` uv sync `
35+ 4 . Run tests: ` uv run pytest `
36+
37+ The development dependencies include pytest, ruff for linting/formatting, and other tools needed for development.
38+
2839## Setup
2940
3041### Application filesystem layout
@@ -79,19 +90,27 @@ it into a local environment for easy execution.
7990#### Control script
8091
8192Add a single python script to the project. Using naming such as ` <app>ctl ` is
82- recommended to make it easy to execute.
93+ recommended to make it easy to execute. It is recommended to make this script run with
94+ `` uv `` as that will ensure that the correct python version and dependencies are used.
8395
8496``` python
85- # !/usr/bin/env python3
97+ # !/usr/bin/env -S uv run --script
98+ #
99+ # /// script
100+ # requires-python = ">=3.11"
101+ # dependencies = [
102+ # "pydc-control",
103+ # ]
104+ # ///
86105
87- import os
88106import sys
89- import pydc_control
107+ from pathlib import Path
90108
109+ import pydc_control
91110
92111if __name__ == ' __main__' :
93112 # The base path is the location of your control project
94- base_path = os.path.realpath(os.path.join(os.path.dirname( __file__ ), ' .. ' ) )
113+ base_path = Path( __file__ ).parent.parent.resolve( )
95114 # Run pydc_control, returns an exit code
96115 sys.exit(pydc_control.run(base_path))
97116```
@@ -362,11 +381,19 @@ is enabled with s3).
362381It is easy to create additional commands using pydc_control.
363382
364383``` python
365- # !/usr/bin/env python3
384+ # !/usr/bin/env -S uv run --script
385+ #
386+ # /// script
387+ # requires-python = ">=3.11"
388+ # dependencies = [
389+ # "pydc-control",
390+ # ]
391+ # ///
366392
367393import argparse
368394import os
369395import sys
396+ from pathlib import Path
370397
371398import pydc_control
372399
@@ -393,7 +420,7 @@ def configure_parsers(parser: argparse.ArgumentParser, commands_parser: argparse
393420
394421
395422if __name__ == ' __main__' :
396- base_path = os.path.realpath(os.path.join(os.path.dirname( __file__ ), ' .. ' ) )
423+ base_path = Path( __file__ ).parent.parent.resolve( )
397424 sys.exit(pydc_control.run(base_path, configure_parsers))
398425```
399426
0 commit comments