Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rofuyu committed Apr 26, 2021
0 parents commit 7f83301
Show file tree
Hide file tree
Showing 131 changed files with 47,378 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: 'bug'
assignees: ''

---
## Description
(A clear and concise description of what the bug is.)

## How to Reproduce?
(If you developed your own code, please provide a short script that reproduces the error. For existing examples, please provide link.)

### Steps to reproduce
(Please provide minimal example of code snippet that reproduces the error. For existing examples, please provide link.)

```python
put code here
```

(Paste the commands you ran that produced the error.)

1.
2.

## What have you tried to solve it?

1.
2.

## Error message or code output
(Paste the complete error message, including stack trace, or the undesired output that the above snippet produces.)

```
put error or undesired output here
```

## Environment
- Operating system:
- Python version:
- PECOS version:

(Add as much information about your environment as possible, e.g. dependencies versions.)
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an enhancement, feature request, or idea for this project
title: ''
labels: 'enhancement'
assignees: ''

---

## Description
(A clear and concise description of what the feature is.)
- If the proposal is about a new model, provide description of what the model is.
- If the proposal is about an API, provide mock examples if possible.

## References
- list reference and related literature
- list known implementations
6 changes: 6 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*Issue #, if available:*

*Description of changes:*


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
35 changes: 35 additions & 0 deletions .github/build_pypi_wheel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
set -e

