Skip to content

Commit

Permalink
Add pyproject.toml for packaging aboutcode.pipeline module #1351 (#1359)
Browse files Browse the repository at this point in the history
* Add pyproject.toml for packaging aboutcode.pipeline module #1351

Signed-off-by: tdruez <[email protected]>

* Add GitHub action to publish aboutcode.pipeline

Signed-off-by: Keshav Priyadarshi <[email protected]>

* Enable GitHub release

Signed-off-by: Keshav Priyadarshi <[email protected]>

* Refine workflow and add documentation and changelog #1351

Signed-off-by: tdruez <[email protected]>

---------

Signed-off-by: tdruez <[email protected]>
Signed-off-by: Keshav Priyadarshi <[email protected]>
Co-authored-by: Keshav Priyadarshi <[email protected]>
  • Loading branch information
tdruez and keshav-space authored Aug 9, 2024
1 parent eeff642 commit ceb345e
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 1 deletion.
38 changes: 38 additions & 0 deletions .github/workflows/pypi-release-aboutcode-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build aboutcode.pipeline Python distributions and publish on PyPI

on:
workflow_dispatch:
push:
tags:
- "aboutcode.pipeline/*"

jobs:
build-and-publish:
name: Build and publish library to PyPI
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Install flot
run: python -m pip install flot --user

- name: Build a binary wheel and a source tarball
run: python -m flot --pyproject pipeline-pyproject.toml --sdist --wheel --output-dir dist/

- name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}

- name: Upload built archives
uses: actions/upload-artifact@v4
with:
name: pypi_archives
path: dist/*
5 changes: 5 additions & 0 deletions aboutcode/pipeline/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## Release 0.1.0 (August 9, 2023)

* Initial release of the `aboutcode.pipeline` library. [Issue #1351](https://github.com/nexB/scancode.io/issues/1351)
2 changes: 1 addition & 1 deletion aboutcode/pipeline/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Define and run pipelines.
### Install

```bash
pip install aboutcode_pipeline
pip install aboutcode.pipeline
```

### Define and execute a pipeline
Expand Down
29 changes: 29 additions & 0 deletions aboutcode/pipeline/RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Release instructions for `aboutcode.pipeline`

### Automated release workflow

- Create a new `aboutcode.pipeline-release-x.x.x` branch
- Update the version in:
- `pipeline-pyproject.toml`
- `aboutcode/pipeline/__init__.py`
- Commit and push this branch
- Create a PR and merge once approved
- Tag and push to trigger the `pypi-release-aboutcode-pipeline.yml` workflow that
takes care of building the distribution archives and upload those to pypi::
```
VERSION=x.x.x # <- Set the new version here
TAG=aboutcode.pipeline/$VERSION
git tag -a $TAG -m ""
git push origin $TAG
```

### Manual build

```
cd scancode.io
source .venv/bin/activate
pip install flot
flot --pyproject pipeline-pyproject.toml --sdist --wheel --output-dir dist/
```

The distribution archives will be available in the local `dist/` directory.
2 changes: 2 additions & 0 deletions aboutcode/pipeline/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

module_logger = logging.getLogger(__name__)

__version__ = "0.1.0"


class PipelineDefinition:
"""
Expand Down
45 changes: 45 additions & 0 deletions pipeline-pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[build-system]
requires = ["flot"]
build-backend = "flot.buildapi"

[project]
name = "aboutcode.pipeline"
version = "0.1.0"
description = "AboutCode Pipeline library. Execute code in steps."
license = { text = "Apache-2.0" }
readme = "aboutcode/pipeline/README.md"
requires-python = ">=3.9"
authors = [ { name = "nexB. Inc. and others", email = "[email protected]" } ]
keywords = [
"open source",
"pipeline",
"scancode",
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Software Development",
"Topic :: Utilities",
]

[project.urls]
Homepage = "https://github.com/nexB/scancode.io"
Documentation = "https://scancodeio.readthedocs.io/"
Changelog = "https://github.com/nexB/scancode.io/tree/main/aboutcode/pipeline/CHANGELOG.md"
Repository = "https://github.com/nexB/scancode.io/tree/main/aboutcode/pipeline"
Issues = "https://github.com/nexB/scancode.io/issues"

[tool.flot]
includes = [
"aboutcode/pipeline/*",
]
metadata_files = [
"LICENSE",
"NOTICE",
]

0 comments on commit ceb345e

Please sign in to comment.