From 2a1db349dcf28e0d5f8d5e2bb14d9d91fb9dbdd0 Mon Sep 17 00:00:00 2001 From: Alexander Hampel Date: Fri, 31 May 2024 14:40:10 -0400 Subject: [PATCH] [build] finalize pypi publishing workflow --- .github/workflows/publish-to-pypi.yml | 31 ++++++++++------------- packaging/CMakeLists.txt | 2 ++ packaging/pypi/MANIFEST.in | 13 ++++++++++ packaging/pypi/pyproject.toml.in | 36 +++++++++++++++++++++++++++ 4 files changed, 64 insertions(+), 18 deletions(-) create mode 100644 packaging/pypi/MANIFEST.in create mode 100644 packaging/pypi/pyproject.toml.in diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index 23acc36..9426859 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -1,4 +1,4 @@ -name: Publish to PyPI +name: PyPI on: push: @@ -11,31 +11,26 @@ jobs: name: Build distribution 📦 runs-on: ubuntu-latest container: # we have to provide a working triqs installation to make the cmake step work - image: flatironinstitute/triqs:${{github.ref_name}} + # image: flatironinstitute/triqs:${{github.ref_name}} + image: flatironinstitute/triqs:latest + options: --user root steps: - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.x" - name: Install pypa/build - run: >- - python3 -m - pip install - build toml - --user + run: | + pip3 install --user build toml --break-system-packages - name: prepare python distribution run: | - mkdir build && cd build - cmake ../ - cp packaging/pypi/* ../ - mv python/triqs_maxent/version.py ../python/triqs_maxent/version.py - rm ../python/triqs_maxent/version.py.in + git config --global --add safe.directory ${GITHUB_WORKSPACE} + cmake -S . -B build/ + cp build/packaging/pypi/* ./ + mv build/python/triqs_maxent/version.py ./python/triqs_maxent/version.py + rm ./python/triqs_maxent/version.py.in - name: Build a binary wheel and a source tarball run: python3 -m build - name: Store the distribution packages - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: python-package-distributions path: dist/ @@ -53,7 +48,7 @@ jobs: steps: - name: Download all the dists - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: python-package-distributions path: dist/ diff --git a/packaging/CMakeLists.txt b/packaging/CMakeLists.txt index 70981c2..a1fbb10 100644 --- a/packaging/CMakeLists.txt +++ b/packaging/CMakeLists.txt @@ -2,6 +2,8 @@ configure_file(conda/meta.yaml.in conda/meta.yaml) configure_file(conda/build.sh conda/build.sh COPYONLY) configure_file(conda/conda_build_config.yaml conda/conda_build_config.yaml COPYONLY) +configure_file(pypi/MANIFEST.in pypi/MANIFEST.in COPYONLY) +configure_file(pypi/pyproject.toml.in pypi/pyproject.toml) configure_file(TRIQS-triqs_maxent-foss-2021b.eb.in TRIQS-triqs_maxent-foss-2021b.eb) diff --git a/packaging/pypi/MANIFEST.in b/packaging/pypi/MANIFEST.in new file mode 100644 index 0000000..2cad09e --- /dev/null +++ b/packaging/pypi/MANIFEST.in @@ -0,0 +1,13 @@ +prune test +prune .git +prune .github +prune doc +prune share +prune Docker +prune deps +prune packaging +prune paper +prune bin +prune build + +global-exclude .clang-format .clang-tidy .dockerignore .gitignore CMakeLists.txt Jenkinsfile diff --git a/packaging/pypi/pyproject.toml.in b/packaging/pypi/pyproject.toml.in new file mode 100644 index 0000000..879939f --- /dev/null +++ b/packaging/pypi/pyproject.toml.in @@ -0,0 +1,36 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[tool.setuptools.packages.find] +where = ["python"] + +[project] +name = "triqs_maxent" +version = "@PROJECT_VERSION@" +authors = [ + { name="TRIQS", email="triqs@flatironinstitute.org" } +] +description = "TRIQS application providing a modular Maximum Entropy progra to perform analytic continuation based on the TRIQS library (triqs.github.io)" +readme = "README.md" +keywords = ["triqs", "analytic-continuation", "maximum-entropy"] +requires-python = ">=3.7" +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "Operating System :: OS Independent", +] +dependencies = [ + "numpy", + "scipy", + "matplotlib" +] + +[project.urls] +"Homepage" = "https://triqs.github.io/maxent" +"Bug Tracker" = "https://github.com/triqs/maxent/issues" + +# in case you want an executable hook of your app +# [project.scripts] +# solid_dmft = "solid_dmft.main:main" +