Skip to content

Commit

Permalink
Merge branch 'develop' into 'main'
Browse files Browse the repository at this point in the history
Release Version 0.0.1

See merge request ricos/machine_learning/phlower!18
  • Loading branch information
riku-sakamoto committed Aug 2, 2024
2 parents dd2b995 + 063b179 commit 61067af
Show file tree
Hide file tree
Showing 193 changed files with 12,098 additions and 54 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/gh_pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: github pages

on:
push:
branches:
- main

jobs:
build_docs:
runs-on: ubuntu-latest
container:
image: python:3.10-slim
steps:
- name: checkout
uses: actions/checkout@v1

- name: setup
shell: bash
run: |
apt update -y
apt install -y make git
pip install poetry
poetry config virtualenvs.in-project false
poetry install
- name: build_pages
shell: bash
run: |
make document
mkdir public
cp -r docs/build/html/* public/
- name: upload_artifacts
uses: actions/upload-artifact@v3
with:
name: html_pages
path: public/ # or path/to/artifact

deploy_docs:
runs-on: ubuntu-latest
needs: build_docs
steps:

- name: download_artifacts
uses: actions/download-artifact@v3
with:
name: html_pages
path: public/

- name: deploy_pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: public
force_orphan: true
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,11 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
#.idea/

# Editor Setting
.vscode

# data

tests/data
38 changes: 23 additions & 15 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ stages:
- deploy

default:
image: python:3.11-slim
image: python:3.10-slim
before_script:
- apt update
- apt install -y make
- pip install poetry
- poetry config virtualenvs.in-project false
- poetry install
- make dev-install

lint:
stage: test
Expand All @@ -21,7 +21,7 @@ lint:
pytest:
stage: test
script:
- poetry run pytest tests --cov=src --cov-report term-missing
- make test
- poetry run python3 -m coverage html -d coverage
- poetry run python3 -m coverage xml
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
Expand All @@ -37,19 +37,27 @@ pytest:
- no-gpu
- GenuineIntel

e2e_test:
stage: test
script:
- make e2e_test
tags:
- no-gpu
- GenuineIntel

# pages:
# stage: deploy
# script:
# - make document
# artifacts:
# paths:
# - public
# only:
# - main
# - develop
# - fix_sphinx

pages:
stage: deploy
script:
- make document
- mkdir public
- cp -r docs/build/html/* public/
artifacts:
paths:
- public
only:
- main
- develop
- fix_sphinx

.deploy:wheel:
stage: deploy
Expand Down
52 changes: 25 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
IN_PROJECT?=true


.PHONY: init
init:
Expand All @@ -6,42 +8,38 @@ init:
poetry install


.PHONY: black-check
black-check:
poetry run black --check src tests

.PHONY: black
black:
poetry run black src tests

.PHONY: flake8
flake8:
poetry run flake8 src tests

.PHONY: isort-check
isort-check:
poetry run isort --check-only src tests

.PHONY: isort
isort:
poetry run isort src tests

.PHONY: mypy
mypy:
poetry run mypy src

.PHONY: format
format:
$(MAKE) black
$(MAKE) isort
poetry run python3 -m ruff check --select I --fix
poetry run python3 -m ruff format

.PHONY: test
test:
poetry run pytest tests --cov=src --cov-report term-missing --durations 5
poetry run pytest tests -m "not e2e_test" --cov=src --cov-report term-missing --durations 5


.PHONY: test
e2e_test:
poetry run pytest tests -m "e2e_test"


.PHONY: lint
lint:
$(MAKE) black-check
$(MAKE) isort-check
$(MAKE) flake8
$(MAKE) mypy
poetry run python3 -m ruff check --diff
# $(MAKE) mypy

.PHONY: dev-install
dev-install: init
poetry run python3 -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118


.PHONY: document
document:
rm -rf docs/build || true
rm -rf docs/source/reference/generated || true
rm -rf docs/source/tutorials/basic_usages || true
poetry run sphinx-build -M html docs/source docs/build
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
# phlower

This is a Python package which helps you handle GNN especially for physics problems.

__phlower__ is a deep learning framework based on PyTorch especially for physical phenomenon such as fluid dynamics.

For more details, please refer to user manual below.

- [User Manual](https://ricosjp.github.io/phlower/)


## Key Features


Tutorials are prepared for key features !

1. [Extended Tensor object which enables you to handle physics dimention](https://github.com/ricosjp/phlower/tutorials/basic_usages/01_phlower_tensor_basic)
2. [Model definition by yaml file](https://github.com/ricosjp/phlower/tutorials/basic_usages/02_model_definition_by_yaml_file)
3. [High Level API for scaling, training and predicion](https://github.com/ricosjp/phlower/tutorials/basic_usages/03_high_level_api_for_scaling_training_and_prediction)



## Usage

**phlower** can be installed with pip. Python 3.10 or newer is supported.

```
pip install phlower
```

20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
4 changes: 4 additions & 0 deletions docs/source/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
reference/generated
tutorials/**
!tutorials/index.rst
sg_execution_times.rst
22 changes: 22 additions & 0 deletions docs/source/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
:orphan:

{% extends "!autosummary/class.rst" %}

{#
Inherited methods from parent class are not shown in this manual.
original templates are located in `.venv/lib/python3.10/site-packages/sphinx/ext/autosummary/templates/autosummary`
#}
{% block methods %}
{% if methods %}
.. rubric:: Methods

.. autosummary::
{% for item in methods %}
{% if item in inherited_members %}
{% else %}
~{{ name }}.{{ item }}
{% endif %}
{%- endfor %}
{% endif %}

{% endblock %}
25 changes: 25 additions & 0 deletions docs/source/_templates/autosummary/nn.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
:orphan:

{% extends "!autosummary/class.rst" %}

{#
Specific methods are only shown in this manual.
showitems = ["from_setting", "get_nn_name", "forward"]
original templates are located in `.venv/lib/python3.10/site-packages/sphinx/ext/autosummary/templates/autosummary`
#}

{% block methods %}
{% set showitems = ["from_setting", "get_nn_name", "forward"] %}
{% if methods %}
.. rubric:: Methods

.. autosummary::
{% for item in methods %}
{% if item not in showitems %}
{% else %}
~{{ name }}.{{ item }}
{% endif %}
{%- endfor %}
{% endif %}

{% endblock %}
23 changes: 23 additions & 0 deletions docs/source/_templates/autosummary/settings.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
:orphan:

{% extends "!autosummary/class.rst" %}

{#
Methods which startswith "model_" are not shown in this manual.
original templates are located in `.venv/lib/python3.10/site-packages/sphinx/ext/autosummary/templates/autosummary`
#}

{% block methods %}
{% if methods %}
.. rubric:: Methods

.. autosummary::
{% for item in methods %}
{% if item.startswith("model_") %}
{% else %}
~{{ name }}.{{ item }}
{% endif %}
{%- endfor %}
{% endif %}

{% endblock %}
Loading

0 comments on commit 61067af

Please sign in to comment.