bb-run 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
bb_run-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Karl Hill
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
bb_run-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,248 @@
1
+ Metadata-Version: 2.4
2
+ Name: bb-run
3
+ Version: 1.0.0
4
+ Summary: Run Bitbucket Pipelines locally
5
+ Author-email: Karl Hill <karlhillx@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/karlhillx/bb-run
8
+ Requires-Python: >=3.12
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: PyYAML>=6.0
12
+ Provides-Extra: test
13
+ Requires-Dist: pytest>=8.0; extra == "test"
14
+ Requires-Dist: pytest-cov>=4.0; extra == "test"
15
+ Provides-Extra: dev
16
+ Requires-Dist: pytest>=8.0; extra == "dev"
17
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
18
+ Requires-Dist: ruff>=0.4; extra == "dev"
19
+ Dynamic: license-file
20
+
21
+ # bb-run
22
+
23
+ [![Version](https://img.shields.io/badge/dynamic/toml?url=https%3A%2F%2Fraw.githubusercontent.com%2Fkarlhillx%2Fbb-run%2Fmain%2Fpyproject.toml&query=project.version&label=version)](https://github.com/karlhillx/bb-run/blob/main/pyproject.toml)
24
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
25
+ [![Python 3.12+](https://img.shields.io/badge/python-3.12%2B-blue.svg)](https://github.com/karlhillx/bb-run/blob/main/pyproject.toml)
26
+ [![Test](https://github.com/karlhillx/bb-run/actions/workflows/test.yml/badge.svg)](https://github.com/karlhillx/bb-run/actions/workflows/test.yml)
27
+
28
+ **Run Bitbucket Pipelines locally.** bb-run faithfully executes your `bitbucket-pipelines.yml` on your local machine using Docker or directly on your host.
29
+
30
+ ## Why bb-run?
31
+
32
+ - **Test before pushing** - Catch CI failures locally before committing
33
+ - **Fast iteration** - No waiting for Bitbucket's pipeline queue
34
+ - **Debug easily** - Run in verbose mode, inspect outputs directly
35
+ - **Two modes** - Docker for Bitbucket-accurate execution, Host for quick local testing
36
+ - **No dependencies** - Works with just Python and Docker (optional)
37
+
38
+ ## Installation
39
+
40
+ ### via pip
41
+
42
+ ```bash
43
+ pip install bb-run
44
+ ```
45
+
46
+ ### via Homebrew
47
+
48
+ ```bash
49
+ brew install karlhillx/tap/bb-run
50
+ ```
51
+
52
+ ### from source
53
+
54
+ ```bash
55
+ git clone https://github.com/karlhillx/bb-run.git
56
+ cd bb-run
57
+ pip install -e .
58
+ ```
59
+
60
+ ## Quick Start
61
+
62
+ ### Validate a pipeline (instant)
63
+
64
+ ```bash
65
+ bb-run --validate
66
+ ```
67
+
68
+ ### Run the default pipeline
69
+
70
+ ```bash
71
+ bb-run
72
+ ```
73
+
74
+ ### Run a specific branch
75
+
76
+ ```bash
77
+ bb-run --target branches.main
78
+ bb-run -t branches.main
79
+ ```
80
+
81
+ ### Simulate a feature branch
82
+
83
+ ```bash
84
+ bb-run --branch feature/my-work
85
+ ```
86
+
87
+ ### Run on your host (no Docker)
88
+
89
+ ```bash
90
+ bb-run --mode host
91
+ ```
92
+
93
+ ### Pass variables
94
+
95
+ ```bash
96
+ bb-run -v ENVIRONMENT=staging -v API_KEY=secret
97
+ ```
98
+
99
+ ### List available targets
100
+
101
+ ```bash
102
+ bb-run --list-targets
103
+ ```
104
+
105
+ ## Modes
106
+
107
+ ### Docker Mode (default)
108
+
109
+ Runs steps in Docker containers matching Bitbucket's build environment.
110
+
111
+ ```bash
112
+ bb-run --mode docker
113
+ ```
114
+
115
+ **Pros:** Faithful reproduction of Bitbucket's environment
116
+ **Cons:** Requires Docker, images may take time to download
117
+
118
+ ### Host Mode
119
+
120
+ Runs steps directly on your local machine.
121
+
122
+ ```bash
123
+ bb-run --mode host
124
+ ```
125
+
126
+ **Pros:** Fast, no image downloads
127
+ **Cons:** May differ from Bitbucket's environment (Python vs Python3, etc.)
128
+
129
+ ## Examples
130
+
131
+ ### Python project
132
+
133
+ ```bash
134
+ cd my-python-project
135
+ bb-run
136
+ ```
137
+
138
+ ### Node.js project
139
+
140
+ ```bash
141
+ cd my-node-project
142
+ bb-run --target branches.main
143
+ ```
144
+
145
+ ### Run with verbose output
146
+
147
+ ```bash
148
+ bb-run --verbose
149
+ ```
150
+
151
+ ## Configuration
152
+
153
+ bb-run automatically looks for `bitbucket-pipelines.yml` in your current directory. Use `--repo` to specify a different path:
154
+
155
+ ```bash
156
+ bb-run --repo /path/to/repo
157
+ ```
158
+
159
+ ## Requirements
160
+
161
+ - Python 3.12+
162
+ - PyYAML
163
+ - Docker (for Docker mode)
164
+
165
+ ### Local development (virtualenv)
166
+
167
+ Use Python 3.12 for the project venv so `python --version` matches `requires-python` in `pyproject.toml`:
168
+
169
+ ```bash
170
+ # macOS (Homebrew)
171
+ brew install python@3.12
172
+ "$(brew --prefix python@3.12)/bin/python3.12" -m venv .venv
173
+ source .venv/bin/activate
174
+ pip install -e ".[dev]"
175
+ # or tests + coverage only: pip install -e ".[test]"
176
+ python -m pytest
177
+ python -m pytest --cov=bbrun --cov-report=xml tests/
178
+ ruff check bbrun
179
+ ```
180
+
181
+ ## Environment Variables
182
+
183
+ bb-run sets these Bitbucket-specific environment variables:
184
+
185
+ | Variable | Description |
186
+ |----------|-------------|
187
+ | `BITBUCKET_BUILD_NUMBER` | Build number (set to "1") |
188
+ | `BITBUCKET_CLONE_DIR` | Repository path |
189
+ | `BITBUCKET_COMMIT` | Git commit SHA |
190
+ | `BITBUCKET_BRANCH` | Branch name |
191
+ | `BITBUCKET_REPO_SLUG` | Repository name |
192
+ | `BITBUCKET_REPO_UUID` | Unique run ID |
193
+ | `BITBUCKET_WORKSPACE` | Workspace (set to "local") |
194
+
195
+ ## Troubleshooting
196
+
197
+ ### "Docker is not available"
198
+
199
+ Use `--mode host` to run on your local machine instead of in Docker:
200
+
201
+ ```bash
202
+ bb-run --mode host
203
+ ```
204
+
205
+ ### "pip: command not found"
206
+
207
+ bb-run automatically translates `pip` to `pip3` and adds `--break-system-packages` for PEP 668 environments.
208
+
209
+ ### `pytest: error: unrecognized arguments: --cov=...`
210
+
211
+ Coverage flags come from the **pytest-cov** plugin. Install the `test` or `dev` extra, then use the same interpreter for pytest:
212
+
213
+ ```bash
214
+ pip install -e ".[dev]"
215
+ # or: pip install -e ".[test]"
216
+ python -m pytest --cov=bbrun --cov-report=xml tests/
217
+ ```
218
+
219
+ ### Image pull failures
220
+
221
+ Docker Hub rate limits may cause image downloads to fail. Try:
222
+ 1. Waiting and retrying later
223
+ 2. Using `--mode host` temporarily
224
+ 3. Configuring a Docker mirror
225
+
226
+ ## License
227
+
228
+ MIT License - see [LICENSE](LICENSE) for details.
229
+
230
+ ## Contributing
231
+
232
+ Contributions welcome! Please open an issue or submit a PR.
233
+
234
+ ## Publishing to PyPI
235
+
236
+ The package name **`bb-run`** must exist on PyPI (first upload is manual or via this workflow after [trusted publishing](https://docs.pypi.org/trusted-publishers/adding-a-publisher/) is configured).
237
+
238
+ 1. In PyPI, add a **pending publisher** for this GitHub repo and workflow `publish.yml`, environment **`pypi`**.
239
+ 2. In GitHub → **Settings → Environments**, create environment **`pypi`** (no secrets needed for trusted publishing).
240
+ 3. Bump `version` in `pyproject.toml`, merge, then **create a GitHub Release** (or run the workflow manually after a release).
241
+
242
+ Badges in this README use **GitHub** (version from `pyproject.toml` on `main`) so they stay valid before the first PyPI release. After publishing, you can add e.g. `https://img.shields.io/pypi/v/bb-run.svg`.
243
+
244
+ ## Links
245
+
246
+ - [PyPI project](https://pypi.org/project/bb-run/) (live after first successful upload)
247
+ - [GitHub Repository](https://github.com/karlhillx/bb-run)
248
+ - [Issue Tracker](https://github.com/karlhillx/bb-run/issues)
bb_run-1.0.0/README.md ADDED
@@ -0,0 +1,228 @@
1
+ # bb-run
2
+
3
+ [![Version](https://img.shields.io/badge/dynamic/toml?url=https%3A%2F%2Fraw.githubusercontent.com%2Fkarlhillx%2Fbb-run%2Fmain%2Fpyproject.toml&query=project.version&label=version)](https://github.com/karlhillx/bb-run/blob/main/pyproject.toml)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![Python 3.12+](https://img.shields.io/badge/python-3.12%2B-blue.svg)](https://github.com/karlhillx/bb-run/blob/main/pyproject.toml)
6
+ [![Test](https://github.com/karlhillx/bb-run/actions/workflows/test.yml/badge.svg)](https://github.com/karlhillx/bb-run/actions/workflows/test.yml)
7
+
8
+ **Run Bitbucket Pipelines locally.** bb-run faithfully executes your `bitbucket-pipelines.yml` on your local machine using Docker or directly on your host.
9
+
10
+ ## Why bb-run?
11
+
12
+ - **Test before pushing** - Catch CI failures locally before committing
13
+ - **Fast iteration** - No waiting for Bitbucket's pipeline queue
14
+ - **Debug easily** - Run in verbose mode, inspect outputs directly
15
+ - **Two modes** - Docker for Bitbucket-accurate execution, Host for quick local testing
16
+ - **No dependencies** - Works with just Python and Docker (optional)
17
+
18
+ ## Installation
19
+
20
+ ### via pip
21
+
22
+ ```bash
23
+ pip install bb-run
24
+ ```
25
+
26
+ ### via Homebrew
27
+
28
+ ```bash
29
+ brew install karlhillx/tap/bb-run
30
+ ```
31
+
32
+ ### from source
33
+
34
+ ```bash
35
+ git clone https://github.com/karlhillx/bb-run.git
36
+ cd bb-run
37
+ pip install -e .
38
+ ```
39
+
40
+ ## Quick Start
41
+
42
+ ### Validate a pipeline (instant)
43
+
44
+ ```bash
45
+ bb-run --validate
46
+ ```
47
+
48
+ ### Run the default pipeline
49
+
50
+ ```bash
51
+ bb-run
52
+ ```
53
+
54
+ ### Run a specific branch
55
+
56
+ ```bash
57
+ bb-run --target branches.main
58
+ bb-run -t branches.main
59
+ ```
60
+
61
+ ### Simulate a feature branch
62
+
63
+ ```bash
64
+ bb-run --branch feature/my-work
65
+ ```
66
+
67
+ ### Run on your host (no Docker)
68
+
69
+ ```bash
70
+ bb-run --mode host
71
+ ```
72
+
73
+ ### Pass variables
74
+
75
+ ```bash
76
+ bb-run -v ENVIRONMENT=staging -v API_KEY=secret
77
+ ```
78
+
79
+ ### List available targets
80
+
81
+ ```bash
82
+ bb-run --list-targets
83
+ ```
84
+
85
+ ## Modes
86
+
87
+ ### Docker Mode (default)
88
+
89
+ Runs steps in Docker containers matching Bitbucket's build environment.
90
+
91
+ ```bash
92
+ bb-run --mode docker
93
+ ```
94
+
95
+ **Pros:** Faithful reproduction of Bitbucket's environment
96
+ **Cons:** Requires Docker, images may take time to download
97
+
98
+ ### Host Mode
99
+
100
+ Runs steps directly on your local machine.
101
+
102
+ ```bash
103
+ bb-run --mode host
104
+ ```
105
+
106
+ **Pros:** Fast, no image downloads
107
+ **Cons:** May differ from Bitbucket's environment (Python vs Python3, etc.)
108
+
109
+ ## Examples
110
+
111
+ ### Python project
112
+
113
+ ```bash
114
+ cd my-python-project
115
+ bb-run
116
+ ```
117
+
118
+ ### Node.js project
119
+
120
+ ```bash
121
+ cd my-node-project
122
+ bb-run --target branches.main
123
+ ```
124
+
125
+ ### Run with verbose output
126
+
127
+ ```bash
128
+ bb-run --verbose
129
+ ```
130
+
131
+ ## Configuration
132
+
133
+ bb-run automatically looks for `bitbucket-pipelines.yml` in your current directory. Use `--repo` to specify a different path:
134
+
135
+ ```bash
136
+ bb-run --repo /path/to/repo
137
+ ```
138
+
139
+ ## Requirements
140
+
141
+ - Python 3.12+
142
+ - PyYAML
143
+ - Docker (for Docker mode)
144
+
145
+ ### Local development (virtualenv)
146
+
147
+ Use Python 3.12 for the project venv so `python --version` matches `requires-python` in `pyproject.toml`:
148
+
149
+ ```bash
150
+ # macOS (Homebrew)
151
+ brew install python@3.12
152
+ "$(brew --prefix python@3.12)/bin/python3.12" -m venv .venv
153
+ source .venv/bin/activate
154
+ pip install -e ".[dev]"
155
+ # or tests + coverage only: pip install -e ".[test]"
156
+ python -m pytest
157
+ python -m pytest --cov=bbrun --cov-report=xml tests/
158
+ ruff check bbrun
159
+ ```
160
+
161
+ ## Environment Variables
162
+
163
+ bb-run sets these Bitbucket-specific environment variables:
164
+
165
+ | Variable | Description |
166
+ |----------|-------------|
167
+ | `BITBUCKET_BUILD_NUMBER` | Build number (set to "1") |
168
+ | `BITBUCKET_CLONE_DIR` | Repository path |
169
+ | `BITBUCKET_COMMIT` | Git commit SHA |
170
+ | `BITBUCKET_BRANCH` | Branch name |
171
+ | `BITBUCKET_REPO_SLUG` | Repository name |
172
+ | `BITBUCKET_REPO_UUID` | Unique run ID |
173
+ | `BITBUCKET_WORKSPACE` | Workspace (set to "local") |
174
+
175
+ ## Troubleshooting
176
+
177
+ ### "Docker is not available"
178
+
179
+ Use `--mode host` to run on your local machine instead of in Docker:
180
+
181
+ ```bash
182
+ bb-run --mode host
183
+ ```
184
+
185
+ ### "pip: command not found"
186
+
187
+ bb-run automatically translates `pip` to `pip3` and adds `--break-system-packages` for PEP 668 environments.
188
+
189
+ ### `pytest: error: unrecognized arguments: --cov=...`
190
+
191
+ Coverage flags come from the **pytest-cov** plugin. Install the `test` or `dev` extra, then use the same interpreter for pytest:
192
+
193
+ ```bash
194
+ pip install -e ".[dev]"
195
+ # or: pip install -e ".[test]"
196
+ python -m pytest --cov=bbrun --cov-report=xml tests/
197
+ ```
198
+
199
+ ### Image pull failures
200
+
201
+ Docker Hub rate limits may cause image downloads to fail. Try:
202
+ 1. Waiting and retrying later
203
+ 2. Using `--mode host` temporarily
204
+ 3. Configuring a Docker mirror
205
+
206
+ ## License
207
+
208
+ MIT License - see [LICENSE](LICENSE) for details.
209
+
210
+ ## Contributing
211
+
212
+ Contributions welcome! Please open an issue or submit a PR.
213
+
214
+ ## Publishing to PyPI
215
+
216
+ The package name **`bb-run`** must exist on PyPI (first upload is manual or via this workflow after [trusted publishing](https://docs.pypi.org/trusted-publishers/adding-a-publisher/) is configured).
217
+
218
+ 1. In PyPI, add a **pending publisher** for this GitHub repo and workflow `publish.yml`, environment **`pypi`**.
219
+ 2. In GitHub → **Settings → Environments**, create environment **`pypi`** (no secrets needed for trusted publishing).
220
+ 3. Bump `version` in `pyproject.toml`, merge, then **create a GitHub Release** (or run the workflow manually after a release).
221
+
222
+ Badges in this README use **GitHub** (version from `pyproject.toml` on `main`) so they stay valid before the first PyPI release. After publishing, you can add e.g. `https://img.shields.io/pypi/v/bb-run.svg`.
223
+
224
+ ## Links
225
+
226
+ - [PyPI project](https://pypi.org/project/bb-run/) (live after first successful upload)
227
+ - [GitHub Repository](https://github.com/karlhillx/bb-run)
228
+ - [Issue Tracker](https://github.com/karlhillx/bb-run/issues)