Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
yapolyak committed Apr 24, 2023
0 parents commit 5d8f8ff
Show file tree
Hide file tree
Showing 23 changed files with 1,780 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/build-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash
set -evu

# Usage:
#
# build-test [mypy|nomypy]
#
# Arguments:
# - mypy: include mypy check ("mypy" or "nomypy")
#
# Environment variables used:
# - GITHUB_WORKSPACE: workspace directory
#
# WARNING: running this locally will delete any local files that
# aren't strictly part of the git tree, including gitignored files!

MODULE=pytket-cuquantum

MYPY=$1

PLAT=`python -c 'import platform; print(platform.system())'`

PYVER=`python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))'`

git clean -dfx

echo "Module to test: ${MODULE}"

MODULEDIR="${GITHUB_WORKSPACE}"

ARTIFACTSDIR=${GITHUB_WORKSPACE}/wheelhouse

rm -rf ${ARTIFACTSDIR} && mkdir ${ARTIFACTSDIR}

python -m pip install --upgrade pip wheel build

# Generate and install the package
python -m build
for w in dist/*.whl ; do
python -m pip install $w
cp $w ${ARTIFACTSDIR}
done

# Test and mypy:
if [[ "${MYPY}" = "mypy" ]]
then
python -m pip install --upgrade mypy
fi

# Currently all tests depend on cuQuantum, so are disabled
#cd ${GITHUB_WORKSPACE}/tests
#
#python -m pip install --pre -r test-requirements.txt
#
## update the pytket version to the lastest (pre) release
#python -m pip install --upgrade --pre pytket~=1.0
#
#pytest --doctest-modules
#
#cd ..

if [[ "${MYPY}" = "mypy" ]]
then
${GITHUB_WORKSPACE}/mypy-check ${GITHUB_WORKSPACE}
fi
42 changes: 42 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build and test

on:
pull_request:
branches:
- main
- develop
push:
branches:
- develop
- 'wheel/**'
- 'runci/**'
release:
types:
- created
- edited
schedule:
# 04:00 every Tuesday morning
- cron: '0 4 * * 2'

jobs:
cuquantum-checks:
name: cuQuantum - Build and test module
strategy:
matrix:
os: ['ubuntu-22.04', 'macos-12', 'windows-2022']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* +refs/heads/*:refs/remotes/origin/*
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Build and test including remote checks (3.9) mypy
shell: bash
if: (matrix.os == 'macos-12') && (github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || github.event_name == 'release' || github.event_name == 'schedule' )
run: |
chmod +x ./.github/workflows/build-test
./.github/workflows/build-test mypy
34 changes: 34 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Lint python projects

on:
pull_request:
branches:
- main
- develop
push:
branches:
- develop
- 'wheel/**'
- 'runci/**'

jobs:
lint:

runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Update pip
run: pip install --upgrade pip
- name: Install black and pylint
run: pip install black~=22.3 pylint~=2.13,!=2.13.6
- name: Check files are formatted with black
run: |
black --check .
- name: Run pylint
run: |
pylint --recursive=y */
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.eggs
*.egg-info
build
dist
*.pyc
.vscode
.mypy_cache
.hypothesis
obj
docs/extensions
.ipynb_checkpoints
pytket/extensions/cuquantum/_metadata.py
55 changes: 55 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
[MASTER]
max-line-length=88
output-format=colorized
score=no
reports=no
disable=all
enable=
anomalous-backslash-in-string,
assert-on-tuple,
bad-indentation,
bad-option-value,
bad-reversed-sequence,
bad-super-call,
consider-merging-isinstance,
continue-in-finally,
dangerous-default-value,
duplicate-argument-name,
expression-not-assigned,
function-redefined,
inconsistent-mro,
init-is-generator,
line-too-long,
lost-exception,
missing-kwoa,
mixed-line-endings,
not-callable,
no-value-for-parameter,
nonexistent-operator,
not-in-loop,
pointless-statement,
redefined-builtin,
return-arg-in-generator,
return-in-init,
return-outside-function,
simplifiable-if-statement,
syntax-error,
too-many-function-args,
trailing-whitespace,
undefined-variable,
unexpected-keyword-arg,
unhashable-dict-key,
unnecessary-pass,
unreachable,
unrecognized-inline-option,
unused-import,
unnecessary-semicolon,
unused-variable,
unused-wildcard-import,
wildcard-import,
wrong-import-order,
wrong-import-position,
yield-outside-function

# Ignore long lines containing URLs or pylint or mypy directives.
ignore-long-lines=^(.*#\w*pylint: disable.*|.*# type: ignore.*|\s*(# )?<?https?://\S+>?)$
Loading

0 comments on commit 5d8f8ff

Please sign in to comment.