From 33d688a099d040a6e2e6bb3c1ee9b9e4ab77946f Mon Sep 17 00:00:00 2001 From: Jonathan Hoffstadt Date: Thu, 26 Aug 2021 08:29:00 -0500 Subject: [PATCH] Development setup (#1204) * update setup.py * [skip ci] fix setup * [skip ci] update package_dir * added macos-11 * [skip ci] upgraded setup.py --- .github/workflows/Deployment.yml | 49 +++++-------- .github/workflows/static-analysis.yml | 12 ++++ .gitignore | 2 +- CMakeLists.txt | 3 - DearPyGui/cmake/distribution.cmake | 2 +- DearPyGui/dearpygui/_deprecated.py | 2 - docs/README.md => README.md | 6 +- Scripts/BuildLocalWheelForWindows.bat | 20 ------ setup.py | 100 +++++++++++++++++++------- 9 files changed, 107 insertions(+), 89 deletions(-) rename docs/README.md => README.md (97%) delete mode 100644 Scripts/BuildLocalWheelForWindows.bat diff --git a/.github/workflows/Deployment.yml b/.github/workflows/Deployment.yml index 2b3ba95f9..be08f11e5 100644 --- a/.github/workflows/Deployment.yml +++ b/.github/workflows/Deployment.yml @@ -55,24 +55,19 @@ jobs: git submodule update --init --recursive ./Dependencies/freetype git submodule update --init --recursive ./Dependencies/ImGuiFileDialog - - name: Build Dear PyGui + - name: Mark Versions shell: cmd run: | cd %GITHUB_WORKSPACE% - mkdir cmake-build-release - cd cmake-build-Release - cmake .. -G "Visual Studio 16 2019" -A "x64" -DMVDIST_ONLY=True -DMVDPG_VERSION=${{ github.event.inputs.version }} - cd .. - cmake --build cmake-build-release --config Release + echo ${{ github.event.inputs.version }} > version_number.txt + echo cmake-build-local/DearPyGui/Release/_dearpygui.pyd > lib_location.txt - name: Build Wheel shell: cmd run: | cd %GITHUB_WORKSPACE% - echo ${{ github.event.inputs.version }} > version_number.txt - echo cmake-build-release/DearPyGui/Release/_dearpygui.pyd > lib_location.txt python -m pip install --upgrade pip twine wheel - python -m setup bdist_wheel --plat-name win_amd64 --dist-dir dist + python -m setup bdist_wheel --dist-dir dist - name: Upload Windows ${{ matrix.python-version }} Wheel uses: actions/upload-artifact@v2 @@ -81,9 +76,9 @@ jobs: path: ${{ github.workspace }}/dist/*.whl retention-days: 2 - build-mac-wheels: + build-mac10-wheels: - runs-on: MacOS-latest + runs-on: macos-10.15 strategy: matrix: python-version: [ 3.6, 3.7, 3.8, 3.9 ] @@ -105,27 +100,22 @@ jobs: git submodule update --init --recursive ./Dependencies/ImGuiFileDialog git submodule update --init --recursive ./Dependencies/glfw - - name: Build Dear PyGui + - name: Mark Versions run: | cd $GITHUB_WORKSPACE - mkdir cmake-build-release - cd cmake-build-release - cmake .. -DMVDIST_ONLY=True -DMVDPG_VERSION=${{ github.event.inputs.version }} - cd .. - cmake --build cmake-build-release --config Release + echo ${{ github.event.inputs.version }} > version_number.txt + echo cmake-build-local/DearPyGui/_dearpygui.so > lib_location.txt - name: Build Wheel run: | cd $GITHUB_WORKSPACE - echo ${{ github.event.inputs.version }} > version_number.txt - echo cmake-build-release/DearPyGui/_dearpygui.so > lib_location.txt python -m pip install --upgrade pip twine wheel python -m setup bdist_wheel --plat-name macosx-10.6-x86_64 --dist-dir dist - - name: Upload MacOS ${{ matrix.python-version }} Wheel + - name: Upload MacOS 10.15 ${{ matrix.python-version }} Wheel uses: actions/upload-artifact@v2 with: - name: applebuild${{ matrix.python-version }} + name: apple10build${{ matrix.python-version }} path: ${{ github.workspace }}/dist/*.whl retention-days: 2 @@ -157,20 +147,15 @@ jobs: sudo apt-get install libfreetype6-dev -y sudo apt-get install libharfbuzz-dev -y - - name: Build + - name: Mark Versions run: | cd $GITHUB_WORKSPACE - mkdir cmake-build-release - cd cmake-build-release - cmake .. -DMVDIST_ONLY=True -DMVDPG_VERSION=${{ github.event.inputs.version }} - cd .. - cmake --build cmake-build-release --config Release + echo ${{ github.event.inputs.version }} > version_number.txt + echo cmake-build-local/DearPyGui/_dearpygui.so > lib_location.txt - name: Build Wheel run: | cd $GITHUB_WORKSPACE - echo ${{ github.event.inputs.version }} > version_number.txt - echo cmake-build-release/DearPyGui/_dearpygui.so > lib_location.txt python -m pip install --upgrade pip twine wheel python -m setup bdist_wheel --plat-name manylinux1_x86_64 --dist-dir dist @@ -183,7 +168,7 @@ jobs: deploy-packages: - needs: [build-windows-wheels, build-mac-wheels, build-linux-wheels] + needs: [build-windows-wheels, build-mac10-wheels, build-linux-wheels] runs-on: windows-2019 steps: @@ -208,7 +193,7 @@ jobs: if: ${{contains(github.event.inputs.deploy, 'true') && github.ref == 'refs/heads/master'}} run: | python -m twine upload windowsbuild*/* -u __token__ -p ${{ secrets.PYPI_PASSWORD }} --skip-existing - python -m twine upload applebuild*/* -u __token__ -p ${{ secrets.PYPI_PASSWORD }} --skip-existing + python -m twine upload apple10build*/* -u __token__ -p ${{ secrets.PYPI_PASSWORD }} --skip-existing python -m twine upload linuxbuild*/* -u __token__ -p ${{ secrets.PYPI_PASSWORD }} --skip-existing - name: Test PyPi Deployment @@ -217,5 +202,5 @@ jobs: run: | dir python -m twine upload --repository testpypi windowsbuild*/* -u __token__ -p ${{ secrets.TEST_PYPI_PASSWORD }} --skip-existing - python -m twine upload --repository testpypi applebuild*/* -u __token__ -p ${{ secrets.TEST_PYPI_PASSWORD }} --skip-existing + python -m twine upload --repository testpypi apple10build*/* -u __token__ -p ${{ secrets.TEST_PYPI_PASSWORD }} --skip-existing python -m twine upload --repository testpypi linuxbuild*/* -u __token__ -p ${{ secrets.TEST_PYPI_PASSWORD }} --skip-existing \ No newline at end of file diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 26656f744..534e1bd2a 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -2,6 +2,18 @@ name: Static Analysis on: push: + + branches: + - master + - development + - development_* + + paths-ignore: + - 'docs/**' + - 'Resources/**' + - 'Scripts/**' + - 'Tools/**' + pull_request: workflow_dispatch: diff --git a/.gitignore b/.gitignore index 80051d84b..1215af532 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ out/ cmake-build-debug/ cmake-build-release/ cmake-build-local/ -Output/ +output/ dist/ .DS_Store __pycache__/ diff --git a/CMakeLists.txt b/CMakeLists.txt index e63539bba..3b172f3e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,9 +41,6 @@ if(MV_TESTS_ONLY) add_definitions(-DMV_TESTS_ONLY) endif() -# version number of Dear PyGui, usually set -set(MVDPG_VERSION ${MVDPG_VERSION}) - add_subdirectory("Dependencies") # if this is not a distribution build diff --git a/DearPyGui/cmake/distribution.cmake b/DearPyGui/cmake/distribution.cmake index 8eb175da7..b57f29ee8 100644 --- a/DearPyGui/cmake/distribution.cmake +++ b/DearPyGui/cmake/distribution.cmake @@ -11,8 +11,8 @@ target_sources(_dearpygui PRIVATE ${MARVEL_SOURCES}) target_include_directories(_dearpygui PRIVATE - ${MARVEL_INCLUDE_DIR} ${Python_INCLUDE_DIRS} + ${MARVEL_INCLUDE_DIR} ) target_link_directories(_dearpygui diff --git a/DearPyGui/dearpygui/_deprecated.py b/DearPyGui/dearpygui/_deprecated.py index 9c5fc6d66..abbd57091 100644 --- a/DearPyGui/dearpygui/_deprecated.py +++ b/DearPyGui/dearpygui/_deprecated.py @@ -42,12 +42,10 @@ def new_func2(*args, **kwargs): return new_func2 - @deprecated("Use 'configure_app(docking=True, docking_space=dock_space)'.") def enable_docking(dock_space: bool = False) -> None: internal_dpg.configure_app(docking=True, docking_space=dock_space) - @deprecated("Use 'get_app_configuration()['version']'.") def get_dearpygui_version() -> str: return internal_dpg.get_app_configuration()["version"] diff --git a/docs/README.md b/README.md similarity index 97% rename from docs/README.md rename to README.md index 38ad40acd..7db167d6a 100644 --- a/docs/README.md +++ b/README.md @@ -6,7 +6,7 @@ -
(This library is available under a free and permissive license however, if you Enjoy Dear PyGui please consider becoming a Sponsor)
+
(This library is available under a free and permissive license however, if you enjoy using Dear PyGui please consider becoming a Sponsor)
![Python Version](https://img.shields.io/pypi/pyversions/dearpygui) [![PYPI](https://img.shields.io/pypi/v/dearpygui)](https://pypi.org/project/dearpygui/) @@ -25,10 +25,10 @@ uses the immediate mode paradigm and your computer's GPU to facilitate extremely dynamic interfaces. _Dear PyGui_ is currently supported on the following platforms: -| Platform | Rendering API | Newest Version | +| Platform | Graphics API | Newest Version | |----------|---------------|----------------| | **Windows 10** | _DirectX 11_ | [![PYPI](https://img.shields.io/pypi/v/dearpygui)](https://pypi.org/project/dearpygui/) | -| **macOs** | _Metal_ | [![PYPI](https://img.shields.io/pypi/v/dearpygui)](https://pypi.org/project/dearpygui/) | +| **macOS** | _Metal_ | [![PYPI](https://img.shields.io/pypi/v/dearpygui)](https://pypi.org/project/dearpygui/) | | **Linux** | _OpenGL 3_ | [![PYPI](https://img.shields.io/pypi/v/dearpygui)](https://pypi.org/project/dearpygui/) | | **Raspberry Pi 4** | _OpenGL ES_ | [![PYPI](https://img.shields.io/badge/pypi-v0.8.64-orange)](https://img.shields.io/badge/pypi-v0.8.64-orange) | diff --git a/Scripts/BuildLocalWheelForWindows.bat b/Scripts/BuildLocalWheelForWindows.bat deleted file mode 100644 index 67c2c3913..000000000 --- a/Scripts/BuildLocalWheelForWindows.bat +++ /dev/null @@ -1,20 +0,0 @@ -@echo off - -set dir=%~dp0 -set ver=0.8.0 - -echo Building Dear PyGui -cd .. -mkdir cmake-build-local -cd cmake-build-local -cmake .. -G "Visual Studio 16 2019" -A "x64" -DMVDIST_ONLY=True -DMVDPG_VERSION=%ver% -cd .. -cmake --build cmake-build-local --config Release - -echo Building Wheel -echo %ver% > version_number.txt -echo cmake-build-local/DearPyGui/Release/_dearpygui.pyd > lib_location.txt -python -m pip install --upgrade pip twine wheel -python -m setup bdist_wheel --plat-name win_amd64 --dist-dir dist - -pause \ No newline at end of file diff --git a/setup.py b/setup.py index d8d102699..549231b65 100644 --- a/setup.py +++ b/setup.py @@ -9,6 +9,8 @@ import shutil import subprocess +wip_version = "1.0.0a1" + ######################################################################################################################## # These functions read the version number and library location which is populated by # github actions or the local build scripts. @@ -17,28 +19,32 @@ def version_number(): if os.environ.get('READTHEDOCS') == 'True': - return "latest" + return wip_version try: with open('version_number.txt', encoding='utf-8') as f: return f.readline().rstrip() except IOError: - return 'latest' + return wip_version def lib_location(): if os.environ.get('READTHEDOCS') == 'True': - return 'cmake-build-release/DearPyGui/_dearpygui.so' + return 'cmake-build-local/DearPyGui/_dearpygui.so' try: with open('lib_location.txt', encoding='utf-8') as f: return f.readline().rstrip() except IOError: - return 'cmake-build-release/DearPyGui/_dearpygui.so' + if get_platform() == "Windows": + return 'cmake-build-local/DearPyGui/Release/_dearpygui.pyd' + else: + return 'cmake-build-local/DearPyGui/Release/_dearpygui.so' def get_platform(): platforms = { + 'linux' : 'Linux', 'linux1' : 'Linux', 'linux2' : 'Linux', 'darwin' : 'OS X', @@ -68,10 +74,41 @@ def finalize_options(self): def run(self): """Run command.""" - #command = ['/usr/bin/pylint'] - #self.announce('Running command: %s' % str(command),level=distutils.log.INFO) - #subprocess.check_call(command) - print(get_platform()) + + if get_platform() == "Windows": + command = [r'set PATH="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin";"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin";"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin";%PATH% && '] + command.append("mkdir cmake-build-local && ") + command.append("cd cmake-build-local && ") + command.append('cmake .. -G "Visual Studio 16 2019" -A "x64" -DMVDIST_ONLY=True -DMVDPG_VERSION=') + command.append(version_number() + " && ") + command.append("cd .. && cmake --build cmake-build-local --config Release") + self.announce('Running command: %s' % "Dear PyGui Build for Windows", level=distutils.log.INFO) + subprocess.check_call(''.join(command), env=os.environ, shell=True) + src_path = os.path.dirname(os.path.abspath(__file__)) + shutil.copy(lib_location(), src_path +"/output/dearpygui") + + elif get_platform() == "Linux": + command = ["mkdir cmake-build-local; "] + command.append("cd cmake-build-local; ") + command.append('cmake .. -DMVDIST_ONLY=True -DMVDPG_VERSION='+version_number()+"; ") + command.append("cd ..; cmake --build cmake-build-local --config Release") + self.announce('Running command: %s' % "Dear PyGui Build for Linux",level=distutils.log.INFO) + subprocess.check_call(''.join(command), shell=True) + src_path = os.path.dirname(os.path.abspath(__file__)) + shutil.copy(lib_location(), src_path +"/output/dearpygui") + + elif get_platform() == "OS X": + command = ["mkdir cmake-build-local; "] + command.append("cd cmake-build-local; ") + command.append('cmake .. -DMVDIST_ONLY=True -DMVDPG_VERSION='+version_number()+"; ") + command.append("cd ..; cmake --build cmake-build-local --config Release") + self.announce('Running command: %s' % "Dear PyGui Build for OS X",level=distutils.log.INFO) + subprocess.check_call(''.join(command), shell=True) + src_path = os.path.dirname(os.path.abspath(__file__)) + shutil.copy(lib_location(), src_path +"/output/dearpygui") + + else: + self.announce('Command not ready.',level=distutils.log.INFO) class BuildPyCommand(build_py.build_py): """Custom build command.""" @@ -191,26 +228,29 @@ def setup_package(): sys.path.insert(0, src_path) # import readme content - with open("./docs/README.md", encoding='utf-8') as f: + with open("./README.md", encoding='utf-8') as f: long_description = f.read() # create the necessary directories if they do not exist - if not os.path.isdir(src_path + "/dearpygui/"): - os.mkdir(src_path + "/dearpygui/") + if os.path.isdir(src_path + "/output"): + shutil.rmtree(src_path + "/output") + os.mkdir(src_path + "/output") + os.mkdir(src_path + "/output/dearpygui") + + if os.path.isdir(src_path + "/cmake-build-local"): + shutil.rmtree(src_path + "/cmake-build-local") # copy add items to temporary location - shutil.copy(src_path + "/DearPyGui/dearpygui/dearpygui.py", src_path + "/dearpygui") - shutil.copy(src_path + "/DearPyGui/dearpygui/demo.py", src_path + "/dearpygui") - shutil.copy(src_path + "/DearPyGui/dearpygui/experimental.py", src_path + "/dearpygui") + shutil.copy(src_path + "/DearPyGui/dearpygui/dearpygui.py", src_path + "/output/dearpygui") + shutil.copy(src_path + "/DearPyGui/dearpygui/demo.py", src_path + "/output/dearpygui") + shutil.copy(src_path + "/DearPyGui/dearpygui/experimental.py", src_path + "/output/dearpygui") - with open(src_path + "/dearpygui/__init__.py", 'w') as file: - file.write("__version__='") - file.write(version_number()) - file.write("'\n") + with open(src_path + "/output/dearpygui/__init__.py", 'w') as file: + file.write("__version__='" + version_number() + "'\n") if os.environ.get('READTHEDOCS') == 'True': - with open(src_path + "/dearpygui/_dearpygui.py", 'w') as newfile: + with open(src_path + "/output/dearpygui/_dearpygui.py", 'w') as newfile: with open(src_path + "/DearPyGui/dearpygui/_dearpygui.pyi", 'r') as file: lines = file.readlines() for line in lines: @@ -224,9 +264,9 @@ def setup_package(): else: # copy add items to temporary location - shutil.copy(lib_location(), src_path +"/dearpygui") - shutil.copy(src_path + "/DearPyGui/dearpygui/_dearpygui.pyi", src_path + "/dearpygui") - shutil.copy(src_path + "/Dependencies/Microsoft/vcruntime140_1.dll", src_path + "/dearpygui") + shutil.copy(src_path + "/DearPyGui/dearpygui/_dearpygui.pyi", src_path + "/output/dearpygui") + if get_platform() == "Windows": + shutil.copy(src_path + "/Dependencies/Microsoft/vcruntime140_1.dll", src_path + "/output/dearpygui") metadata = dict( name='dearpygui', # Required @@ -245,17 +285,21 @@ def setup_package(): 'Intended Audience :: Developers', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License', - 'Operating System :: MacOS :: MacOS X', + 'Operating System :: MacOS', 'Operating System :: Microsoft :: Windows :: Windows 10', - 'Operating System :: POSIX :: Linux', + 'Operating System :: POSIX', + 'Operating System :: Unix', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: Implementation :: CPython', + 'Programming Language :: Python :: 3 :: Only', 'Topic :: Software Development :: User Interfaces', 'Topic :: Software Development :: Libraries :: Python Modules', ], - packages=find_packages(exclude=['contrib', 'docs', 'tests']), # Required + packages=['dearpygui'], + package_dir = {'': 'output'}, package_data={}, distclass=BinaryDistribution, cmdclass={ @@ -265,9 +309,11 @@ def setup_package(): ) if os.environ.get('READTHEDOCS') == 'True': - metadata['package_data']['dearpygui'] = ["_dearpygui.py", "dearpygui.py", "demo.py", "experimental.py"] + metadata['package_data']['dearpygui'] = ["__init__.py", "_dearpygui.py", "dearpygui.py", "demo.py", "experimental.py"] + elif get_platform() == "Windows": + metadata['package_data']['dearpygui'] = ["__init__.py", "_dearpygui.so", "_dearpygui.pyd", "_dearpygui.pyi", "dearpygui.py", "demo.py", "experimental.py", "vcruntime140_1.dll"] else: - metadata['package_data']['dearpygui'] = ["_dearpygui.so", "_dearpygui.pyd", "_dearpygui.pyi", "dearpygui.py", "demo.py", "experimental.py", "vcruntime140_1.dll"] + metadata['package_data']['dearpygui'] = ["__init__.py", "_dearpygui.so", "_dearpygui.pyd", "_dearpygui.pyi", "dearpygui.py", "demo.py", "experimental.py"] if "--force" in sys.argv: run_build = True