Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Request #18

Merged
merged 36 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
f37a4c0
Test GitHub Action in Feature Branch
Sep 26, 2023
8f95e68
Test GitHub Action in Feature Branch
Sep 26, 2023
0be6745
Test GitHub Action in Feature Branch
Sep 26, 2023
51bfd7d
Test GitHub Action in Feature Branch
Sep 26, 2023
80749b0
Test GitHub Action in Feature Branch
Sep 27, 2023
90bc102
Test GitHub Action in Feature Branch
Sep 27, 2023
394977b
Test GitHub Action in Feature Branch
Sep 27, 2023
7ce5227
Test GitHub Action in Feature Branch
Sep 27, 2023
9a38ee9
Test GitHub Action in Feature Branch
Sep 27, 2023
e69a1ff
Test GitHub Action in Feature Branch
Sep 27, 2023
5f8d80a
Test GitHub Action in Feature Branch
Sep 27, 2023
bf54be7
Test GitHub Action in Feature Branch
Sep 27, 2023
8989214
Test GitHub Action in Feature Branch
Sep 27, 2023
367b56f
Test GitHub Action in Feature Branch
Sep 28, 2023
398f950
Test GitHub Action in Feature Branch
Sep 28, 2023
d755839
Test GitHub Action in Feature Branch
Sep 28, 2023
b10eed8
Test GitHub Action in Feature Branch
Sep 28, 2023
e11da6e
Test GitHub Action in Feature Branch
Sep 28, 2023
af8f1e8
Test GitHub Action in Feature Branch
Sep 28, 2023
cfb39cc
Test GitHub Action in Feature Branch
Sep 28, 2023
7cb5fcd
Test GitHub Action in Feature Branch
Sep 28, 2023
d62c96a
Test GitHub Action in Feature Branch
Sep 28, 2023
bea314e
Test GitHub Action in Feature Branch
Sep 28, 2023
30d9444
Test GitHub Action in Feature Branch
Sep 28, 2023
645c496
Test GitHub Action in Feature Branch
Sep 28, 2023
00b0e69
Test GitHub Action in Feature Branch
Sep 28, 2023
05a911f
Test GitHub Action in Feature Branch
Sep 28, 2023
dbfddc6
Test GitHub Action in Feature Branch
Sep 28, 2023
d9ddb90
Test GitHub Action in Feature Branch
Sep 28, 2023
b4b504a
Test GitHub Action in Feature Branch
Sep 28, 2023
9b084fe
Test GitHub Action in Feature Branch
Sep 28, 2023
8d29d9f
Test GitHub Action in Feature Branch
Sep 28, 2023
e82ee16
Test GitHub Action in Feature Branch
Sep 28, 2023
22ef5ef
Test GitHub Action in Feature Branch
Sep 28, 2023
277ee0b
Publish QOkit to Test Pypi. Modified setup.py, diagonal.c and new git…
Sep 29, 2023
8a601e1
Modified qokit-package, qokit-python-only.yml as per review comments
Oct 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 39 additions & 18 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,46 @@ on:
- published

jobs:
deploy:
runs-on: ubuntu-latest
build_wheels:
name: Build wheels on ${{ matrix.python }} - ${{matrix.os}}
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-22.04, macos-11, windows-2022]
python: ["cp39", "cp310", "cp311"]

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
- uses: actions/checkout@v4
- name: Build Wheels
uses: pypa/cibuildwheel@v2.16.1
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl

build_sdist:
name: Build Source Distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v3
with:
python-version: '3.x'
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# python -m pip install build
# - name: Build package
# run: python -m build
# - name: Publish package to test.pypi
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# user: __token__
# password: ${{ secrets.PYPI_API_JPMC_OSS }}
# print_hash: true
path: dist/*.tar.gz

upload_pypi:
needs: [build_sdist, build_wheels]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TEST_API_JPMC_OSS }}
59 changes: 41 additions & 18 deletions .github/workflows/pypi-test-publish.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,53 @@
name: Upload Python Package to PyPI
name: Upload Python Package to PyPI Test

on:
release:
types:
- published
workflow_dispatch:
pull_request:


jobs:
deploy:
build_wheels:
name: Build wheels on ${{ matrix.python }} - ${{matrix.os}}
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-22.04, macos-11, windows-2022]
python: ["cp39", "cp310", "cp311"]

steps:
- uses: actions/checkout@v4
- name: Build Wheels
uses: pypa/cibuildwheel@v2.16.1
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl

build_sdist:
name: Build Source Distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz

upload_pypi:
needs: [build_sdist, build_wheels]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
- uses: actions/download-artifact@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build
- name: Build package
run: python -m build
- name: Publish package to test.pypi
uses: pypa/gh-action-pypi-publish@release/v1
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TEST_API_JPMC_OSS }}
repository-url: https://test.pypi.org/legacy/
print_hash: true
skip-existing: true
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ solvers = [

[build-system]
requires = ["setuptools>=45",
"wheel",
"setuptools_scm[toml]>=6.2",]
"wheel"]
build-backend = "setuptools.build_meta"

[tool.black]
Expand Down
2 changes: 0 additions & 2 deletions qokit/fur/c/csim/src/diagonal.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
****************************************/
#include <stdlib.h>
#include <math.h>
#include <omp.h>

#include <diagonal.h>


Expand Down
15 changes: 11 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# // SPDX-License-Identifier: Apache-2.0
# // Copyright : JP Morgan Chase & Co
###############################################################################
from setuptools import setup, find_packages, Extension
from setuptools import setup, find_packages, Extension, Distribution
from setuptools.command.build_ext import build_ext
import subprocess
import os
import sys


environment_variable_name = "QOKIT_NO_C_ENV"
Expand All @@ -17,9 +18,15 @@
if environment_variable_value is not None:
QOKIT_NO_C_ENV = True

path = "./qokit/fur/c/csim/src/"

sources = [os.path.join(path, "diagonal.c"), os.path.join(path, "fur.c"), os.path.join(path, "qaoa_fur.c")]

extensions = []
if not QOKIT_PYTHON_ONLY:
extensions.append(Extension("simulator", sources=["qokit/fur/c/csim/src/*.c"], include_dirs=["simulator"]))
extensions.append(
Extension("simulator", sources=sources, include_dirs=[os.path.join(path, "")], extra_compile_args=["/d2FH4-"] if sys.platform == "win32" else [])
)


class SimulatorBuild(build_ext):
Expand All @@ -28,7 +35,7 @@ def run(self):
if not QOKIT_PYTHON_ONLY:
if QOKIT_NO_C_ENV:
raise Exception("No C/C++ enviroment setup")
subprocess.call(["make", "-C", "qokit/fur/c/csim/src"])
subprocess.call(["make", "-C", path])
super().run
except Exception as e:
print("No C/C++ enviroment setup to compile the C simulator. Installing Python Simulator")
Expand All @@ -40,6 +47,6 @@ def run(self):

setup(
ext_modules=extensions,
cmdclass={"build_ext": SimulatorBuild},
cmdclass={"build_ext": SimulatorBuild} if sys.platform == "win32" else {},
packages=find_packages(),
)
Loading