Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nariman87 committed Mar 17, 2022
0 parents commit e961584
Show file tree
Hide file tree
Showing 115 changed files with 14,960 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Bug report
description: Create a bug report to help us improve FlamingPy
title: '[replace with a short, descriptive title for your report]'
labels: "bug"

body:
- type: checkboxes
id: terms
attributes:
label: |
Before posting a bug report
description: |
Please first search existing GitHub issues and documentation to make sure this report and relevant resolutions do not already exist:
https://github.com/XanaduAI/strawberryfields/issues
options:
- label: I have searched existing GitHub issues and documentation to make sure the issue and relevant resolutions do not already exist.
required: true
- type: markdown
id: description
attributes:
value: |
# Issue description
A clear and concise description of what the bug is -- remember to include essential code snippets, references, and screenshots below, as needed.
- type: textarea
id: expected
attributes:
label: Expected behavior
description: |
What do you expect to happen?
validations:
required: true
- type: textarea
id: actual
attributes:
label: Actual buggy behavior
description: |
What actually happens? Describe the bug.
validations:
required: true
- type: textarea
id: reproduces
attributes:
label: How to reproduce
description: |
Steps to reproduce the behavior. (Please provide steps such as 'Go to ...', 'Run commands ...', and 'See the warning ...')
If you have used a specific CLI and/or IDE, you must include it here.
What percentage of the time does it happen?
validations:
required: true
- type: textarea
id: system
attributes:
label: System information
description: Please post the output of `import flamingpy as fp; fp.about()` or, if not possible/relevant, a note on why this is not included. This will be automatically formatted into code, so no need for backticks.
render: shell
validations:
required: true
- type: markdown
id: tracebacks
attributes:
value: |
# Tracebacks and additional source code
You can include additional code snippets and error tracebacks related to the issue here.
- type: textarea
id: tracebacks
attributes:
label: Tracebacks
description: Please include the error tracebacks related to the issue here. This will be automatically formatted into code, so no need for backticks.
render: shell
- type: textarea
id: additional-info
attributes:
label: Additional context
description: Please include any additional source code, information, configuration or data that might be necessary to reproduce the issue.
render: shell
56 changes: 56 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Feature request
description: Suggest a new feature to improve the performance and breadth of FlamingPy
title: '[replace with a short, descriptive title for your request]'
labels: "enhancement"

body:
- type: checkboxes
id: terms
attributes:
label: |
Before posting a feature request
description: |
Please first search existing GitHub issues and documentation to make sure this request and relevant resolutions do not already exist:
https://github.com/XanaduAI/ft-stack/issues
options:
- label: I have searched existing GitHub issues and documentation to make sure the feature request and relevant resolutions do not already exist.
required: true
- type: markdown
id: description
attributes:
value: |
# Feature description
A clear and concise description of the desired enhancement -- remember to include references, code snippets, and screenshots below, if relevant.
- type: textarea
id: details
attributes:
label: Feature details
description: |
What feature would you like to have?
Is your feature request related to a problem and/or lack of functionality in FlamingPy?
How does the new feature improve the performance and/or build on the theory of proposed state-of-the-art methods?
validations:
required: true
- type: textarea
id: implementation
attributes:
label: Implementation
description: |
Do you have an idea for how this can be implemented and what solution you'd like us to follow? We may ask for your direct contribution here.
Are there alternative solutions we may want to consider?
- type: textarea
id: info
attributes:
label: Additional context
description: |
Please provide any additional information here.
- type: dropdown
id: urgency
attributes:
label: How important would you say this feature is?
options:
- "1: Not very important. Would be nice to have."
- "2: Somewhat important. Needed this quarter."
- "3: Very important! Slowing down or blocking work."
validations:
required: true
49 changes: 49 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
## Context for changes

< Include a summarized description of the changes and fixed issues in the format below. Please avoid placing “N/A” here. >

- **Title 1**:
text goes here
- **Title 2**:
text goes here

## Example usage and tests

< Add some example usage and tests showing how to utilize new features and fixes; otherwise, put “N/A” >


## Performance results justifying changes

< If you have improved a feature you should support it with some benchmarking and scaling results, plots, etc.; otherwise, put “N/A” >


## Workflow actions and tests

< In most cases, we need a set of unit tests that automatically and comprehensively test for newly added features; if not applicable or CI tests already exist, either mention it or put “N/A” >


## Expected benefits and drawbacks

< Summarize your justifications for the change and its benefits. Is there any drawback that exists today with the changes or may occur in the future? (you cannot place “N/A” here) >


**Expected benefits:**
- text goes here

**Possible drawbacks:**
- text goes here

## Related Github issues

< Explicitly, link any corresponding issue and update the status of the relevant GitHub issue here; otherwise, put “N/A” >


## Checklist and integration statements

