-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Core Cooper components: ConstrainedMinimizationProblem, (Lagrangian)Formulation, ConstrainedOptimizer * Documentation of core components * Populate initial tutorial gallery
- Loading branch information
1 parent
8749873
commit 8a8493a
Showing
74 changed files
with
5,254 additions
and
587 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: [master, dev] | ||
pull_request: | ||
branches: ["*"] | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
python-version: [3.8] | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
# No gpu workflow: https://github.com/apache/singa/issues/802 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies others | ||
if: ${{ matrix.os != 'windows-latest' }} | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install .[dev] | ||
# Windows is treated differently, as PyTorch is not uploaded to Pypi atm | ||
- name: Install dependencies windows | ||
if: ${{ matrix.os == 'windows-latest' }} | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install torch==1.10.0+cpu -f https://download.pytorch.org/whl/torch_stable.html | ||
pip install .[dev] | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined in Cooper folder (ignoring tutorials) | ||
flake8 --ignore=E203,E266,E501 cooper --count --exit-zero --max-doc-length=80 --max-line-length=88 --statistics | ||
# Uncomment below to apply flake8 to tutorials | ||
# flake8 --ignore=E203,E266,E501 cooper --count --exit-zero --max-doc-length=80 --max-line-length=88 --statistics | ||
- name: Lint with Black | ||
run: | | ||
black --check --diff . | ||
- name: Sort imports with isort | ||
run: | | ||
isort cooper | ||
isort tutorials | ||
- name: Test with pytest | ||
run: | | ||
pytest . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Coverage | ||
|
||
on: | ||
push: | ||
branches: [master, dev] | ||
pull_request: | ||
branches: [master, dev] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
# Setup lastest python version | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.8" | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install codecov pytest-cov | ||
pip install .[dev] | ||
- name: Coverage tests | ||
run: pytest --cov=cooper . --cov-report term-missing | ||
|
||
- name: Codecov | ||
if: success() | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
run: codecov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v2.3.0 | ||
hooks: | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- repo: https://github.com/psf/black | ||
rev: 21.12b0 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.10.1 | ||
hooks: | ||
- id: isort |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,5 +11,3 @@ install: pip install -U tox-travis | |
|
||
# Command to run tests, e.g. python setup.py test | ||
script: tox | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
# Contributing to **Cooper** | ||
|
||
|
||
We want to make contributing to **Cooper** as easy and transparent as | ||
possible. | ||
|
||
|
||
## Building | ||
|
||
Using `pip`, you can install the package in development mode by running: | ||
|
||
```sh | ||
pip install --editable "[.dev]" | ||
``` | ||
|
||
## Testing | ||
|
||
We test the package using `pytest`, which you can run locally by typing | ||
|
||
```sh | ||
pytest tests | ||
``` | ||
|
||
## Pull Requests | ||
|
||
We actively welcome your pull requests. | ||
|
||
1. Fork the repo and create your branch from `master`. | ||
2. If you've added code that should be tested, add tests. | ||
3. If you've changed APIs, update the documentation. | ||
4. Ensure the test suite passes. | ||
5. Make sure your code lints. | ||
|
||
|
||
## Issues | ||
|
||
We use GitHub issues to track public bugs. Please ensure your description is | ||
clear and has sufficient instructions to be able to reproduce the issue. | ||
|
||
## Coding Style | ||
|
||
We use `black` for formatting `isort` for import sorting, `flake8` for | ||
linting. We ask for type hints for all code committed to **Cooper** and check | ||
for compliance with `mypy`. The CI system should check of this when you submit | ||
your pull requests. | ||
|
||
## License | ||
|
||
By contributing to **Cooper**, you agree that your contributions will be | ||
licensed under the LICENSE file in the root directory of this source tree. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.