From d785059d5d3b440648dfdbefd61383916a404b47 Mon Sep 17 00:00:00 2001 From: AnishMudaraddi Date: Wed, 26 Nov 2025 10:05:41 +0000 Subject: [PATCH] setup better python package builds for iriscasttools update to latest python version --- .github/workflows/iriscast_package_build.yaml | 139 ++++++------------ iriscasttools/.gitignore | 2 + iriscasttools/README.md | 24 +++ .../iriscasttools.egg-info/PKG-INFO | 47 ++++++ .../iriscasttools.egg-info/SOURCES.txt | 9 ++ .../dependency_links.txt | 1 + .../iriscasttools.egg-info/requires.txt | 10 ++ .../iriscasttools.egg-info/top_level.txt | 1 + iriscasttools/pyproject.toml | 80 ++++++++++ iriscasttools/requirements.txt | 6 - iriscasttools/setup.py | 21 --- 11 files changed, 218 insertions(+), 122 deletions(-) create mode 100644 iriscasttools/.gitignore create mode 100644 iriscasttools/README.md create mode 100644 iriscasttools/iriscasttools/iriscasttools.egg-info/PKG-INFO create mode 100644 iriscasttools/iriscasttools/iriscasttools.egg-info/SOURCES.txt create mode 100644 iriscasttools/iriscasttools/iriscasttools.egg-info/dependency_links.txt create mode 100644 iriscasttools/iriscasttools/iriscasttools.egg-info/requires.txt create mode 100644 iriscasttools/iriscasttools/iriscasttools.egg-info/top_level.txt create mode 100644 iriscasttools/pyproject.toml delete mode 100644 iriscasttools/requirements.txt delete mode 100644 iriscasttools/setup.py diff --git a/.github/workflows/iriscast_package_build.yaml b/.github/workflows/iriscast_package_build.yaml index 37ef63aa..567bf677 100644 --- a/.github/workflows/iriscast_package_build.yaml +++ b/.github/workflows/iriscast_package_build.yaml @@ -14,124 +14,73 @@ on: jobs: test_and_lint: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.x", "3.10", "3.6.8"] + python-version: ["3.x", "3.10"] steps: - - uses: actions/checkout@v5 + - name: Checkout code + uses: actions/checkout@v4 + + - name: Navigate to Folder + run: cd ./iriscasttools + - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - cache: "pip" - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r iriscasttools/requirements.txt + pip install setuptools wheel build - - name: Run tests - run: cd iriscasttools/ && python3 -m pytest . - - - name: Analyse with pylint + - name: Build package run: | - cd iriscasttools && pylint --recursive yes test iriscasttools + python -m build - build-wheel: - runs-on: ubuntu-20.04 - strategy: - matrix: - python-version: ["3.x"] - steps: - - uses: actions/checkout@v5 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 - with: - python-version: ${{ matrix.python-version }} - cache: "pip" - - name: Get Package Version - id: version - run: echo "version=$(python iriscasttools/setup.py --version)" >> $GITHUB_ENV - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel - - name: Build Wheels - run: cd iriscasttools && python setup.py bdist_wheel - - name: Upload Wheel + - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: iriscasttools-${{ env.version }}-py3-none-any.whl - path: iriscasttools/dist/iriscasttools-${{ env.version }}-py3-none-any.whl - if-no-files-found: error + name: dist-${{ matrix.python-version }} + path: dist/ - build-rpms: - runs-on: ubuntu-20.04 - strategy: - matrix: - python-version: ["3.10", "3.6.8"] - steps: - - uses: actions/checkout@v5 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 - with: - python-version: ${{ matrix.python-version }} - cache: "pip" - - name: Get Package Version - id: version - run: echo "version=$(python iriscasttools/setup.py --version)" >> $GITHUB_ENV - - name: Install dependencies - run: | - sudo apt-get update && sudo apt-get install -y rpm - - name: Build RPM - run: | - cd iriscasttools - python_version=$(python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')") - echo -e "[install]\ninstall-lib=/usr/lib/python${python_version}/site-packages" > setup.cfg - python setup.py bdist_rpm - cd dist - mv iriscasttools-${{ env.version }}-1.noarch.rpm iriscasttools-${{ env.version }}-py${{ matrix.python-version }}.noarch.rpm - - uses: actions/upload-artifact@v4 - with: - name: iriscasttools-${{ env.version }}-py${{ matrix.python-version }}.noarch.rpm - path: iriscasttools/dist/iriscasttools-${{ env.version }}-py${{ matrix.python-version }}.noarch.rpm - if-no-files-found: error - publish: - runs-on: ubuntu-20.04 - if: github.ref == 'refs/heads/master' && github.event_name == 'push' - needs: - - test_and_lint - - build-wheel - - build-rpms + needs: release + runs-on: ubuntu-latest + steps: - - name: Checkout - uses: actions/checkout@v5 + - name: Checkout code + uses: actions/checkout@v4 + + - name: Download all artifacts + uses: actions/download-artifact@v4 with: - fetch-depth: 0 + path: dist - - name: Configure Git + - name: Generate Changelog + id: changelog run: | - git config user.name "$GITHUB_ACTOR" - git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - - - name: Get Package Version - id: version - run: echo "version=$(python iriscasttools/setup.py --version)" >> $GITHUB_ENV + if [ -z "${{ github.event.inputs.changelog }}" ]; then + echo "changelog=Release version ${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT + else + echo "changelog=${{ github.event.inputs.changelog }}" >> $GITHUB_OUTPUT + fi - - name: Download Artifacts - id: download - uses: actions/download-artifact@v5 + - name: Create Git Tag + uses: EndBug/latest-tag@latest with: - path: iriscasttools/dist + tag-name: v${{ github.event.inputs.version }} - - name: Make Release - uses: ncipollo/release-action@v1 + - name: Create GitHub Release + uses: softprops/action-gh-release@v1 with: - artifacts: iriscasttools/dist/*/* - tag: ${{ env.version }} - name: iriscasttools-${{ env.version }} - skipIfReleaseExists: true - + tag_name: v${{ github.event.inputs.version }} + body: ${{ steps.changelog.outputs.changelog }} + files: | + dist/**/*.whl + dist/**/*.tar.gz + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + diff --git a/iriscasttools/.gitignore b/iriscasttools/.gitignore new file mode 100644 index 00000000..b26053a2 --- /dev/null +++ b/iriscasttools/.gitignore @@ -0,0 +1,2 @@ +dist +dist/* \ No newline at end of file diff --git a/iriscasttools/README.md b/iriscasttools/README.md new file mode 100644 index 00000000..a62cf9aa --- /dev/null +++ b/iriscasttools/README.md @@ -0,0 +1,24 @@ +# IRISCAST Tools + +> [!Warning] +> This package is deprecated and is not supported. + +A python package that bundlels together a collection of energy usage monitoring scripts to be run on cloud hypervisors. + +These scripts will collect power usage data using IPMI. + +This package is intended to be installed onto HVs and a cronjob written to run this every 15mins to populate a csv - which can be read by filebeat/fluentd to a datastore. + +## Installation + +```bash +pip install "iriscasttools @ git+https://github.com/stfc/SCD-OpenStack-Utils.git" +``` + +## Usage + +Run as a cron job: +``` +python3 -m iriscasttols --as-csv >> /var/cache/iriscast/ipmi-stats-$(date -I).csv + +``` diff --git a/iriscasttools/iriscasttools/iriscasttools.egg-info/PKG-INFO b/iriscasttools/iriscasttools/iriscasttools.egg-info/PKG-INFO new file mode 100644 index 00000000..14f3d667 --- /dev/null +++ b/iriscasttools/iriscasttools/iriscasttools.egg-info/PKG-INFO @@ -0,0 +1,47 @@ +Metadata-Version: 2.4 +Name: iriscasttools +Version: 1.0.0 +Summary: python package for IRISCAST Tools +Author-email: STFC Cloud Team +Project-URL: Repository, https://github.com/stfc/SCD-Openstack-Utils +Project-URL: Documentation, https://github.com/stfc/SCD-Openstack-Utils/iriscasttools/README.md +Project-URL: Issues, https://github.com/stfc/SCD-Openstack-Utils/issues +Keywords: python,openstack +Classifier: Development Status :: 4 - Beta +Classifier: Intended Audience :: Openstack Admins :: Monitoring Tools +Classifier: Programming Language :: Python :: 3 +Requires-Python: >=3.10 +Description-Content-Type: text/markdown +Requires-Dist: psutil +Provides-Extra: test +Requires-Dist: pytest; extra == "test" +Requires-Dist: pytest-cov; extra == "test" +Requires-Dist: black; extra == "test" +Requires-Dist: pylint; extra == "test" +Provides-Extra: dev +Requires-Dist: bumpversion; extra == "dev" + +# IRISCAST Tools + +> [!Warning] +> This package is deprecated and is not supported. + +A python package that bundlels together a collection of energy usage monitoring scripts to be run on cloud hypervisors. + +These scripts will collect power usage data using IPMI. + +This package is intended to be installed onto HVs and a cronjob written to run this every 15mins to populate a csv - which can be read by filebeat/fluentd to a datastore. + +## Installation + +```bash +pip install "iriscasttools @ git+https://github.com/stfc/SCD-OpenStack-Utils.git" +``` + +## Usage + +Run as a cron job: +``` +python3 -m iriscasttols --as-csv >> /var/cache/iriscast/ipmi-stats-$(date -I).csv + +``` diff --git a/iriscasttools/iriscasttools/iriscasttools.egg-info/SOURCES.txt b/iriscasttools/iriscasttools/iriscasttools.egg-info/SOURCES.txt new file mode 100644 index 00000000..7debfdb1 --- /dev/null +++ b/iriscasttools/iriscasttools/iriscasttools.egg-info/SOURCES.txt @@ -0,0 +1,9 @@ +README.md +pyproject.toml +iriscasttools/iriscasttools.egg-info/PKG-INFO +iriscasttools/iriscasttools.egg-info/SOURCES.txt +iriscasttools/iriscasttools.egg-info/dependency_links.txt +iriscasttools/iriscasttools.egg-info/requires.txt +iriscasttools/iriscasttools.egg-info/top_level.txt +test/test_stats.py +test/test_utils.py \ No newline at end of file diff --git a/iriscasttools/iriscasttools/iriscasttools.egg-info/dependency_links.txt b/iriscasttools/iriscasttools/iriscasttools.egg-info/dependency_links.txt new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/iriscasttools/iriscasttools/iriscasttools.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/iriscasttools/iriscasttools/iriscasttools.egg-info/requires.txt b/iriscasttools/iriscasttools/iriscasttools.egg-info/requires.txt new file mode 100644 index 00000000..802fdd34 --- /dev/null +++ b/iriscasttools/iriscasttools/iriscasttools.egg-info/requires.txt @@ -0,0 +1,10 @@ +psutil + +[dev] +bumpversion + +[test] +pytest +pytest-cov +black +pylint diff --git a/iriscasttools/iriscasttools/iriscasttools.egg-info/top_level.txt b/iriscasttools/iriscasttools/iriscasttools.egg-info/top_level.txt new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/iriscasttools/iriscasttools/iriscasttools.egg-info/top_level.txt @@ -0,0 +1 @@ + diff --git a/iriscasttools/pyproject.toml b/iriscasttools/pyproject.toml new file mode 100644 index 00000000..032643e9 --- /dev/null +++ b/iriscasttools/pyproject.toml @@ -0,0 +1,80 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[tool.setuptools.packages.find] +where = ["iriscasttools"] + +[project] +name = "iriscasttools" +version = "1.0.0" +description = "python package for IRISCAST Tools" +authors = [{name = "STFC Cloud Team", email = "cloud-support@stfc.ac.uk"}] +readme = "README.md" +requires-python = ">=3.10" +keywords = ["python", "openstack"] +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Openstack Admins :: Monitoring Tools", + "Programming Language :: Python :: 3", +] +dependencies = [ + "psutil", +] + +[project.urls] +Repository = "https://github.com/stfc/SCD-Openstack-Utils" +Documentation = "https://github.com/stfc/SCD-Openstack-Utils/iriscasttools/README.md" +Issues = "https://github.com/stfc/SCD-Openstack-Utils/issues" + +# Optional dependency groups +[project.optional-dependencies] +test = [ + "pytest", + "pytest-cov", + "black", + "pylint", +] + +dev = [ + "bumpversion" +] + +[tool.pytest.ini_options] +pythonpath = ["iriscasttools"] +testpaths = ["tests"] +python_files = ["*.py"] +python_functions = ["test_*"] + + +[tool.black] +line-length = 88 +target-version = ['py38'] +include = '\.pyi?$' + +[tool.pylint.format] +max-line-length=118 +disable=[ + "C00114", # Missing module string - we don't need module strings for the small repo + "W1401", # Influxdb required backslashes + "R0801" # Duplicate code due to test case +] + +[tool.bumpversion] +current_version = "1.0.0" +parse = "(?P\\d+)\\.(?P\\d+)\\.(?P\\d+)" +serialize = ["{major}.{minor}.{patch}"] +search = "{current_version}" +replace = "{new_version}" +regex = false +ignore_missing_version = false +ignore_missing_files = false +tag = false +allow_dirty = true +commit = true +message = "Bump version: {current_version} → {new_version}" +moveable_tags = [] +commit_args = "--no-verify" +setup_hooks = [] +pre_commit_hooks = [] +post_commit_hooks = [] \ No newline at end of file diff --git a/iriscasttools/requirements.txt b/iriscasttools/requirements.txt deleted file mode 100644 index a154740a..00000000 --- a/iriscasttools/requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -pytest -psutil -pylint -pre-commit -argparse -datetime \ No newline at end of file diff --git a/iriscasttools/setup.py b/iriscasttools/setup.py deleted file mode 100644 index e051c401..00000000 --- a/iriscasttools/setup.py +++ /dev/null @@ -1,21 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -# Copyright (c) 2023 United Kingdom Research and Innovation -from setuptools import setup, find_packages - -VERSION = "0.2.1" -DESCRIPTION = "python package for IRISCAST tools" - -LONG_DESCRIPTION = """Python package to get power and CPU/RAM usage statistics""" - -setup( - name="iriscasttools", - version=VERSION, - author="Anish Mudaraddi", - author_email="", - description=DESCRIPTION, - long_description=LONG_DESCRIPTION, - packages=find_packages(), - python_requires=">=3.6", - install_requires=[], - keywords=["python"], -)