From e34d4cec1eb6392dda4f91301b44bbe2b790c988 Mon Sep 17 00:00:00 2001 From: zweien <278954153@qq.com> Date: Thu, 15 Jul 2021 10:53:07 +0800 Subject: [PATCH 1/4] ci: update ci for pypi, docker --- .github/workflows/docker.yml | 15 ++++------- .github/workflows/pypi.yml | 38 ++++++++++++++++++++++++++++ .github/workflows/python-package.yml | 4 +-- 3 files changed, 45 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/pypi.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 9fd50be..77f9f03 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -2,10 +2,11 @@ name: docker-build-push on: push: + branches: [master] pull_request: branches: [master] release: - types: [published, created, edited] + types: [published, edited] jobs: @@ -25,15 +26,8 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push - id: docker_build - uses: docker/build-push-action@v2 - with: - push: true - tags: ${{ secrets.DOCKERHUB_USERNAME }}/idrlnet:latest - - - name: Image digest - run: echo ${{ steps.docker_build.outputs.digest }} + name: Print event_name + run: echo "$GITHUB_EVENT_NAME, ${{ github.event_name }}, ${{ github.event.release.tag_name }}" - name: Get release version @@ -48,3 +42,4 @@ jobs: with: push: true tags: ${{ secrets.DOCKERHUB_USERNAME }}/idrlnet:${{ steps.get_version.outputs.RELEASE_VERSION }} + file: Dockerfile \ No newline at end of file diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml new file mode 100644 index 0000000..cb6853e --- /dev/null +++ b/.github/workflows/pypi.yml @@ -0,0 +1,38 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Publish to PyPI +on: + release: + types: [published, edited] + + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: [3.7] + + 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 + run: | + python -m pip install --upgrade pip + python -m pip install setuptools wheel twine + + - name: Publish to PyPI + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python setup.py sdist bdist_wheel + twine upload --repository-url https://test.pypi.org/legacy/ dist/* + + diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 6ef0ee7..72f3bce 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -31,8 +31,8 @@ jobs: run: | # stop the build if there are Python syntax errors or undefined names flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + # exit-zero treats all errors as warnings. Theg GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | - python examples/simple_poisson/simple_poisson.py + python examples/simple_poisson/simple_poisson.py From 5bdbe832d1a43799eca4ebc3b502fc8ee3df2781 Mon Sep 17 00:00:00 2001 From: zweien <278954153@qq.com> Date: Thu, 15 Jul 2021 11:26:51 +0800 Subject: [PATCH 2/4] docs: update README --- README.md | 51 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index e0f14d6..4989da5 100644 --- a/README.md +++ b/README.md @@ -2,33 +2,45 @@ [![Python](https://img.shields.io/badge/python-3.8-blue.svg)](https://python.org) [![Documentation Status](https://readthedocs.org/projects/idrlnet/badge/?version=latest)](https://idrlnet.readthedocs.io/en/latest/?badge=latest) +# IDRLnet + + +**IDRLnet** is a machine learning library on top of [PyTorch](https://pytorch.org/). Use IDRLnet if you need a machine +learning library that solves both forward and inverse differential equations via physics-informed neural +networks (PINN). IDRLnet is a flexible framework inspired by [Nvidia Simnet](https://developer.nvidia.com/simnet>). + ## Installation +Choose one of the following installation methods. + +### PyPI + +Simple installation from PyPI + +```bash +pip install -U idrlnet +``` + +Note: To avoid version conflicts, please use some tools to create a virtual environment first. + ### Docker ```bash -git clone https://github.com/idrl-lab/idrlnet -cd idrlnet -docker build . -t idrlnet_dev -docker run -it -p [EXPOSED_SSH_PORT]:22 -v [CURRENT_WORK_DIR]:/root/pinnnet idrlnet_dev:latest bash +docker pull idrl/idrlnet:latest ``` ### Anaconda -```bash + + +### From Source + +``` git clone https://github.com/idrl-lab/idrlnet cd idrlnet -conda create -n idrlnet_dev python=3.8 -y -conda activate idrlnet_dev -pip install -r requirements.txt pip install -e . ``` -# IDRLnet - -IDRLnet is a machine learning library on top of [Pytorch](https://www.tensorflow.org/). Use IDRLnet if you need a machine -learning library that solves both forward and inverse partial differential equations (PDEs) via physics-informed neural -networks (PINN). IDRLnet is a flexible framework inspired by [Nvidia Simnet](https://developer.nvidia.com/simnet>). ## Features @@ -81,3 +93,16 @@ First off, thanks for taking the time to contribute! IDRLnet was originally developed by IDRL lab. +## Citation +Feel free to cite this library. + +```bibtex +@article{peng2021idrlnet, + title={IDRLnet: A Physics-Informed Neural Network Library}, + author={Wei Peng and Jun Zhang and Weien Zhou and Xiaoyu Zhao and Wen Yao and Xiaoqian Chen}, + year={2021}, + eprint={2107.04320}, + archivePrefix={arXiv}, + primaryClass={cs.LG} +} +``` From d6bb4b3a6892c8a1d5970c9038e8e7a09df41c3a Mon Sep 17 00:00:00 2001 From: zweien <278954153@qq.com> Date: Thu, 15 Jul 2021 11:31:35 +0800 Subject: [PATCH 3/4] ci: change testpypi to pypi --- .github/workflows/pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index cb6853e..9ad7369 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -33,6 +33,6 @@ jobs: TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | python setup.py sdist bdist_wheel - twine upload --repository-url https://test.pypi.org/legacy/ dist/* + twine upload --repository-url dist/* From 5f9b1b184dee7bea89c67ab2f471330c43424209 Mon Sep 17 00:00:00 2001 From: zweien <278954153@qq.com> Date: Thu, 15 Jul 2021 12:39:42 +0800 Subject: [PATCH 4/4] ci: update pypi installation check --- .github/workflows/pypi.yml | 8 +++++--- .github/workflows/python-package.yml | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 9ad7369..8acced8 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -6,7 +6,6 @@ on: release: types: [published, edited] - jobs: build: @@ -34,5 +33,8 @@ jobs: run: | python setup.py sdist bdist_wheel twine upload --repository-url dist/* - - + + - name: Install from PyPI + run: | + pip install -U idrlnet + pip show idrlnet diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 72f3bce..90cbd21 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -31,8 +31,8 @@ jobs: run: | # stop the build if there are Python syntax errors or undefined names flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. Theg GitHub editor is 127 chars wide + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | - python examples/simple_poisson/simple_poisson.py + python examples/simple_poisson/simple_poisson.py \ No newline at end of file