Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: Martijn Govers <[email protected]>
  • Loading branch information
mgovers committed Dec 13, 2024
0 parents commit bad1b6a
Show file tree
Hide file tree
Showing 11 changed files with 331 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/dco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
allowRemediationCommits:
individual: true
thirdParty: true

6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
75 changes: 75 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Upload libboost-headers to PyPI

on:
pull_request:
workflow_dispatch:

jobs:

get-versions:
name: "Upload latest libboost-headers version to PyPI"
runs-on: ubuntu-latest
permissions:
contents: read
env:
TWINE_USERNAME: ${{ secrets.PYPI_USER }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASS }}

steps:
- uses: actions/checkout@v4

- name: Setup python
uses: actions/setup-python@v4
with:
python-version: "3.11"
architecture: x64

- name: Install dependencies
run: pip install build

- name: Enable brew
run: echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH

- name: Download boost
run: brew install boost

- name: Get latest version
id: version
run: echo "latest=$(brew list --version boost | sed -e 's/boost\s//' | sed -e 's/_\w*//')" >> $GITHUB_OUTPUT

- name: List version
run: echo "latest=${{ steps.version.outputs.latest }}"

- name: Get the libboost-headers contents
run: cp -r /home/linuxbrew/.linuxbrew/Cellar/boost/${{ steps.version.outputs.latest }}/include/* src/libboost_headers/include

- name: Set PyPI Version
run: echo "${{ steps.version.outputs.latest }}" >> PYPI_VERSION

- name: Show contents
run: ls -ahl src/libboost_headers/include

- name: Build wheel
run: python -m build --wheel --outdir wheelhouse .

- name: Test wheel
run: |
pip install wheelhouse/*
pip install pytest
pytest
- name: Keep Wheel file
uses: actions/upload-artifact@v3
with:
name: wheelhouse
path: ./wheelhouse/*.whl

- name: List assets
run: ls ./wheelhouse/ -al

# - name: Upload wheels
# if: github.event_name == 'workflow_dispatch'
# run: |
# pip install twine
# echo "Publish to PyPI..."
# twine upload --verbose wheelhouse/*
135 changes: 135 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/


.vscode
PYPI_VERSION

.idea/
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
repos:
- repo: https://github.com/fsfe/reuse-tool
rev: v1.0.0
hooks:
- id: reuse
23 changes: 23 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Boost Software License - Version 1.0 - August 17th, 2003

Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:

The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Boost PyPI

This repo contains automation for [Boost](https://github.com/boostorg/boost).

It creates, packages and pushes the header-only library `libboost-headers` to PyPI.
This repo is the equivalent of the [Anaconda libboost-headers](https://anaconda.org/conda-forge/libboost-headers) package.

**NOTE:** Packages created by this repo only contain the raw source code and not a Python package.

Credits go to the maintainers of the [Boost](https://github.com/boostorg/boost) package.

## License

The files in this repository are licensed under the Boost Software License - Version 1.0.

The distributed boost package is a redistribution of [Boost](https://github.com/boostorg/boost) and therefore falls under the [Boost license model](https://github.com/boostorg/boost/blob/master/LICENSE_1_0.txt) as described in the [LICENCE_1_0.txt file in the Boost repository](https://github.com/boostorg/boost/blob/master/LICENSE_1_0.txt).
52 changes: 52 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[build-system]
requires = [
"setuptools",
"wheel",
]
build-backend = "setuptools.build_meta"

[project]
name = "libboost-headers"
authors = [
{ name = "Contributors to the Power Grid Model project", email = "[email protected]" }
]
description = "Repackaging of libboost-headers distributed via PyPI"
readme = "README.md"
license = { text = "BSL-1.0" }
classifiers = [
"Programming Language :: C++",
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: Boost Software License 1.0 (BSL-1.0)",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS",
"Topic :: File Formats",
"Topic :: Software Development :: Libraries",
]
dependencies = [
"importlib-resources"
]
dynamic = [
"version"
]

[project.optional-dependencies]
dev = [
"pytest"
]

[project.urls]
Home-page = "http://www.boost.org/"
GitHub = "https://github.com/boostorg/boost"
Documentation = "https://www.boost.org/doc/"

[tool.setuptools.packages.find]
where = ["src"]
namespaces = true

[tool.setuptools.dynamic]
version = {file = "PYPI_VERSION"}

[tool.setuptools.package-data]
libboost_headers = ["include/**/*"]
7 changes: 7 additions & 0 deletions src/libboost_headers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from pathlib import Path

from importlib_resources import files


def get_include() -> Path:
return files("boost.include")
Empty file.
8 changes: 8 additions & 0 deletions tests/test_msgpack_header.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from pathlib import Path

from libboost_headers import get_include


def test_header():
include_path: Path = get_include()
assert (include_path / "version.hpp").exists()

0 comments on commit bad1b6a

Please sign in to comment.