aboutcode.pipeline 0.1.0__tar.gz → 0.2.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.
- {aboutcode_pipeline-0.1.0 → aboutcode_pipeline-0.2.0}/NOTICE +2 -2
- {aboutcode_pipeline-0.1.0 → aboutcode_pipeline-0.2.0}/PKG-INFO +9 -8
- aboutcode_pipeline-0.2.0/aboutcode/pipeline/CHANGELOG.md +13 -0
- {aboutcode_pipeline-0.1.0 → aboutcode_pipeline-0.2.0}/aboutcode/pipeline/README.md +4 -3
- {aboutcode_pipeline-0.1.0 → aboutcode_pipeline-0.2.0}/aboutcode/pipeline/__init__.py +29 -17
- {aboutcode_pipeline-0.1.0 → aboutcode_pipeline-0.2.0}/pyproject.toml +5 -5
- aboutcode_pipeline-0.1.0/aboutcode/pipeline/CHANGELOG.md +0 -5
- {aboutcode_pipeline-0.1.0 → aboutcode_pipeline-0.2.0}/LICENSE +0 -0
- {aboutcode_pipeline-0.1.0 → aboutcode_pipeline-0.2.0}/aboutcode/pipeline/RELEASE.md +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
|
|
3
|
-
http://nexb.com and https://github.com/
|
|
3
|
+
http://nexb.com and https://github.com/aboutcode-org/scancode.io
|
|
4
4
|
The ScanCode.io software is licensed under the Apache License version 2.0.
|
|
5
5
|
Data generated with ScanCode.io is provided as-is without warranties.
|
|
6
6
|
ScanCode is a trademark of nexB Inc.
|
|
@@ -18,4 +18,4 @@ ScanCode.io should be considered or used as legal advice. Consult an Attorney
|
|
|
18
18
|
for any legal advice.
|
|
19
19
|
|
|
20
20
|
ScanCode.io is a free software code scanning tool from nexB Inc. and others.
|
|
21
|
-
Visit https://github.com/
|
|
21
|
+
Visit https://github.com/aboutcode-org/scancode.io for support and download.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: aboutcode.pipeline
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: AboutCode Pipeline library. Execute code in steps.
|
|
5
5
|
Keywords: open source,pipeline,scancode
|
|
6
6
|
Author-email: "nexB. Inc. and others" <info@aboutcode.org>
|
|
@@ -16,11 +16,11 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
17
17
|
Classifier: Topic :: Software Development
|
|
18
18
|
Classifier: Topic :: Utilities
|
|
19
|
-
Project-URL: Changelog, https://github.com/
|
|
19
|
+
Project-URL: Changelog, https://github.com/aboutcode-org/scancode.io/tree/main/aboutcode/pipeline/CHANGELOG.md
|
|
20
20
|
Project-URL: Documentation, https://scancodeio.readthedocs.io/
|
|
21
|
-
Project-URL: Homepage, https://github.com/
|
|
22
|
-
Project-URL: Issues, https://github.com/
|
|
23
|
-
Project-URL: Repository, https://github.com/
|
|
21
|
+
Project-URL: Homepage, https://github.com/aboutcode-org/scancode.io
|
|
22
|
+
Project-URL: Issues, https://github.com/aboutcode-org/scancode.io/issues
|
|
23
|
+
Project-URL: Repository, https://github.com/aboutcode-org/scancode.io/tree/main/aboutcode/pipeline
|
|
24
24
|
|
|
25
25
|
# `aboutcode.pipeline`
|
|
26
26
|
|
|
@@ -48,11 +48,12 @@ class PrintMessages(BasePipeline):
|
|
|
48
48
|
PrintMessages().execute()
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
###
|
|
51
|
+
### Options and steps selection
|
|
52
52
|
|
|
53
53
|
```python
|
|
54
54
|
from aboutcode.pipeline import BasePipeline
|
|
55
|
-
from aboutcode.pipeline import
|
|
55
|
+
from aboutcode.pipeline import optional_step
|
|
56
|
+
|
|
56
57
|
|
|
57
58
|
class PrintMessages(BasePipeline):
|
|
58
59
|
@classmethod
|
|
@@ -62,7 +63,7 @@ class PrintMessages(BasePipeline):
|
|
|
62
63
|
def step1(self):
|
|
63
64
|
print("Message from step1")
|
|
64
65
|
|
|
65
|
-
@
|
|
66
|
+
@optional_step("foo")
|
|
66
67
|
def step2(self):
|
|
67
68
|
print("Message from step2")
|
|
68
69
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## Release 0.2.0 (November 21, 2024)
|
|
4
|
+
|
|
5
|
+
* Refactor the ``group`` decorator for pipeline optional steps as ``optional_step``.
|
|
6
|
+
The steps decorated as optional are not included by default anymore.
|
|
7
|
+
Migration: Use the ``optional_step`` decorator in place of the deprecated ``group``.
|
|
8
|
+
[Issue #1442](https://github.com/nexB/scancode.io/issues/1442)
|
|
9
|
+
|
|
10
|
+
## Release 0.1.0 (August 9, 2024)
|
|
11
|
+
|
|
12
|
+
* Initial release of the `aboutcode.pipeline` library.
|
|
13
|
+
[Issue #1351](https://github.com/nexB/scancode.io/issues/1351)
|
|
@@ -24,11 +24,12 @@ class PrintMessages(BasePipeline):
|
|
|
24
24
|
PrintMessages().execute()
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
###
|
|
27
|
+
### Options and steps selection
|
|
28
28
|
|
|
29
29
|
```python
|
|
30
30
|
from aboutcode.pipeline import BasePipeline
|
|
31
|
-
from aboutcode.pipeline import
|
|
31
|
+
from aboutcode.pipeline import optional_step
|
|
32
|
+
|
|
32
33
|
|
|
33
34
|
class PrintMessages(BasePipeline):
|
|
34
35
|
@classmethod
|
|
@@ -38,7 +39,7 @@ class PrintMessages(BasePipeline):
|
|
|
38
39
|
def step1(self):
|
|
39
40
|
print("Message from step1")
|
|
40
41
|
|
|
41
|
-
@
|
|
42
|
+
@optional_step("foo")
|
|
42
43
|
def step2(self):
|
|
43
44
|
print("Message from step2")
|
|
44
45
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
#
|
|
3
|
-
# http://nexb.com and https://github.com/
|
|
3
|
+
# http://nexb.com and https://github.com/aboutcode-org/scancode.io
|
|
4
4
|
# The ScanCode.io software is licensed under the Apache License version 2.0.
|
|
5
5
|
# Data generated with ScanCode.io is provided as-is without warranties.
|
|
6
6
|
# ScanCode is a trademark of nexB Inc.
|
|
@@ -18,10 +18,11 @@
|
|
|
18
18
|
# for any legal advice.
|
|
19
19
|
#
|
|
20
20
|
# ScanCode.io is a free software code scanning tool from nexB Inc. and others.
|
|
21
|
-
# Visit https://github.com/
|
|
21
|
+
# Visit https://github.com/aboutcode-org/scancode.io for support and download.
|
|
22
22
|
|
|
23
23
|
import logging
|
|
24
24
|
import traceback
|
|
25
|
+
import warnings
|
|
25
26
|
from datetime import datetime
|
|
26
27
|
from datetime import timezone
|
|
27
28
|
from pydoc import getdoc
|
|
@@ -30,7 +31,7 @@ from timeit import default_timer as timer
|
|
|
30
31
|
|
|
31
32
|
module_logger = logging.getLogger(__name__)
|
|
32
33
|
|
|
33
|
-
__version__ = "0.
|
|
34
|
+
__version__ = "0.2.0"
|
|
34
35
|
|
|
35
36
|
|
|
36
37
|
class PipelineDefinition:
|
|
@@ -53,25 +54,24 @@ class PipelineDefinition:
|
|
|
53
54
|
"""
|
|
54
55
|
Return the list of steps defined in the ``steps`` class method.
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if ``groups`` is not specified, include the step in the result.
|
|
57
|
+
By default, all steps decorated with ``optional_step`` are not included.
|
|
58
|
+
A list of optional steps can be included using the ``groups`` parameter.
|
|
59
59
|
"""
|
|
60
60
|
if not callable(cls.steps):
|
|
61
61
|
raise TypeError("Use a ``steps(cls)`` classmethod to declare the steps.")
|
|
62
62
|
|
|
63
63
|
steps = cls.steps()
|
|
64
|
+
groups = groups or []
|
|
64
65
|
|
|
65
66
|
if initial_steps := cls.get_initial_steps():
|
|
66
67
|
steps = (*initial_steps, *steps)
|
|
67
68
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
)
|
|
69
|
+
steps = tuple(
|
|
70
|
+
step
|
|
71
|
+
for step in steps
|
|
72
|
+
if not getattr(step, "groups", [])
|
|
73
|
+
or set(getattr(step, "groups")).intersection(groups)
|
|
74
|
+
)
|
|
75
75
|
|
|
76
76
|
return steps
|
|
77
77
|
|
|
@@ -123,7 +123,7 @@ class PipelineDefinition:
|
|
|
123
123
|
return sorted(
|
|
124
124
|
set(
|
|
125
125
|
group_name
|
|
126
|
-
for step in cls.
|
|
126
|
+
for step in cls.steps()
|
|
127
127
|
for group_name in getattr(step, "groups", [])
|
|
128
128
|
)
|
|
129
129
|
)
|
|
@@ -204,7 +204,8 @@ class PipelineRun:
|
|
|
204
204
|
step_run_time = timer() - step_start_time
|
|
205
205
|
self.log(f"Step [{step_name}] completed in {humanize_time(step_run_time)}")
|
|
206
206
|
|
|
207
|
-
|
|
207
|
+
# Reset the `current_step` field on completion
|
|
208
|
+
self.set_current_step("")
|
|
208
209
|
pipeline_run_time = timer() - pipeline_start_time
|
|
209
210
|
self.log(f"Pipeline completed in {humanize_time(pipeline_run_time)}")
|
|
210
211
|
|
|
@@ -218,8 +219,8 @@ class BasePipeline(PipelineDefinition, PipelineRun):
|
|
|
218
219
|
"""
|
|
219
220
|
|
|
220
221
|
|
|
221
|
-
def
|
|
222
|
-
"""Mark a function as part of a
|
|
222
|
+
def optional_step(*groups):
|
|
223
|
+
"""Mark a step function as optional and part of a group."""
|
|
223
224
|
|
|
224
225
|
def decorator(obj):
|
|
225
226
|
if hasattr(obj, "groups"):
|
|
@@ -231,6 +232,17 @@ def group(*groups):
|
|
|
231
232
|
return decorator
|
|
232
233
|
|
|
233
234
|
|
|
235
|
+
def group(*groups):
|
|
236
|
+
"""Backward compatibility."""
|
|
237
|
+
warnings.warn(
|
|
238
|
+
"The `group` decorator is deprecated and will be "
|
|
239
|
+
"removed in a future release. Use `optional_step` instead.",
|
|
240
|
+
DeprecationWarning,
|
|
241
|
+
stacklevel=2,
|
|
242
|
+
)
|
|
243
|
+
return optional_step(*groups)
|
|
244
|
+
|
|
245
|
+
|
|
234
246
|
def humanize_time(seconds):
|
|
235
247
|
"""Convert the provided ``seconds`` number into human-readable time."""
|
|
236
248
|
message = f"{seconds:.0f} seconds"
|
|
@@ -4,7 +4,7 @@ build-backend = "flot.buildapi"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "aboutcode.pipeline"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.2.0"
|
|
8
8
|
description = "AboutCode Pipeline library. Execute code in steps."
|
|
9
9
|
license = { text = "Apache-2.0" }
|
|
10
10
|
readme = "aboutcode/pipeline/README.md"
|
|
@@ -29,11 +29,11 @@ classifiers = [
|
|
|
29
29
|
]
|
|
30
30
|
|
|
31
31
|
[project.urls]
|
|
32
|
-
Homepage = "https://github.com/
|
|
32
|
+
Homepage = "https://github.com/aboutcode-org/scancode.io"
|
|
33
33
|
Documentation = "https://scancodeio.readthedocs.io/"
|
|
34
|
-
Changelog = "https://github.com/
|
|
35
|
-
Repository = "https://github.com/
|
|
36
|
-
Issues = "https://github.com/
|
|
34
|
+
Changelog = "https://github.com/aboutcode-org/scancode.io/tree/main/aboutcode/pipeline/CHANGELOG.md"
|
|
35
|
+
Repository = "https://github.com/aboutcode-org/scancode.io/tree/main/aboutcode/pipeline"
|
|
36
|
+
Issues = "https://github.com/aboutcode-org/scancode.io/issues"
|
|
37
37
|
|
|
38
38
|
[tool.flot]
|
|
39
39
|
includes = [
|
|
File without changes
|
|
File without changes
|