# Get pip
echo "Build wheel using Python version $PIP_VER..."
PIP=$(ls /opt/python/cp${PIP_VER//./}-cp*/bin/pip)
if [ -z $PIP ]; then
echo "No pip found for version $PIP_VER, exit"
exit 1
fi
echo "pip: $($PIP --version)"


# Install dependencies
echo "Install dependencies..."
$PIP install setuptools wheel twine auditwheel
yum install -y openblas-devel


# Build wheel
PECOS_SOURCE=$DOCKER_MNT/
WHEEL_OUTPUT_FOLDER=$DOCKER_MNT/$WHEEL_DIR

$PIP wheel $PECOS_SOURCE --no-deps -w $WHEEL_OUTPUT_FOLDER
WHEEL_NAME=$(ls $WHEEL_OUTPUT_FOLDER)

echo "Temporary wheel: $(ls $WHEEL_OUTPUT_FOLDER)"
auditwheel show $WHEEL_OUTPUT_FOLDER/$WHEEL_NAME

echo "Auditing wheel to platform $PLAT..."
auditwheel repair $WHEEL_OUTPUT_FOLDER/$WHEEL_NAME -w $WHEEL_OUTPUT_FOLDER
rm $WHEEL_OUTPUT_FOLDER/$WHEEL_NAME

echo "Audited wheel: $(ls $WHEEL_OUTPUT_FOLDER)"
auditwheel show $WHEEL_OUTPUT_FOLDER/$(ls $WHEEL_OUTPUT_FOLDER)
54 changes: 54 additions & 0 deletions .github/workflows/build_pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Pypi Build and Release

on: [push, pull_request]

jobs:
build:
name: Build PyPI Wheel
strategy:
max-parallel: 4
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
build_platform: ["manylinux2014_x86_64"]

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

- name: Build Wheel
env:
DOCKER_IMG: quay.io/pypa/${{ matrix.build_platform }}
DOCKER_MNT: pypi_build
WHEEL_DIR: wheel # wheel location
run: |
echo "Build wheel for PECOS using Python version ${{ matrix.python-version }}..."
docker run --rm -v $(pwd):/$DOCKER_MNT \
--env PLAT=${{ matrix.build_platform }} --env PIP_VER=${{ matrix.python-version }} \
--env DOCKER_MNT=$DOCKER_MNT --env WHEEL_DIR=$WHEEL_DIR \
$DOCKER_IMG /bin/bash /$DOCKER_MNT/.github/build_pypi_wheel.sh
- name: Check Version Tag
id: check-ver-tag
run: |
if [[ "${{ github.event_name }}" == "push" ]] && \
[[ "${{ github.event.ref }}" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo ::set-output name=match::true
fi
- name: Upload to PyPI
if: steps.check-ver-tag.outputs.match == 'true' # Only upload for tags v*.*.*
env:
TWINE_USERNAME: ${{ secrets. PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets. PYPI_PASSWORD }}
WHEEL_DIR: wheel # same as Build-Wheel/WHEEL_DIR
run: |
WHEEL=$(ls $(pwd)/$WHEEL_DIR)
if [ -z $WHEEL ]; then
echo "Wheel build not successful, exit"
exit 1
fi
echo "Will upload $WHEEL to PyPI..."
pip install twine --upgrade
python3 -m twine upload $(pwd)/$WHEEL_DIR/$WHEEL --verbose
50 changes: 50 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: "Code scanning - action"

on:
push:
pull_request:
schedule:
- cron: '0 19 * * 0'

jobs:
CodeQL-Build:
name: CodeQL
# CodeQL runs on ubuntu-latest
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
language: [ 'python','cpp' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
31 changes: 31 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Python Unit Tests

on: [push, pull_request]

jobs:
build:
name: Python Unit Tests
strategy:
max-parallel: 4
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
platform: [ubuntu-16.04, ubuntu-18.04, ubuntu-20.04]

runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install pip
python -m pip install --upgrade pip
pip install pytest pytest-coverage
pip install -v --editable .
- name: Test with pytest
run: |
pytest
32 changes: 32 additions & 0 deletions .github/workflows/style_type_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Style and type checks

on: [push, pull_request]

jobs:
build:
name: Style and Type Checks
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install pip
python -m pip install --upgrade pip
- name: Style checks
run: |
pip install black
python -m black -v --check --config .style_type.cfg --line-length=100 --diff ./pecos
python -m black -v --check --config .style_type.cfg --line-length=100 --diff ./test
- name: Type checks
run: |
pip install mypy
python -m mypy -v --config-file .style_type.cfg -p pecos
python -m mypy -v --config-file .style_type.cfg `find ./test/ -type f -name "*.py"`
if: ${{ success() || failure() }}
# - name: Check license headers
# run: python .devtools/license check src test
7 changes: 7 additions & 0 deletions .style_type.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[isort]
line_length = 100
multi_line_output = 3
include_trailing_comma = true

[mypy]
ignore_missing_imports = true
4 changes: 4 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## Code of Conduct
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
opensource-codeofconduct@amazon.com with any additional questions or comments.
89 changes: 89 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Contributing Guidelines

Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional
documentation, we greatly value feedback and contributions from our community.

Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
information to effectively respond to your bug report or contribution.


## Reporting Bugs/Feature Requests

We welcome you to use the GitHub issue tracker to report bugs or suggest features.

When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already
reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:

* A reproducible test case or series of steps
* The version of our code being used
* Any modifications you've made relevant to the bug
* Anything unusual about your environment or deployment


## Contributing via Pull Requests
Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:

1. You are working against the latest source on the `mainline` branch.
2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already.
3. You open an issue to discuss any significant work - we would hate for your time to be wasted. If there is an existing issue your are interested in working on, you should comment on it so others don't start working on the same issue.

To send us a pull request, please:

1. Create a personal fork of the project on Github webpage. Clone the fork on your local machine.
2. Add the original repository as a remote called `upstream`. Your remote repo on Github is called `origin`.
```
git remote add upstream https://github.com/amzn/pecos.git
git remote -v # Display all remotes to double-check
```
3. If you created your fork a while ago, be sure to pull upstream changes into your local repository.
```
git checkout mainline
git pull -r upstream
```
4. Create a new branch from `mainline` to work on.
5. Implement your code on the new branch:
* Follow the code style of the project.
* Write or adapt tests as needed.
* Add or change the documentation as needed.
6. **Ensure local style/type checks and tests pass.**
7. Commit using clear messages. **Squash your commits into a single commit.**
8. Push your branch to **your fork** `origin` on Github.
```
git push --set-upstream origin <BRANCH NAME>
```
9. On GitHub webpage's pull request panel, open a pull request into **original repository** `upstream` from **your fork**. *(NOTE: this is the default option if one does not make changes when creating PR)*
* Carefully fill out PR template
* Click on "Draft PR" on drop-down menu to double-check by oneself
* When ready, click on “Ready for review”
10. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
12. If you need to make changes to the pull request, simply modify on your branch by **amend** the commit, and then *force-push* to your `origin` branch. The pull request will automatically update its timeline:
```
# Do modification
git commit -a --amend
git push -f
```
11. Once the pull request is approved and merged, pull the changes from upstream to your local repo and delete your extra branch(es).
GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
[creating a pull request](https://help.github.com/articles/creating-a-pull-request/).
## Finding contributions to work on
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'Call for Contribution' or 'good first issue' issues is a great place to start.
## Code of Conduct
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
opensource-codeofconduct@amazon.com with any additional questions or comments.
## Security issue notifications
If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue.
## Licensing
See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.
We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes.
Loading

0 comments on commit 7f83301

Please sign in to comment.