From 51538ad3f6a911b541508d3c7032f6b8daea1cb2 Mon Sep 17 00:00:00 2001 From: maksyuki Date: Wed, 29 Dec 2021 17:56:12 +0800 Subject: [PATCH 1/6] chore: add test code for test publish --- .github/workflows/publish-test.yml | 7 ++++++- setup.py | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-test.yml b/.github/workflows/publish-test.yml index 15c8446..bbe3a12 100644 --- a/.github/workflows/publish-test.yml +++ b/.github/workflows/publish-test.yml @@ -1,6 +1,8 @@ name: publish test package on: + push: + branches: [ main, dev, feature-2d-physics ] release: types: [published] @@ -20,7 +22,10 @@ jobs: python -m pip install --upgrade pip pip install build - name: Build package - run: python -m build + run: | + pwd + ls + python -m build - name: Publish a Python distribution to Test PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: diff --git a/setup.py b/setup.py index c02402d..bed6018 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,10 @@ import os import setuptools +print('this is in [setup] module###############') +os.system('pwd') +os.system('ls') +print('this is in [setup] module end###############') try: os.makedirs('TaichiGAME/packaged-examples') except FileExistsError: From 4e70cbfe6629ae2434cf2edc364d88367ad2482c Mon Sep 17 00:00:00 2001 From: maksyuki Date: Wed, 29 Dec 2021 18:09:35 +0800 Subject: [PATCH 2/6] chore: add statement debug statement --- setup.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index bed6018..c8111b5 100644 --- a/setup.py +++ b/setup.py @@ -4,14 +4,17 @@ print('this is in [setup] module###############') os.system('pwd') os.system('ls') -print('this is in [setup] module end###############') +print('this is in [setup] module###############') try: - os.makedirs('TaichiGAME/packaged-examples') + os.makedirs('./TaichiGAME/packaged-examples') except FileExistsError: pass +os.system('ls ./TaichiGAME/packaged-examples') +os.system("echo 'hello!!!!!!!!!' ") os.system('cp ./examples/testbed.py ./TaichiGAME/packaged-examples/') os.system('cp ./examples/ti_testbed.py ./TaichiGAME/packaged-examples/') +os.system('ls ./TaichiGAME/packaged-examples') with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() From f8cfd9c37e03d60fe16487a80ac6a7a5aa346bb7 Mon Sep 17 00:00:00 2001 From: maksyuki Date: Wed, 29 Dec 2021 18:15:47 +0800 Subject: [PATCH 3/6] chore: add echo code to debug the cp oper --- setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index c8111b5..6dcc1a8 100644 --- a/setup.py +++ b/setup.py @@ -1,15 +1,16 @@ import os import setuptools -print('this is in [setup] module###############') +os.system("echo 'this is in [setup] module###############'") os.system('pwd') os.system('ls') -print('this is in [setup] module###############') +os.system("echo 'this is in [setup] module end###############'") try: os.makedirs('./TaichiGAME/packaged-examples') except FileExistsError: pass +os.system("echo 'start!!!!!!!!!' ") os.system('ls ./TaichiGAME/packaged-examples') os.system("echo 'hello!!!!!!!!!' ") os.system('cp ./examples/testbed.py ./TaichiGAME/packaged-examples/') @@ -56,7 +57,6 @@ keywords=['phyics engine', 'dynamics simulation', 'robot motion control'], packages=setuptools.find_packages(exclude=['examples', 'tests']), include_package_data=True, - package_data={'examples': ['testbed.py']}, install_requires=['taichi'], python_requires=">=3.7,<3.10", ) From 96270b1c54b79c23770ac0effe9732e3f61c59e2 Mon Sep 17 00:00:00 2001 From: maksyuki Date: Wed, 29 Dec 2021 18:41:08 +0800 Subject: [PATCH 4/6] chore: move examples folder to TaichiGAME --- {examples => TaichiGAME/examples}/__init__.py | 0 {examples => TaichiGAME/examples}/flappy-bird/genMP4.zsh | 0 {examples => TaichiGAME/examples}/flappy-bird/main.py | 0 {examples => TaichiGAME/examples}/testbed.py | 0 {examples => TaichiGAME/examples}/ti_testbed.py | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename {examples => TaichiGAME/examples}/__init__.py (100%) rename {examples => TaichiGAME/examples}/flappy-bird/genMP4.zsh (100%) rename {examples => TaichiGAME/examples}/flappy-bird/main.py (100%) rename {examples => TaichiGAME/examples}/testbed.py (100%) rename {examples => TaichiGAME/examples}/ti_testbed.py (100%) diff --git a/examples/__init__.py b/TaichiGAME/examples/__init__.py similarity index 100% rename from examples/__init__.py rename to TaichiGAME/examples/__init__.py diff --git a/examples/flappy-bird/genMP4.zsh b/TaichiGAME/examples/flappy-bird/genMP4.zsh similarity index 100% rename from examples/flappy-bird/genMP4.zsh rename to TaichiGAME/examples/flappy-bird/genMP4.zsh diff --git a/examples/flappy-bird/main.py b/TaichiGAME/examples/flappy-bird/main.py similarity index 100% rename from examples/flappy-bird/main.py rename to TaichiGAME/examples/flappy-bird/main.py diff --git a/examples/testbed.py b/TaichiGAME/examples/testbed.py similarity index 100% rename from examples/testbed.py rename to TaichiGAME/examples/testbed.py diff --git a/examples/ti_testbed.py b/TaichiGAME/examples/ti_testbed.py similarity index 100% rename from examples/ti_testbed.py rename to TaichiGAME/examples/ti_testbed.py From 6acdc6808124f2688ec17a0b4d3630d31e9fd2e9 Mon Sep 17 00:00:00 2001 From: maksyuki Date: Wed, 29 Dec 2021 18:43:31 +0800 Subject: [PATCH 5/6] chore: config the file to match example folder change --- .github/workflows/publish-test.yml | 4 +--- .gitignore | 3 +-- TaichiGAME/main.py | 13 ++++++++++--- setup.py | 19 +------------------ 4 files changed, 13 insertions(+), 26 deletions(-) diff --git a/.github/workflows/publish-test.yml b/.github/workflows/publish-test.yml index bbe3a12..7429a1f 100644 --- a/.github/workflows/publish-test.yml +++ b/.github/workflows/publish-test.yml @@ -22,9 +22,7 @@ jobs: python -m pip install --upgrade pip pip install build - name: Build package - run: | - pwd - ls + run: python -m build - name: Publish a Python distribution to Test PyPI uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.gitignore b/.gitignore index 407583c..4db6992 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,4 @@ __pycache__ .coverage export-res dist -*.egg-info -packaged-examples \ No newline at end of file +*.egg-info \ No newline at end of file diff --git a/TaichiGAME/main.py b/TaichiGAME/main.py index a88f57d..11c1203 100644 --- a/TaichiGAME/main.py +++ b/TaichiGAME/main.py @@ -63,11 +63,10 @@ def _exec_python_file(filename: str): @staticmethod def _get_examples_dir() -> Path: """Get the path to the examples directory.""" - root_dir = '.' root_dir = os.path.join( os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) - examples_dir = Path(root_dir) / 'TaichiGAME/packaged-examples' + examples_dir = Path(root_dir) / 'TaichiGAME/examples' return examples_dir @staticmethod @@ -76,7 +75,15 @@ def _get_available_examples() -> Dict[str, Path]: examples_dir = TaichiGAMEMain._get_examples_dir() all_examples = examples_dir.rglob('*.py') all_example_names = {f.stem: f.parent for f in all_examples} - return all_example_names + + res: Dict[str, Path] = {} + for v in all_example_names: + if v == 'main' or v == '__init__': + continue + + res[v] = all_example_names[v] + + return res @staticmethod def _example_choices_type(choices): diff --git a/setup.py b/setup.py index 6dcc1a8..1404468 100644 --- a/setup.py +++ b/setup.py @@ -1,22 +1,5 @@ -import os import setuptools -os.system("echo 'this is in [setup] module###############'") -os.system('pwd') -os.system('ls') -os.system("echo 'this is in [setup] module end###############'") -try: - os.makedirs('./TaichiGAME/packaged-examples') -except FileExistsError: - pass - -os.system("echo 'start!!!!!!!!!' ") -os.system('ls ./TaichiGAME/packaged-examples') -os.system("echo 'hello!!!!!!!!!' ") -os.system('cp ./examples/testbed.py ./TaichiGAME/packaged-examples/') -os.system('cp ./examples/ti_testbed.py ./TaichiGAME/packaged-examples/') -os.system('ls ./TaichiGAME/packaged-examples') - with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() @@ -55,7 +38,7 @@ ], license='MIT', keywords=['phyics engine', 'dynamics simulation', 'robot motion control'], - packages=setuptools.find_packages(exclude=['examples', 'tests']), + packages=setuptools.find_packages(exclude=['tests']), include_package_data=True, install_requires=['taichi'], python_requires=">=3.7,<3.10", From ed7fecab61205d44c6d8cba6df6142eae9b27670 Mon Sep 17 00:00:00 2001 From: maksyuki Date: Wed, 29 Dec 2021 18:57:04 +0800 Subject: [PATCH 6/6] chore: prepare for the 0.02 release --- .github/workflows/publish-test.yml | 2 -- README.md | 4 ++-- setup.py | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-test.yml b/.github/workflows/publish-test.yml index 7429a1f..19fd48b 100644 --- a/.github/workflows/publish-test.yml +++ b/.github/workflows/publish-test.yml @@ -1,8 +1,6 @@ name: publish test package on: - push: - branches: [ main, dev, feature-2d-physics ] release: types: [published] diff --git a/README.md b/README.md index a8afb9b..b089c44 100644 --- a/README.md +++ b/README.md @@ -101,8 +101,8 @@ Another method is `git clone` this repo, `pip install` dependencies, and then ru $ git clone https://github.com/maksyuki/TaichiGAME.git $ cd TaichiGAME/ $ python3 -m pip install -r requirements.txt -$ cd examples/ # necessary, run testbed.py from other path can trigger module import error -$ python3 testbed.py +$ cd TaichiGAME/ # necessary, run main.py in project root path can trigger module import error +$ python3 main.py example testbed ``` > NOTE: When running code, you maybe notice terminal print some informations like `[Taichi] version 0.8.7, llvm 10.0.0, commit 1c3c705a, osx, python 3.8.8`. I have tested TaichiGAME under `taichi>=0.7`. Your output maybe different from mine, but it doesn't matter. diff --git a/setup.py b/setup.py index 1404468..e307291 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="TaichiGAME", - version="0.0.1", + version="0.0.2", author="maksyuki", author_email="maksyuki@126.com", description="GPU Accelerated Motion Engine based on Taichi Lang",