From 25df5260881c46c3439222d48d9ccf7f9464eac3 Mon Sep 17 00:00:00 2001 From: James Date: Wed, 6 Sep 2023 12:22:07 -0400 Subject: [PATCH 1/8] testing git work --- imporant.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 imporant.md diff --git a/imporant.md b/imporant.md new file mode 100644 index 0000000..8ec07f6 --- /dev/null +++ b/imporant.md @@ -0,0 +1 @@ +This is how it all begins. From c12ee94b597f3b28222e004b67655af013a7db44 Mon Sep 17 00:00:00 2001 From: Arnaud Bergeron Date: Wed, 6 Sep 2023 12:33:42 -0400 Subject: [PATCH 2/8] added gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bc7e60c --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.pt +archive \ No newline at end of file From c74bbe5cb62197b5c8a66d4906e4e8ba4cefc5fc Mon Sep 17 00:00:00 2001 From: James Date: Wed, 6 Sep 2023 12:42:28 -0400 Subject: [PATCH 3/8] some project management stuff --- .flake8 | 16 +++++++++ .pre-commit-config.yaml | 72 +++++++++++++++++++++++++++++++++++++++++ Makefile | 6 ++++ imporant.md | 1 - pyproject.toml | 48 +++++++++++++++++++++++++++ 5 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 .flake8 create mode 100644 .pre-commit-config.yaml create mode 100644 Makefile delete mode 100644 imporant.md create mode 100644 pyproject.toml diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..a4288c3 --- /dev/null +++ b/.flake8 @@ -0,0 +1,16 @@ +[flake8] +exclude = + .git, + __pycache__, + env, + venv, + build, + dist +docstring-convention = numpy +max-line-length = 100 +max_complexity = 15 +max_function_length = 100 +ignore = D100, D102, D103, D104, W503 +# for compatibility with black +# https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#flake8 +extend-ignore = E203 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..3caa31d --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,72 @@ +--- +repos: + +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + +- repo: https://github.com/pre-commit/pygrep-hooks + rev: v1.10.0 + hooks: + - id: rst-backticks # Detect common mistake of using single backticks when writing rst + - id: rst-inline-touching-normal # Detect mistake of inline code touching normal text in rst + +- repo: https://github.com/asottile/pyupgrade + rev: v3.9.0 + hooks: + - id: pyupgrade + args: [--py38-plus] + +- repo: https://github.com/ikamensh/flynt/ + rev: 1.0.0 + hooks: + - id: flynt + +- repo: https://github.com/asottile/reorder-python-imports + rev: v3.10.0 + hooks: + - id: reorder-python-imports + args: [--py38-plus, --add-import, from __future__ import annotations] + +# - repo: https://github.com/pre-commit/mirrors-mypy +# rev: v1.3.0 +# hooks: +# - id: mypy +# additional_dependencies: [types-all] +# files: bidspm +# args: [--config-file, setup.cfg] + +- repo: https://github.com/MarcoGorelli/auto-walrus + rev: v0.2.2 + hooks: + - id: auto-walrus + +- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt + rev: 0.2.3 + hooks: + - id: yamlfmt + args: [--mapping, '2', --sequence, '2', --offset, '0'] + +- repo: https://github.com/codespell-project/codespell + rev: v2.2.5 + hooks: + - id: codespell + args: [--toml, pyproject.toml] + additional_dependencies: [tomli] + +- repo: https://github.com/psf/black + rev: 23.7.0 + hooks: + - id: black + args: [--config, pyproject.toml] + +- repo: https://github.com/pycqa/flake8 + rev: 6.0.0 + hooks: + - id: flake8 + args: [--config, .flake8] + additional_dependencies: [flake8-docstrings] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..aa595af --- /dev/null +++ b/Makefile @@ -0,0 +1,6 @@ +coverage: + coverage erase + coverage run -m pytest + coverage report + coverage html + coverage xml diff --git a/imporant.md b/imporant.md deleted file mode 100644 index 8ec07f6..0000000 --- a/imporant.md +++ /dev/null @@ -1 +0,0 @@ -This is how it all begins. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..078d08b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,48 @@ +[build-system] +requires = ["hatchling", "hatch-vcs"] +build-backend = "hatchling.build" + +[project] +name = "NumGI" +description = "Differential equation solver." +readme = "README.md" +requires-python = ">=3.8" +license = { file = "LICENSE.txt" } +authors = [{ name = "Arnaud Bergeron", email = "bergerona62@gmail.com" }] +dynamic = ["version"] +dependencies = ["sympy", "torch", "NumGI"] + +[project.optional-dependencies] +doc = [ + "sphinx", + "sphinx-argparse", + "sphinx-copybutton", + "sphinx_rtd_theme", + "myst-parser", + "rstcheck", +] + + + +[tool.hatch.build.targets.wheel] +packages = ["NumGI"] + +[tool.hatch.version] +source = "vcs" + +[tool.hatch.build.hooks.vcs] +version-file = "NumGI/_version.py" + +[tool.pytest.ini_options] +addopts = "-ra -vv" + +[tool.coverage.run] +branch = true +source = ["NumGI/"] + + +[tool.codespell] +skip = "./.git,.mypy_cache,env,venv,tests,*bval,*bvec" + +[tool.black] +line-length = 100 From 2f60f46ef94ac82102ed8a9ed0886f14377e8e35 Mon Sep 17 00:00:00 2001 From: James Date: Wed, 6 Sep 2023 12:48:48 -0400 Subject: [PATCH 4/8] test new project setup --- EquationTokenizer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/EquationTokenizer.py b/EquationTokenizer.py index 2ed249c..ad75d3e 100644 --- a/EquationTokenizer.py +++ b/EquationTokenizer.py @@ -220,4 +220,7 @@ def defaultTokenizer(): dict_size = len(tokenize_dict) - return tokenize_dict, decode_dict, tokenize, decode \ No newline at end of file + return tokenize_dict, decode_dict, tokenize, decode + +def do_something(self): + print("somthing") \ No newline at end of file From f120d1ac5570e0ba73788e9dc704329f0aed54d3 Mon Sep 17 00:00:00 2001 From: James Date: Wed, 6 Sep 2023 12:58:36 -0400 Subject: [PATCH 5/8] more packagin --- .github/dependabot.yml | 14 +++++++++++ .github/workflows/system_test.yml | 33 ++++++++++++++++++++++++ .github/workflows/test.yml | 42 +++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/system_test.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..c2e4f53 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,14 @@ +--- +# Documentation +# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file +version: 2 +updates: +- package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + +- package-ecosystem: gitsubmodule + directory: / + schedule: + interval: weekly diff --git a/.github/workflows/system_test.yml b/.github/workflows/system_test.yml new file mode 100644 index 0000000..16f168e --- /dev/null +++ b/.github/workflows/system_test.yml @@ -0,0 +1,33 @@ +--- +name: system test + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + push: + branches: [main] + pull_request: + branches: ['*'] + +jobs: + test: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + python-version: ['3.11'] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dev + run: | + python -m pip install --upgrade pip + pip install .[dev] diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..9339598 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,42 @@ +--- +name: test + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + push: + branches: [main] + pull_request: + branches: ['*'] + +jobs: + test: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + python-version: ['3.8', '3.9', '3.10', '3.11'] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install + run: | + python -m pip install --upgrade pip + pip install -e .[tests] + - name: Run tests and coverage + run: make coverage + - name: Code coverage + uses: codecov/codecov-action@v3 + with: + file: coverage.xml + flags: ${{ matrix.os }}-${{ matrix.python-version }} + name: codecov + fail_ci_if_error: false From 3ab975a1c33eebd20cb1cc24c13ebbfe3dbc458c Mon Sep 17 00:00:00 2001 From: James Date: Wed, 6 Sep 2023 13:03:29 -0400 Subject: [PATCH 6/8] packagin --- DatasetTokenizer.py => NumGI/DatasetTokenizer.py | 0 EquationCreator.py => NumGI/EquationCreator.py | 0 EquationTokenizer.py => NumGI/EquationTokenizer.py | 3 --- 3 files changed, 3 deletions(-) rename DatasetTokenizer.py => NumGI/DatasetTokenizer.py (100%) rename EquationCreator.py => NumGI/EquationCreator.py (100%) rename EquationTokenizer.py => NumGI/EquationTokenizer.py (99%) diff --git a/DatasetTokenizer.py b/NumGI/DatasetTokenizer.py similarity index 100% rename from DatasetTokenizer.py rename to NumGI/DatasetTokenizer.py diff --git a/EquationCreator.py b/NumGI/EquationCreator.py similarity index 100% rename from EquationCreator.py rename to NumGI/EquationCreator.py diff --git a/EquationTokenizer.py b/NumGI/EquationTokenizer.py similarity index 99% rename from EquationTokenizer.py rename to NumGI/EquationTokenizer.py index ad75d3e..09b97cb 100644 --- a/EquationTokenizer.py +++ b/NumGI/EquationTokenizer.py @@ -221,6 +221,3 @@ def defaultTokenizer(): dict_size = len(tokenize_dict) return tokenize_dict, decode_dict, tokenize, decode - -def do_something(self): - print("somthing") \ No newline at end of file From 7951d21b3796db30da999d2b05d0f57cf417921b Mon Sep 17 00:00:00 2001 From: James Date: Wed, 6 Sep 2023 13:11:51 -0400 Subject: [PATCH 7/8] include numba dependancy --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 078d08b..631976c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ requires-python = ">=3.8" license = { file = "LICENSE.txt" } authors = [{ name = "Arnaud Bergeron", email = "bergerona62@gmail.com" }] dynamic = ["version"] -dependencies = ["sympy", "torch", "NumGI"] +dependencies = ["sympy", "torch", "NumGI", "Numba"] [project.optional-dependencies] doc = [ From 5fbdeea979823f5be7f36b7c6081f5d867364361 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Sep 2023 17:59:41 +0000 Subject: [PATCH 8/8] Bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/system_test.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/system_test.yml b/.github/workflows/system_test.yml index 16f168e..c396c85 100644 --- a/.github/workflows/system_test.yml +++ b/.github/workflows/system_test.yml @@ -22,7 +22,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9339598..06c4d02 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: