@@ -4,40 +4,22 @@ Thank you for considering contributing to Starbridge!
44
55## Setup
66
7- Clone this GitHub repository via
8- ` git clone git@github.com:helmut-hoffer-von-ankershoffen/starbridge.git ` and
9- change into the directory of your local Starbridge repository: ` cd starbridge `
10-
11- Install the dependencies:
12-
13- ### macOS
7+ Install or update tools required for development:
148
159``` shell
16- if ! command -v brew & > /dev/null; then # if Homebrew package manager not present ...
17- /bin/bash -c " $( curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh) " # ... install it
18- else
19- which brew # ... otherwise inform where brew command was found
20- fi
21- # Install required tools if not present
22- which jq & > /dev/null || brew install jq
23- which xmllint & > /dev/null || brew install xmllint
24- which act & > /dev/null || brew install act
25- which pinact & > /dev/null || brew install pinact
26- uv run pre-commit install # install pre-commit hooks, see https://pre-commit.com/
10+ # Install Homebrew, uv package manager, copier and further dev tools
11+ curl -LsSf https://raw.githubusercontent.com/helmut-hoffer-von-ankershoffen/oe-python-template/HEAD/install.sh | sh
2712```
2813
29- ### Linux
30-
31- Notes:
32-
33- - Not yet validated
34- - .github/workflows/test.yml might provide further information
14+ [ Create a fork] ( https://github.com/helmut-hoffer-von-ankershoffen/starbridge/fork )
15+ and clone your fork using ` git clone URL_OF_YOUR_CLONE ` . Then change into the
16+ directory of your local Starbridge repository with ` cd starbridge ` .
3517
36- ``` shell
37- sudo sudo apt install -y curl jq libxml2-utils gnupg2 # tooling
38- curl --proto ' =https ' --tlsv1.2 -sSf https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash # act
39- uv run pre-commit install # see https://pre-commit .com/
40- ```
18+ If you are one of the committers of
19+ https://github.com/helmut-hoffer-von-ankershoffen/starbridge you can directly
20+ clone via
21+ ` git clone git@github .com:helmut-hoffer-von-ankershoffen/starbridge.git ` and
22+ ` cd starbridge ` .
4123
4224## Configuration
4325
@@ -92,74 +74,191 @@ Desktop application.
9274To show the configuration of starbridge within Claude, you can use
9375` uv run starbridge claude config ` .
9476
95- ## Running all build steps
77+ ## Directory Layout
9678
97- All build steps are defined in ` noxfile.py ` .
79+ ```
80+ ├── Makefile # Central entrypoint for build, test, release and deploy
81+ ├── noxfile.py # Noxfile for running tests in multiple python environments and other tasks
82+ ├── .pre-commit-config.yaml # Definition of hooks run on commits
83+ ├── .github/ # GitHub specific files
84+ │ ├── workflows/ # GitHub Actions workflows
85+ │ ├── prompts/ # Custom prompots for GitHub Copilot
86+ │ └── copilot-instructions.md # Insructions for GitHub Copilot
87+ ├── .vscode/ # Recommended VSCode settings and extensions
88+ ├── .env # Environment variables, on .gitignore
89+ ├── .env.example # Example environment variables
90+ src/starbridge/ # Source code
91+ tests/ # Unit and E2E tests
92+ docs/ # Documentation
93+ ├── partials/*.md # Partials to compile README.md, _main partial included in HTML and PDF documentation
94+ ├── ../README.md # Compiled README.md shown on GitHub
95+ ├── source/*.rst # reStructuredText files used to generate HTML and PDF documentation
96+ ├── ../*.md # Markdown files shown on GitHub and imported by .rst files
97+ ├── source/conf.py # Sphinx configuration used to generate HTML and PDF documentation
98+ ├── build/html/* # Generated HTML documentation as multiple pages
99+ ├── build/singlehtml/index.html # HTML documentation as a single page
100+ └── build/latex/starbridge.pdf # PDF manual - generate with make docs pdf
101+ reports/ # Compliance reports for auditing
102+ ├── junit.xml # Report of executions
103+ ├── mypy_junit.xml # Report of executions
104+ ├── coverage.xml # Test coverage in XML format
105+ ├── coverage_html # Report of test coverage in HTML format
106+ ├── licenses.csv # List of dependencies and their license types
107+ ├── licenses.json # .json file with dependencies their license types
108+ └── licenses_grouped.json # .json file with dependencies grouped by license type
109+ ```
110+
111+ ## Build, Run and Release
112+
113+ ### Setup project specific development environment
98114
99115``` shell
100- uv run nox # Runs all build steps except setup_dev
116+ make setup
101117```
102118
103- You can run individual build steps - called sessions in nox as follows:
119+ Don't forget to configure your ` .env ` file with the required environment
120+ variables.
121+
122+ Notes:
123+
124+ 1 . .env.example is provided as a template, use ` cp .env.example .env ` and edit
125+ ` .env ` to create your environment.
126+ 2 . .env is excluded from version control, so feel free to add secret values.
127+
128+ ### Build
104129
105130``` shell
106- uv run nox -s test # run tests
107- uv run nox -s lint # run formatting and linting
108- uv run nox -s audit # run security and license audit, inc. sbom generation
109- uv run nox -s docs # build documentation, output in docs/build/html
110- uv run nox -s docs_pdf # locally build pdf manual to docs/build/latex/starbridge.pdf
131+ make # Runs primary build steps, i.e. formatting, linting, testing, building HTML docs and distribution, auditing
132+ make help # Shows help with additional build targets, e.g. to build PDF documentation, bump the version to release etc.
111133```
112134
113- As a shortcut, you can run build steps using ` ./n ` , e.g.
135+ Notes:
136+
137+ 1 . Primary build steps defined in ` noxfile.py ` .
138+ 2 . Distribution dumped into ` dist/ `
139+ 3 . Documentation dumped into ` docs/build/html/ ` and ` docs/build/latex/ `
140+ 4 . Audit reports dumped into ` reports/ `
141+
142+ ### Run the CLI
114143
115144``` shell
116- ./n test
117- ./n lint
118- # ...
145+ uv run starbridge # shows help
119146```
120147
121- Generate a wheel using uv
148+ ### Commit and Push your changes
122149
123150``` shell
124- uv build
151+ git add .
152+ git commit -m " feat(user): added new api endpoint to offboard user"
153+ git push
125154```
126155
127156Notes:
128157
129- 1 . Reports dumped into ` reports/ `
130- 2 . Documentation dumped into ` docs/build/html/ `
131- 3 . Distribution dumped into ` dist/ `
158+ 1 . [ pre-commit hooks] ( https://pre-commit.com/ ) will run automatically on commit
159+ to ensure code quality.
160+ 2 . We use the conventional commits format - see the
161+ [ code style guide] ( CODE_STYLE.md ) for the mandatory commit message format.
132162
133- ### Running GitHub CI workflow locally
163+ ### Publish Release
134164
135165``` shell
136- uv run nox -s act
166+ make bump # Patch release
167+ make minor # Patch release
168+ make major # Patch release
169+ make x.y.z # Targeted release
137170```
138171
139172Notes:
140173
141- - Workflow defined in ` .github/workflows/*.yml `
142- - test-and-report.yml calls all build steps defined in noxfile.py
174+ 1 . Changelog generated automatically
175+ 2 . Publishes to PyPi, Docker Registries, Read The Docs, Streamlit and Auditing
176+ services
177+
178+ ## Advanced usage
179+
180+ ### Running GitHub CI Workflow locally
181+
182+ ``` shell
183+ make act
184+ ```
185+
186+ Notes:
187+
188+ 1 . Workflow defined in ` .github/workflows/*.yml `
189+ 2 . test-and-report.yml calls all build steps defined in noxfile.py
190+
191+ ### Docker
192+
193+ Build and run the Docker image with plain Docker
194+
195+ ``` shell
196+ # Build from Dockerimage
197+ make docker build
198+ # Run the CLI
199+ docker run --env THE_VAR=THE_VALUE starbridge --help
200+ ```
201+
202+ Build and run the Docker image with docker compose:
203+
204+ ``` shell
205+ echo " Building the Docker image with docker compose and running CLI..."
206+ docker compose run --build oe-python-template --help
207+ echo " Building the Docker image with docker compose and running API container as a daemon ..."
208+ docker compose up --build -d
209+ echo " Waiting for the API server to start..."
210+ sleep 5
211+ echo " Checking health of v1 API ..."
212+ curl http://127.0.0.1:8000/api/v1/healthz
213+ echo " "
214+ echo " Saying hello world with v1 API ..."
215+ curl http://127.0.0.1:8000/api/v1/hello-world
216+ echo " "
217+ echo " Swagger docs of v1 API ..."
218+ curl http://127.0.0.1:8000/api/v1/docs
219+ echo " "
220+ echo " Checking health of v2 API ..."
221+ curl http://127.0.0.1:8000/api/v2/healthz
222+ echo " "
223+ echo " Saying hello world with v1 API ..."
224+ curl http://127.0.0.1:8000/api/v2/hello-world
225+ echo " "
226+ echo " Swagger docs of v2 API ..."
227+ curl http://127.0.0.1:8000/api/v2/docs
228+ echo " "
229+ echo " Shutting down the API container ..."
230+ docker compose down
231+ ```
232+
233+ ### Pinning GitHub Actions
234+
235+ ``` shell
236+ pinact run # See https://dev.to/suzukishunsuke/pin-github-actions-to-a-full-length-commit-sha-for-security-2n7p
237+ ```
143238
144- ### Copier
239+ ## Update from Template
145240
146- Update from template
241+ Update project to latest version of
242+ [ oe-python-template] ( https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template )
243+ template.
147244
148245``` shell
149- uv run nox -s update_from_template
246+ make update_from_template
150247```
151248
152249## Pull Request Guidelines
153250
154- - Before starting to write code read the [ code style guide] ( CODE_STYLE.md )
155- document for mandatory coding style guidelines.
156- - ** Pre-Commit Hooks:** We use pre-commit hooks to ensure code quality. Please
157- install the pre-commit hooks by running ` uv run pre-commit install ` . This
158- ensure all tests, linting etc. pass locally before you can commit.
159- - ** Squash Commits:** Before submitting a pull request, please squash your
160- commits into a single commit.
161- - ** Branch Naming:** Use descriptive branch names like ` feature/your-feature ` or
162- ` fix/issue-number ` .
163- - ** Testing:** Ensure new features have appropriate test coverage.
164- - ** Documentation:** Update documentation to reflect any changes or new
165- features.
251+ 1 . Before starting to write code read the [ code style] ( CODE_STYLE.md ) document
252+ for mandatory coding style requirements.
253+ 2 . ** Pre-Commit Hooks:** We use pre-commit hooks to ensure code quality. Please
254+ install the pre-commit hooks by running ` uv run pre-commit install ` . This
255+ ensure all tests, linting etc. pass locally before you can commit.
256+ 3 . ** Squash Commits:** Before submitting a pull request, please squash your
257+ commits into a single commit.
258+ 4 . ** Signed Commits:** Use
259+ [ signed commits] ( https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits ) .
260+ 5 . ** Branch Naming:** Use descriptive branch names like ` feature/your-feature `
261+ or ` fix/issue-number ` .
262+ 6 . ** Testing:** Ensure new features have appropriate test coverage.
263+ 7 . ** Documentation:** Update documentation to reflect any changes or new
264+ features.
0 commit comments