pypeline-runner 0.1.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.
- pypeline_runner-0.1.0/LICENSE +22 -0
- pypeline_runner-0.1.0/PKG-INFO +120 -0
- pypeline_runner-0.1.0/README.md +92 -0
- pypeline_runner-0.1.0/pyproject.toml +163 -0
- pypeline_runner-0.1.0/src/pypeline/__init__.py +1 -0
- pypeline_runner-0.1.0/src/pypeline/__run.py +12 -0
- pypeline_runner-0.1.0/src/pypeline/domain/__init__.py +0 -0
- pypeline_runner-0.1.0/src/pypeline/domain/artifacts.py +36 -0
- pypeline_runner-0.1.0/src/pypeline/domain/config.py +36 -0
- pypeline_runner-0.1.0/src/pypeline/domain/execution_context.py +27 -0
- pypeline_runner-0.1.0/src/pypeline/domain/pipeline.py +28 -0
- pypeline_runner-0.1.0/src/pypeline/domain/project_slurper.py +22 -0
- pypeline_runner-0.1.0/src/pypeline/kickstart/__init__.py +0 -0
- pypeline_runner-0.1.0/src/pypeline/kickstart/create.py +58 -0
- pypeline_runner-0.1.0/src/pypeline/kickstart/templates/bootstrap/bootstrap.ps1 +137 -0
- pypeline_runner-0.1.0/src/pypeline/kickstart/templates/bootstrap/bootstrap.py +428 -0
- pypeline_runner-0.1.0/src/pypeline/kickstart/templates/project/.gitignore +2 -0
- pypeline_runner-0.1.0/src/pypeline/kickstart/templates/project/poetry.toml +2 -0
- pypeline_runner-0.1.0/src/pypeline/kickstart/templates/project/pypeline.yaml +10 -0
- pypeline_runner-0.1.0/src/pypeline/kickstart/templates/project/pyproject.toml +8 -0
- pypeline_runner-0.1.0/src/pypeline/kickstart/templates/project/scoopfile.json +14 -0
- pypeline_runner-0.1.0/src/pypeline/kickstart/templates/project/steps/my_step.py +25 -0
- pypeline_runner-0.1.0/src/pypeline/main.py +101 -0
- pypeline_runner-0.1.0/src/pypeline/py.typed +0 -0
- pypeline_runner-0.1.0/src/pypeline/pypeline.py +93 -0
- pypeline_runner-0.1.0/src/pypeline/steps/__init__.py +0 -0
- pypeline_runner-0.1.0/src/pypeline/steps/create_venv.py +43 -0
- pypeline_runner-0.1.0/src/pypeline/steps/scoop_install.py +87 -0
- pypeline_runner-0.1.0/src/pypeline/steps/west_install.py +54 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
MIT License
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2024 cuinixam
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: pypeline-runner
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Configure and execute pipelines with Python (similar to GitHub workflows or Jenkins pipelines).
|
|
5
|
+
Home-page: https://github.com/cuinixam/pypeline
|
|
6
|
+
License: MIT
|
|
7
|
+
Author: cuinixam
|
|
8
|
+
Author-email: me@cuinixam.com
|
|
9
|
+
Requires-Python: >=3.10,<4.0
|
|
10
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Natural Language :: English
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
20
|
+
Requires-Dist: py-app-dev (>=2.1.0,<3.0.0)
|
|
21
|
+
Requires-Dist: typer[all] (>=0.12.0,<0.13.0)
|
|
22
|
+
Project-URL: Bug Tracker, https://github.com/cuinixam/pypeline/issues
|
|
23
|
+
Project-URL: Changelog, https://github.com/cuinixam/pypeline/blob/main/CHANGELOG.md
|
|
24
|
+
Project-URL: Documentation, https://pypeline-runner.readthedocs.io
|
|
25
|
+
Project-URL: Repository, https://github.com/cuinixam/pypeline
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# Python Pipeline
|
|
29
|
+
|
|
30
|
+
<p align="center">
|
|
31
|
+
<a href="https://github.com/cuinixam/pypeline/actions/workflows/ci.yml?query=branch%3Amain">
|
|
32
|
+
<img src="https://img.shields.io/github/actions/workflow/status/cuinixam/pypeline/ci.yml?branch=main&label=CI&logo=github&style=flat-square" alt="CI Status" >
|
|
33
|
+
</a>
|
|
34
|
+
<a href="https://pypeline.readthedocs.io">
|
|
35
|
+
<img src="https://img.shields.io/readthedocs/pypeline.svg?logo=read-the-docs&logoColor=fff&style=flat-square" alt="Documentation Status">
|
|
36
|
+
</a>
|
|
37
|
+
<a href="https://codecov.io/gh/cuinixam/pypeline">
|
|
38
|
+
<img src="https://img.shields.io/codecov/c/github/cuinixam/pypeline.svg?logo=codecov&logoColor=fff&style=flat-square" alt="Test coverage percentage">
|
|
39
|
+
</a>
|
|
40
|
+
</p>
|
|
41
|
+
<p align="center">
|
|
42
|
+
<a href="https://python-poetry.org/">
|
|
43
|
+
<img src="https://img.shields.io/badge/packaging-poetry-299bd7?style=flat-square&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAASCAYAAABrXO8xAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJJSURBVHgBfZLPa1NBEMe/s7tNXoxW1KJQKaUHkXhQvHgW6UHQQ09CBS/6V3hKc/AP8CqCrUcpmop3Cx48eDB4yEECjVQrlZb80CRN8t6OM/teagVxYZi38+Yz853dJbzoMV3MM8cJUcLMSUKIE8AzQ2PieZzFxEJOHMOgMQQ+dUgSAckNXhapU/NMhDSWLs1B24A8sO1xrN4NECkcAC9ASkiIJc6k5TRiUDPhnyMMdhKc+Zx19l6SgyeW76BEONY9exVQMzKExGKwwPsCzza7KGSSWRWEQhyEaDXp6ZHEr416ygbiKYOd7TEWvvcQIeusHYMJGhTwF9y7sGnSwaWyFAiyoxzqW0PM/RjghPxF2pWReAowTEXnDh0xgcLs8l2YQmOrj3N7ByiqEoH0cARs4u78WgAVkoEDIDoOi3AkcLOHU60RIg5wC4ZuTC7FaHKQm8Hq1fQuSOBvX/sodmNJSB5geaF5CPIkUeecdMxieoRO5jz9bheL6/tXjrwCyX/UYBUcjCaWHljx1xiX6z9xEjkYAzbGVnB8pvLmyXm9ep+W8CmsSHQQY77Zx1zboxAV0w7ybMhQmfqdmmw3nEp1I0Z+FGO6M8LZdoyZnuzzBdjISicKRnpxzI9fPb+0oYXsNdyi+d3h9bm9MWYHFtPeIZfLwzmFDKy1ai3p+PDls1Llz4yyFpferxjnyjJDSEy9CaCx5m2cJPerq6Xm34eTrZt3PqxYO1XOwDYZrFlH1fWnpU38Y9HRze3lj0vOujZcXKuuXm3jP+s3KbZVra7y2EAAAAAASUVORK5CYII=" alt="Poetry">
|
|
44
|
+
</a>
|
|
45
|
+
<a href="https://github.com/astral-sh/ruff">
|
|
46
|
+
<img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="ruff">
|
|
47
|
+
</a>
|
|
48
|
+
<a href="https://github.com/pre-commit/pre-commit">
|
|
49
|
+
<img src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=flat-square" alt="pre-commit">
|
|
50
|
+
</a>
|
|
51
|
+
</p>
|
|
52
|
+
<p align="center">
|
|
53
|
+
<a href="https://pypi.org/project/pypeline/">
|
|
54
|
+
<img src="https://img.shields.io/pypi/v/pypeline.svg?logo=python&logoColor=fff&style=flat-square" alt="PyPI Version">
|
|
55
|
+
</a>
|
|
56
|
+
<img src="https://img.shields.io/pypi/pyversions/pypeline.svg?style=flat-square&logo=python&logoColor=fff" alt="Supported Python versions">
|
|
57
|
+
<img src="https://img.shields.io/pypi/l/pypeline.svg?style=flat-square" alt="License">
|
|
58
|
+
</p>
|
|
59
|
+
|
|
60
|
+
Configure and execute steps for developing a python package.
|
|
61
|
+
|
|
62
|
+
## Installation
|
|
63
|
+
|
|
64
|
+
Install this via pip (or your favourite package manager):
|
|
65
|
+
|
|
66
|
+
`pip install pypeline`
|
|
67
|
+
|
|
68
|
+
## Start developing
|
|
69
|
+
|
|
70
|
+
The project uses Poetry for dependencies management and packaging.
|
|
71
|
+
Run the `bootstrap.ps1` script to install Python and create the virtual environment.
|
|
72
|
+
|
|
73
|
+
```powershell
|
|
74
|
+
.\bootstrap.ps1
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
This will also generate a `poetry.lock` file, you should track this file in version control.
|
|
78
|
+
|
|
79
|
+
To execute the test suite, call pytest inside Poetry's virtual environment via `poetry run`:
|
|
80
|
+
|
|
81
|
+
```shell
|
|
82
|
+
.venv/Scripts/poetry run pytest
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Check out the Poetry documentation for more information on the available commands.
|
|
86
|
+
|
|
87
|
+
For those using [VS Code](https://code.visualstudio.com/) there are tasks defined for the most common commands:
|
|
88
|
+
|
|
89
|
+
- bootstrap
|
|
90
|
+
- install dependencies
|
|
91
|
+
- run tests
|
|
92
|
+
- run all checks configured for pre-commit
|
|
93
|
+
- generate documentation
|
|
94
|
+
|
|
95
|
+
See the `.vscode/tasks.json` for more details.
|
|
96
|
+
|
|
97
|
+
## Committing changes
|
|
98
|
+
|
|
99
|
+
This repository uses [commitlint](https://github.com/conventional-changelog/commitlint) for checking if the commit message meets the [conventional commit format](https://www.conventionalcommits.org/en).
|
|
100
|
+
|
|
101
|
+
## Contributors ✨
|
|
102
|
+
|
|
103
|
+
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
|
|
104
|
+
|
|
105
|
+
<!-- prettier-ignore-start -->
|
|
106
|
+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
107
|
+
<!-- markdownlint-disable -->
|
|
108
|
+
<!-- markdownlint-enable -->
|
|
109
|
+
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
110
|
+
<!-- prettier-ignore-end -->
|
|
111
|
+
|
|
112
|
+
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
|
|
113
|
+
|
|
114
|
+
## Credits
|
|
115
|
+
|
|
116
|
+
This package was created with
|
|
117
|
+
[Copier](https://copier.readthedocs.io/) and the
|
|
118
|
+
[cuinixam/pypackage-template](https://github.com/cuinixam/pypackage-template)
|
|
119
|
+
project template.
|
|
120
|
+
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Python Pipeline
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://github.com/cuinixam/pypeline/actions/workflows/ci.yml?query=branch%3Amain">
|
|
5
|
+
<img src="https://img.shields.io/github/actions/workflow/status/cuinixam/pypeline/ci.yml?branch=main&label=CI&logo=github&style=flat-square" alt="CI Status" >
|
|
6
|
+
</a>
|
|
7
|
+
<a href="https://pypeline.readthedocs.io">
|
|
8
|
+
<img src="https://img.shields.io/readthedocs/pypeline.svg?logo=read-the-docs&logoColor=fff&style=flat-square" alt="Documentation Status">
|
|
9
|
+
</a>
|
|
10
|
+
<a href="https://codecov.io/gh/cuinixam/pypeline">
|
|
11
|
+
<img src="https://img.shields.io/codecov/c/github/cuinixam/pypeline.svg?logo=codecov&logoColor=fff&style=flat-square" alt="Test coverage percentage">
|
|
12
|
+
</a>
|
|
13
|
+
</p>
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="https://python-poetry.org/">
|
|
16
|
+
<img src="https://img.shields.io/badge/packaging-poetry-299bd7?style=flat-square&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAASCAYAAABrXO8xAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJJSURBVHgBfZLPa1NBEMe/s7tNXoxW1KJQKaUHkXhQvHgW6UHQQ09CBS/6V3hKc/AP8CqCrUcpmop3Cx48eDB4yEECjVQrlZb80CRN8t6OM/teagVxYZi38+Yz853dJbzoMV3MM8cJUcLMSUKIE8AzQ2PieZzFxEJOHMOgMQQ+dUgSAckNXhapU/NMhDSWLs1B24A8sO1xrN4NECkcAC9ASkiIJc6k5TRiUDPhnyMMdhKc+Zx19l6SgyeW76BEONY9exVQMzKExGKwwPsCzza7KGSSWRWEQhyEaDXp6ZHEr416ygbiKYOd7TEWvvcQIeusHYMJGhTwF9y7sGnSwaWyFAiyoxzqW0PM/RjghPxF2pWReAowTEXnDh0xgcLs8l2YQmOrj3N7ByiqEoH0cARs4u78WgAVkoEDIDoOi3AkcLOHU60RIg5wC4ZuTC7FaHKQm8Hq1fQuSOBvX/sodmNJSB5geaF5CPIkUeecdMxieoRO5jz9bheL6/tXjrwCyX/UYBUcjCaWHljx1xiX6z9xEjkYAzbGVnB8pvLmyXm9ep+W8CmsSHQQY77Zx1zboxAV0w7ybMhQmfqdmmw3nEp1I0Z+FGO6M8LZdoyZnuzzBdjISicKRnpxzI9fPb+0oYXsNdyi+d3h9bm9MWYHFtPeIZfLwzmFDKy1ai3p+PDls1Llz4yyFpferxjnyjJDSEy9CaCx5m2cJPerq6Xm34eTrZt3PqxYO1XOwDYZrFlH1fWnpU38Y9HRze3lj0vOujZcXKuuXm3jP+s3KbZVra7y2EAAAAAASUVORK5CYII=" alt="Poetry">
|
|
17
|
+
</a>
|
|
18
|
+
<a href="https://github.com/astral-sh/ruff">
|
|
19
|
+
<img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="ruff">
|
|
20
|
+
</a>
|
|
21
|
+
<a href="https://github.com/pre-commit/pre-commit">
|
|
22
|
+
<img src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=flat-square" alt="pre-commit">
|
|
23
|
+
</a>
|
|
24
|
+
</p>
|
|
25
|
+
<p align="center">
|
|
26
|
+
<a href="https://pypi.org/project/pypeline/">
|
|
27
|
+
<img src="https://img.shields.io/pypi/v/pypeline.svg?logo=python&logoColor=fff&style=flat-square" alt="PyPI Version">
|
|
28
|
+
</a>
|
|
29
|
+
<img src="https://img.shields.io/pypi/pyversions/pypeline.svg?style=flat-square&logo=python&logoColor=fff" alt="Supported Python versions">
|
|
30
|
+
<img src="https://img.shields.io/pypi/l/pypeline.svg?style=flat-square" alt="License">
|
|
31
|
+
</p>
|
|
32
|
+
|
|
33
|
+
Configure and execute steps for developing a python package.
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
Install this via pip (or your favourite package manager):
|
|
38
|
+
|
|
39
|
+
`pip install pypeline`
|
|
40
|
+
|
|
41
|
+
## Start developing
|
|
42
|
+
|
|
43
|
+
The project uses Poetry for dependencies management and packaging.
|
|
44
|
+
Run the `bootstrap.ps1` script to install Python and create the virtual environment.
|
|
45
|
+
|
|
46
|
+
```powershell
|
|
47
|
+
.\bootstrap.ps1
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
This will also generate a `poetry.lock` file, you should track this file in version control.
|
|
51
|
+
|
|
52
|
+
To execute the test suite, call pytest inside Poetry's virtual environment via `poetry run`:
|
|
53
|
+
|
|
54
|
+
```shell
|
|
55
|
+
.venv/Scripts/poetry run pytest
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Check out the Poetry documentation for more information on the available commands.
|
|
59
|
+
|
|
60
|
+
For those using [VS Code](https://code.visualstudio.com/) there are tasks defined for the most common commands:
|
|
61
|
+
|
|
62
|
+
- bootstrap
|
|
63
|
+
- install dependencies
|
|
64
|
+
- run tests
|
|
65
|
+
- run all checks configured for pre-commit
|
|
66
|
+
- generate documentation
|
|
67
|
+
|
|
68
|
+
See the `.vscode/tasks.json` for more details.
|
|
69
|
+
|
|
70
|
+
## Committing changes
|
|
71
|
+
|
|
72
|
+
This repository uses [commitlint](https://github.com/conventional-changelog/commitlint) for checking if the commit message meets the [conventional commit format](https://www.conventionalcommits.org/en).
|
|
73
|
+
|
|
74
|
+
## Contributors ✨
|
|
75
|
+
|
|
76
|
+
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
|
|
77
|
+
|
|
78
|
+
<!-- prettier-ignore-start -->
|
|
79
|
+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
80
|
+
<!-- markdownlint-disable -->
|
|
81
|
+
<!-- markdownlint-enable -->
|
|
82
|
+
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
83
|
+
<!-- prettier-ignore-end -->
|
|
84
|
+
|
|
85
|
+
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
|
|
86
|
+
|
|
87
|
+
## Credits
|
|
88
|
+
|
|
89
|
+
This package was created with
|
|
90
|
+
[Copier](https://copier.readthedocs.io/) and the
|
|
91
|
+
[cuinixam/pypackage-template](https://github.com/cuinixam/pypackage-template)
|
|
92
|
+
project template.
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "pypeline-runner"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Configure and execute pipelines with Python (similar to GitHub workflows or Jenkins pipelines)."
|
|
5
|
+
authors = ["cuinixam <me@cuinixam.com>"]
|
|
6
|
+
license = "MIT"
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
repository = "https://github.com/cuinixam/pypeline"
|
|
9
|
+
documentation = "https://pypeline-runner.readthedocs.io"
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Development Status :: 2 - Pre-Alpha",
|
|
12
|
+
"Intended Audience :: Developers",
|
|
13
|
+
"Natural Language :: English",
|
|
14
|
+
"Operating System :: OS Independent",
|
|
15
|
+
"Topic :: Software Development :: Libraries",
|
|
16
|
+
]
|
|
17
|
+
packages = [
|
|
18
|
+
{ include = "pypeline", from = "src" },
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[tool.poetry.scripts]
|
|
22
|
+
pypeline = "pypeline.main:main"
|
|
23
|
+
|
|
24
|
+
[tool.poetry.urls]
|
|
25
|
+
"Bug Tracker" = "https://github.com/cuinixam/pypeline/issues"
|
|
26
|
+
"Changelog" = "https://github.com/cuinixam/pypeline/blob/main/CHANGELOG.md"
|
|
27
|
+
|
|
28
|
+
[tool.poetry.dependencies]
|
|
29
|
+
python = "^3.10"
|
|
30
|
+
py-app-dev = "^2.1.0"
|
|
31
|
+
typer = {extras = ["all"], version = "^0.12.0"}
|
|
32
|
+
|
|
33
|
+
[tool.poetry.group.dev.dependencies]
|
|
34
|
+
pytest = "^7.0"
|
|
35
|
+
pytest-cov = "^4.0"
|
|
36
|
+
pre-commit = "^3.1.1"
|
|
37
|
+
ruff = "^0.3.0"
|
|
38
|
+
|
|
39
|
+
[tool.poetry.group.docs.dependencies]
|
|
40
|
+
myst-parser = ">=0.16"
|
|
41
|
+
sphinx = ">=4.0"
|
|
42
|
+
sphinxcontrib-mermaid = "^0.8.1"
|
|
43
|
+
mlx-traceability = "^10.0.0"
|
|
44
|
+
sphinx-copybutton = "^0.5.2"
|
|
45
|
+
sphinx-new-tab-link = "^0.2.2"
|
|
46
|
+
sphinx-book-theme = "^1.1.2"
|
|
47
|
+
sphinx-design = "^0.5.0"
|
|
48
|
+
|
|
49
|
+
[tool.semantic_release]
|
|
50
|
+
version_toml = ["pyproject.toml:tool.poetry.version"]
|
|
51
|
+
version_variables = [
|
|
52
|
+
"src/pypeline/__init__.py:__version__",
|
|
53
|
+
"docs/conf.py:release",
|
|
54
|
+
]
|
|
55
|
+
build_command = "pip install poetry && poetry build"
|
|
56
|
+
|
|
57
|
+
[tool.semantic_release.changelog]
|
|
58
|
+
exclude_commit_patterns = [
|
|
59
|
+
"chore*",
|
|
60
|
+
"ci*",
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
[tool.semantic_release.changelog.environment]
|
|
64
|
+
keep_trailing_newline = true
|
|
65
|
+
|
|
66
|
+
[tool.semantic_release.branches.main]
|
|
67
|
+
match = "main"
|
|
68
|
+
|
|
69
|
+
[tool.semantic_release.branches.noop]
|
|
70
|
+
match = "(?!main$)"
|
|
71
|
+
prerelease = true
|
|
72
|
+
|
|
73
|
+
[tool.pytest.ini_options]
|
|
74
|
+
addopts = "-vv -Wdefault --cov=pypeline --cov-report=term-missing:skip-covered"
|
|
75
|
+
pythonpath = ["src"]
|
|
76
|
+
|
|
77
|
+
[tool.coverage.run]
|
|
78
|
+
branch = true
|
|
79
|
+
source = ['src/']
|
|
80
|
+
omit = ['*/__run.py']
|
|
81
|
+
|
|
82
|
+
[tool.coverage.report]
|
|
83
|
+
exclude_lines = [
|
|
84
|
+
"pragma: no cover",
|
|
85
|
+
"@overload",
|
|
86
|
+
"if TYPE_CHECKING",
|
|
87
|
+
"raise NotImplementedError",
|
|
88
|
+
'if __name__ == "__main__":',
|
|
89
|
+
]
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
[tool.ruff]
|
|
93
|
+
target-version = "py38"
|
|
94
|
+
line-length = 180
|
|
95
|
+
lint.ignore = [
|
|
96
|
+
"D203", # 1 blank line required before class docstring
|
|
97
|
+
"D212", # Multi-line docstring summary should start at the first line
|
|
98
|
+
"D100", # Missing docstring in public module
|
|
99
|
+
"D101", # Missing docstring in public class
|
|
100
|
+
"D102", # Missing docstring in public method
|
|
101
|
+
"D103", # Missing docstring in public function
|
|
102
|
+
"D104", # Missing docstring in public package
|
|
103
|
+
"D107", # Missing docstring in `__init__`
|
|
104
|
+
"D401", # First line of docstring should be in imperative mood
|
|
105
|
+
]
|
|
106
|
+
lint.select = [
|
|
107
|
+
"B", # flake8-bugbear
|
|
108
|
+
"D", # flake8-docstrings
|
|
109
|
+
"C4", # flake8-comprehensions
|
|
110
|
+
"S", # flake8-bandit
|
|
111
|
+
"F", # pyflake
|
|
112
|
+
"E", # pycodestyle
|
|
113
|
+
"W", # pycodestyle
|
|
114
|
+
"UP", # pyupgrade
|
|
115
|
+
"I", # isort
|
|
116
|
+
"RUF", # ruff specific
|
|
117
|
+
]
|
|
118
|
+
exclude = [
|
|
119
|
+
"bootstrap.py"
|
|
120
|
+
]
|
|
121
|
+
|
|
122
|
+
[tool.ruff.lint.per-file-ignores]
|
|
123
|
+
"tests/**/*" = [
|
|
124
|
+
"D100",
|
|
125
|
+
"D101",
|
|
126
|
+
"D102",
|
|
127
|
+
"D103",
|
|
128
|
+
"D104",
|
|
129
|
+
"S101",
|
|
130
|
+
]
|
|
131
|
+
"setup.py" = ["D100"]
|
|
132
|
+
"conftest.py" = ["D100"]
|
|
133
|
+
"docs/conf.py" = ["D100"]
|
|
134
|
+
|
|
135
|
+
[tool.ruff.lint.isort]
|
|
136
|
+
known-first-party = ["pypeline", "tests"]
|
|
137
|
+
|
|
138
|
+
[tool.mypy]
|
|
139
|
+
check_untyped_defs = true
|
|
140
|
+
disallow_any_generics = true
|
|
141
|
+
disallow_incomplete_defs = true
|
|
142
|
+
disallow_untyped_defs = true
|
|
143
|
+
mypy_path = "src/"
|
|
144
|
+
no_implicit_optional = true
|
|
145
|
+
show_error_codes = true
|
|
146
|
+
warn_unreachable = true
|
|
147
|
+
warn_unused_ignores = true
|
|
148
|
+
exclude = [
|
|
149
|
+
'docs/.*',
|
|
150
|
+
'setup.py',
|
|
151
|
+
]
|
|
152
|
+
|
|
153
|
+
[[tool.mypy.overrides]]
|
|
154
|
+
module = "tests.*"
|
|
155
|
+
allow_untyped_defs = true
|
|
156
|
+
|
|
157
|
+
[[tool.mypy.overrides]]
|
|
158
|
+
module = "docs.*"
|
|
159
|
+
ignore_errors = true
|
|
160
|
+
|
|
161
|
+
[build-system]
|
|
162
|
+
requires = ["poetry-core>=1.0.0"]
|
|
163
|
+
build-backend = "poetry.core.masonry.api"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Used to run pypeline from the command line when run from this repository.
|
|
3
|
+
|
|
4
|
+
This is required because pypeline module is not visible when running from the repository.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import runpy
|
|
8
|
+
import sys
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
sys.path.insert(0, Path(__file__).parent.parent.absolute().as_posix())
|
|
12
|
+
runpy.run_module("pypeline.main", run_name="__main__")
|
|
File without changes
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from typing import List, Optional
|
|
4
|
+
|
|
5
|
+
from py_app_dev.core.exceptions import UserNotificationException
|
|
6
|
+
|
|
7
|
+
CONFIG_FILENAME = "pypeline.yaml"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ProjectArtifactsLocator:
|
|
11
|
+
"""Provides paths to project artifacts."""
|
|
12
|
+
|
|
13
|
+
def __init__(
|
|
14
|
+
self,
|
|
15
|
+
project_root_dir: Path,
|
|
16
|
+
) -> None:
|
|
17
|
+
self.project_root_dir = project_root_dir
|
|
18
|
+
self.build_dir = project_root_dir / "build"
|
|
19
|
+
self.config_file = project_root_dir / CONFIG_FILENAME
|
|
20
|
+
self.external_dependencies_dir = self.build_dir / "external"
|
|
21
|
+
scripts_dir = "Scripts" if sys.platform.startswith("win32") else "bin"
|
|
22
|
+
self.venv_scripts_dir = self.project_root_dir.joinpath(".venv").joinpath(scripts_dir)
|
|
23
|
+
|
|
24
|
+
def locate_artifact(self, artifact: str, first_search_paths: List[Optional[Path]]) -> Path:
|
|
25
|
+
search_paths = []
|
|
26
|
+
for path in first_search_paths:
|
|
27
|
+
if path:
|
|
28
|
+
search_paths.append(path.parent if path.is_file() else path)
|
|
29
|
+
for dir in [
|
|
30
|
+
*search_paths,
|
|
31
|
+
self.project_root_dir,
|
|
32
|
+
]:
|
|
33
|
+
if dir and (artifact_path := Path(dir).joinpath(artifact)).exists():
|
|
34
|
+
return artifact_path
|
|
35
|
+
else:
|
|
36
|
+
raise UserNotificationException(f"Artifact '{artifact}' not found in the project.")
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from typing import Any, Dict, Optional
|
|
4
|
+
|
|
5
|
+
import yaml
|
|
6
|
+
from mashumaro import DataClassDictMixin
|
|
7
|
+
from py_app_dev.core.exceptions import UserNotificationException
|
|
8
|
+
from py_app_dev.core.pipeline import PipelineConfig
|
|
9
|
+
from yaml.parser import ParserError
|
|
10
|
+
from yaml.scanner import ScannerError
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@dataclass
|
|
14
|
+
class ProjectConfig(DataClassDictMixin):
|
|
15
|
+
pipeline: PipelineConfig
|
|
16
|
+
# This field is intended to keep track of where configuration was loaded from and
|
|
17
|
+
# it is automatically added when configuration is loaded from file
|
|
18
|
+
file: Optional[Path] = None
|
|
19
|
+
|
|
20
|
+
@classmethod
|
|
21
|
+
def from_file(cls, config_file: Path) -> "ProjectConfig":
|
|
22
|
+
config_dict = cls.parse_to_dict(config_file)
|
|
23
|
+
return cls.from_dict(config_dict)
|
|
24
|
+
|
|
25
|
+
@staticmethod
|
|
26
|
+
def parse_to_dict(config_file: Path) -> Dict[str, Any]:
|
|
27
|
+
try:
|
|
28
|
+
with open(config_file) as fs:
|
|
29
|
+
config_dict = yaml.safe_load(fs)
|
|
30
|
+
# Add file name to config to keep track of where configuration was loaded from
|
|
31
|
+
config_dict["file"] = config_file
|
|
32
|
+
return config_dict
|
|
33
|
+
except ScannerError as e:
|
|
34
|
+
raise UserNotificationException(f"Failed scanning configuration file '{config_file}'. \nError: {e}") from e
|
|
35
|
+
except ParserError as e:
|
|
36
|
+
raise UserNotificationException(f"Failed parsing configuration file '{config_file}'. \nError: {e}") from e
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from dataclasses import dataclass, field
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import List, Optional
|
|
5
|
+
|
|
6
|
+
from py_app_dev.core.subprocess import SubprocessExecutor
|
|
7
|
+
|
|
8
|
+
from .artifacts import ProjectArtifactsLocator
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass
|
|
12
|
+
class ExecutionContext:
|
|
13
|
+
project_root_dir: Path
|
|
14
|
+
# Keep track of all install directories, updated by any step for the subsequent steps
|
|
15
|
+
install_dirs: List[Path] = field(default_factory=list)
|
|
16
|
+
|
|
17
|
+
def add_install_dirs(self, install_dirs: List[Path]) -> None:
|
|
18
|
+
self.install_dirs.extend(install_dirs)
|
|
19
|
+
|
|
20
|
+
def create_process_executor(self, command: List[str | Path], cwd: Optional[Path] = None) -> SubprocessExecutor:
|
|
21
|
+
# Add the install directories to the PATH
|
|
22
|
+
env = os.environ.copy()
|
|
23
|
+
env["PATH"] = os.pathsep.join([path.absolute().as_posix() for path in self.install_dirs] + [env["PATH"]])
|
|
24
|
+
return SubprocessExecutor(command, cwd=cwd, env=env, shell=True) # noqa: S604
|
|
25
|
+
|
|
26
|
+
def create_artifacts_locator(self) -> ProjectArtifactsLocator:
|
|
27
|
+
return ProjectArtifactsLocator(self.project_root_dir)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from abc import abstractmethod
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from typing import Type
|
|
4
|
+
|
|
5
|
+
from py_app_dev.core.runnable import Runnable
|
|
6
|
+
|
|
7
|
+
from .execution_context import ExecutionContext
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class PipelineStep(Runnable):
|
|
11
|
+
def __init__(self, execution_context: ExecutionContext, output_dir: Path) -> None:
|
|
12
|
+
self.execution_context = execution_context
|
|
13
|
+
self.output_dir = output_dir
|
|
14
|
+
self.project_root_dir = self.execution_context.project_root_dir
|
|
15
|
+
|
|
16
|
+
@abstractmethod
|
|
17
|
+
def update_execution_context(self) -> None:
|
|
18
|
+
pass
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class PipelineStepReference:
|
|
22
|
+
def __init__(self, group_name: str, _class: Type[PipelineStep]) -> None:
|
|
23
|
+
self.group_name = group_name
|
|
24
|
+
self._class = _class
|
|
25
|
+
|
|
26
|
+
@property
|
|
27
|
+
def name(self) -> str:
|
|
28
|
+
return self._class.__name__
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
from py_app_dev.core.exceptions import UserNotificationException
|
|
4
|
+
from py_app_dev.core.logging import logger
|
|
5
|
+
|
|
6
|
+
from .artifacts import ProjectArtifactsLocator
|
|
7
|
+
from .config import PipelineConfig, ProjectConfig
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ProjectSlurper:
|
|
11
|
+
def __init__(self, project_dir: Path) -> None:
|
|
12
|
+
self.logger = logger.bind()
|
|
13
|
+
self.artifacts_locator = ProjectArtifactsLocator(project_dir)
|
|
14
|
+
try:
|
|
15
|
+
self.user_config: ProjectConfig = ProjectConfig.from_file(self.artifacts_locator.config_file)
|
|
16
|
+
except FileNotFoundError:
|
|
17
|
+
raise UserNotificationException(f"Project configuration file '{self.artifacts_locator.config_file}' not found.") from None
|
|
18
|
+
self.pipeline: PipelineConfig = self.user_config.pipeline
|
|
19
|
+
|
|
20
|
+
@property
|
|
21
|
+
def project_dir(self) -> Path:
|
|
22
|
+
return self.artifacts_locator.project_root_dir
|
|
File without changes
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import shutil
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from typing import List, Optional, Union
|
|
4
|
+
|
|
5
|
+
from py_app_dev.core.exceptions import UserNotificationException
|
|
6
|
+
from py_app_dev.core.logging import logger
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ProjectBuilder:
|
|
10
|
+
def __init__(self, project_dir: Path, input_dir: Optional[Path] = None) -> None:
|
|
11
|
+
self.project_dir = project_dir
|
|
12
|
+
self.input_dir = input_dir if input_dir else Path(__file__).parent.joinpath("templates")
|
|
13
|
+
|
|
14
|
+
self.dirs: List[Path] = []
|
|
15
|
+
self.check_target_directory_flag = True
|
|
16
|
+
|
|
17
|
+
def with_disable_target_directory_check(self) -> "ProjectBuilder":
|
|
18
|
+
self.check_target_directory_flag = False
|
|
19
|
+
return self
|
|
20
|
+
|
|
21
|
+
def with_dir(self, dir: Union[Path, str]) -> "ProjectBuilder":
|
|
22
|
+
self.dirs.append(self.resolve_file_path(dir))
|
|
23
|
+
return self
|
|
24
|
+
|
|
25
|
+
def resolve_file_paths(self, files: List[Path | str]) -> List[Path]:
|
|
26
|
+
return [self.resolve_file_path(file) for file in files]
|
|
27
|
+
|
|
28
|
+
def resolve_file_path(self, file: Union[Path, str]) -> Path:
|
|
29
|
+
return self.input_dir.joinpath(file) if isinstance(file, str) else file
|
|
30
|
+
|
|
31
|
+
@staticmethod
|
|
32
|
+
def _check_target_directory(project_dir: Path) -> None:
|
|
33
|
+
if project_dir.is_dir() and any(project_dir.iterdir()):
|
|
34
|
+
raise UserNotificationException(f"Project directory '{project_dir}' is not empty." " The target directory shall either be empty or not exist.")
|
|
35
|
+
|
|
36
|
+
def build(self) -> None:
|
|
37
|
+
if self.check_target_directory_flag:
|
|
38
|
+
self._check_target_directory(self.project_dir)
|
|
39
|
+
for dir in self.dirs:
|
|
40
|
+
shutil.copytree(dir, self.project_dir, dirs_exist_ok=True)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class KickstartProject:
|
|
44
|
+
def __init__(self, project_dir: Path, bootstrap_only: bool = False, force: bool = False) -> None:
|
|
45
|
+
self.logger = logger.bind()
|
|
46
|
+
self.project_dir = project_dir
|
|
47
|
+
self.bootstrap_only = bootstrap_only
|
|
48
|
+
self.force = force
|
|
49
|
+
|
|
50
|
+
def run(self) -> None:
|
|
51
|
+
self.logger.info(f"Kickstart new project in '{self.project_dir.absolute().as_posix()}'")
|
|
52
|
+
project_builder = ProjectBuilder(self.project_dir)
|
|
53
|
+
project_builder.with_dir("bootstrap")
|
|
54
|
+
if self.bootstrap_only or self.force:
|
|
55
|
+
project_builder.with_disable_target_directory_check()
|
|
56
|
+
if not self.bootstrap_only:
|
|
57
|
+
project_builder.with_dir("project")
|
|
58
|
+
project_builder.build()
|