From fc9f3de373ab981b9f907d4e751095ac392f6c92 Mon Sep 17 00:00:00 2001 From: Maarten Arnst Date: Wed, 3 Jul 2024 15:55:57 +0200 Subject: [PATCH] Add setup.py to allow installation --- .github/workflows/test.yml | 24 ++++++++++++++++++--- hwloc_xml_parser/__init__.py | 0 topology.py => hwloc_xml_parser/topology.py | 0 setup.py | 12 +++++++++++ tests/test_topology.py | 2 +- 5 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 hwloc_xml_parser/__init__.py rename topology.py => hwloc_xml_parser/topology.py (100%) create mode 100644 setup.py diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c81696e..153ccbe 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,9 +19,27 @@ jobs: - name: Prepare. run : | - pip install -r requirements.txt - pip install pytest + pip install -r requirements.txt + pip install pytest - name: Run tests. run : | - PYTHONPATH=$PWD pytest tests/test_topology.py + PYTHONPATH=$PWD pytest tests/test_topology.py + + install-as-package: + runs-on: [ubuntu-latest] + container: + image: python:3.9 + steps: + - name: Prepare. + run : | + apt update + apt --yes --no-install-recommends install hwloc + + - name: Install as package. + run : | + pip3 install git+https://github.com/uliegecsm/hwloc-xml-parser.git@${{ github.sha }} + + - name: Test package. + run : | + python3 -c "from hwloc_xml_parser.topology import SystemTopology; topo = SystemTopology()" diff --git a/hwloc_xml_parser/__init__.py b/hwloc_xml_parser/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/topology.py b/hwloc_xml_parser/topology.py similarity index 100% rename from topology.py rename to hwloc_xml_parser/topology.py diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..e9cb195 --- /dev/null +++ b/setup.py @@ -0,0 +1,12 @@ +from setuptools import setup, find_packages + +setup( + name = 'hwloc-xml-parser', + version = '0.1', + install_requires = [ + 'typeguard', + ], + packages = find_packages(), + license = 'MIT', + url = 'https://github.com/uliegecsm/hwloc-xml-parser' +) diff --git a/tests/test_topology.py b/tests/test_topology.py index 61eb1e8..7737d0e 100644 --- a/tests/test_topology.py +++ b/tests/test_topology.py @@ -2,7 +2,7 @@ import unittest from unittest.mock import call -from topology import SystemTopology +from hwloc_xml_parser.topology import SystemTopology class TestSystemTopology: """