- [ ] My Python and C++ codes follow the coding and commenting styles of this project as indicated by existing files. Specifically, the changes conform to given `black`, `docformatter` and `pylint` configurations.
- [ ] I have performed a self-review of these changes.
- [ ] I confirm that I have already merged other branches into this branch as required.
- [ ] I have added context for corresponding changes in documentation and README.md as needed.
- [ ] I have added new workflows and CI tests for corresponding changes and these pass locally for me.
- [ ] I have updated `_version.py` based on [semantic versioning](https://semver.org/). I recognize that the developers may create a special release including my changes.
- [ ] I have checked my code and corrected misspellings to the best of my capacity.
40 changes: 40 additions & 0 deletions .github/workflows/build_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build & Tests
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop

jobs:
core-unit-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9, '3.10']
steps:
- uses: actions/checkout@v2

- name: Setup python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Get the latest pip
run: python -m pip install --upgrade pip

- name: Install compilation and testing requirements of flamingpy
run: python -m pip install -r dev_requirements.txt

- name: Build flamingpy from Source
run: |
python setup.py develop
python setup.py build_cython --inplace
python setup.py build_cmake --inplace
- name: Run tests
run: python -m pytest tests/ --cov=flamingpy --cov-report=xml --cov-report=term-missing -p no:warnings --tb=native
17 changes: 17 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Create Documentation
on:
pull_request:
branches:
- main

jobs:
sphinx:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1

- name: Build sphinx documentation
uses: XanaduAI/sphinx-action@master
with:
docs-folder: "doc/"
pre-build-command: "apt install -y build-essential graphviz git cmake && python -m pip install --upgrade pip && python -m pip install -r dev_requirements.txt && python setup.py develop"
32 changes: 32 additions & 0 deletions .github/workflows/format.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Formatting Checks
on:
pull_request:
branches:
- main
- develop
push:
branches:
- main
- develop

jobs:
black-n-docformatter:
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Get the latest pip and black
run: |
python -m pip install --upgrade pip
python -m pip install black docformatter --upgrade
- uses: actions/checkout@v2

- name: Run black
run: python -m black -l 100 tests flamingpy --check

- name: Run docformatter
run: python -m docformatter --check flamingpy/*/*.py
34 changes: 34 additions & 0 deletions .github/workflows/linting.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Linting Checks
on:
pull_request:
branches:
- main
- develop

jobs:
pylint:
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Get the latest pip and pylint
run: |
python3 -m pip install --upgrade pip
python3 -m pip install pylint
- uses: actions/checkout@v2

- name: Install compilation and testing requirements of flamingpy
run: python3 -m pip install -r dev_requirements.txt

- name: Build flamingpy from Source
run: |
python setup.py develop
python setup.py build_cython --inplace
python setup.py build_cmake --inplace
- name: Run pylint
run: python3 -m pylint --disable=R,W flamingpy src/flamingpy/benchmarks/*.py src/flamingpy/examples/*.py tests/unit/*.py
83 changes: 83 additions & 0 deletions .github/workflows/upload_linux_x64.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Upload Linux Wheels x86_64
on:
release:
types: [published]
pull_request:
types:
- labeled
branches:
- main
- develop

jobs:
upload-linux-x64:
if: ${{ github.event.label.name == 'manual upload' }}
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9, '3.10']
os: [ubuntu-latest]
arch: [x86_64]
runs-on: ${{ matrix.os }}
name: ${{matrix.os}} ${{matrix.python-version}}
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.4.1
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v2

- name: Setup python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pyyaml wheel --upgrade
python -m pip install -r dev_requirements.txt
- name: Build flamingpy from Source
run: |
python setup.py develop
python setup.py build_cython --inplace
python setup.py build_cmake --inplace
- name: Run tests
run: python -m pytest tests/ --tb=native

- name: Stripping C++ modules
run: strip --strip-unneeded flamingpy/cpp/*.so

- name: Build the wheel
run: python setup.py bdist_wheel
env:
CIBW_ARCHS_LINUX: ${{matrix.arch}}

- name: Rename the wheel
run: |
wheel=$(find dist/*.whl)
mv $wheel $(echo $wheel | sed 's/-linux_/-manylinux1_/')
- name: Publish the wheel
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
#password: ${{ secrets.TEST_PYPI_API_TOKEN }}
#repository_url: https://test.pypi.org/legacy/

- name: Uninstall existing versions and add a delay
run: |
python -m pip uninstall flamingpy -y
sleep 5m
- name: Pip install flamingpy
run: python -m pip install flamingpy

- name: Run some involved package examples for testing purposes
run: |
python /opt/hostedtoolcache/Python/*/x64/lib/python*/site-packages/flamingpy/benchmarks/lemon.py
python /opt/hostedtoolcache/Python/*/x64/lib/python*/site-packages/flamingpy/benchmarks/shortest_path.py
Loading

0 comments on commit e961584

Please sign in to comment.