From c49b6b9833ac8c6beb71f19628f24640cc43ad61 Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 11 Aug 2022 18:10:06 +0200 Subject: [PATCH 1/3] work on new pip install --- .github/workflows/build.yml | 253 +++++++++++---------- .github/workflows/build_pip.sh | 44 ++++ .github/workflows/fix_auditwheel_policy.py | 41 ++++ DockerfileML | 5 + setup.py | 35 ++- test/tents.py | 16 +- 6 files changed, 259 insertions(+), 135 deletions(-) create mode 100644 .github/workflows/build_pip.sh create mode 100644 .github/workflows/fix_auditwheel_policy.py create mode 100644 DockerfileML diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index db812eaf..1ef779f5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -91,49 +91,68 @@ jobs: #if: ${{ failure() }} #uses: mxschmitt/action-tmate@v3 - pypi-test: + pypi: needs: [ubuntu] runs-on: ubuntu-latest + container: + image: quay.io/pypa/manylinux2014_x86_64:latest steps: - - name: install pkgs - run: | - sudo apt-get update && DEBIAN_FRONTEND="noninteractive" sudo apt-get -y install vim python3 python3-pip python3-distutils python3-tk libpython3-dev libxmu-dev tk-dev tcl-dev cmake git g++ libglu1-mesa-dev libblas-dev liblapack-dev - sudo apt-get install -y software-properties-common - sudo add-apt-repository universe - sudo add-apt-repository ppa:ngsolve/nightly -y - sudo apt-get install ngsolve -y - - name: set path - run: | - echo "PYTHONPATH=/usr/lib/python3/dist-packages/" >> $GITHUB_ENV - echo "NETGENDIR=/usr/bin/" >> $GITHUB_ENV - uses: actions/checkout@v2 with: submodules: 'True' - - name: Update pip and Install setuptools - run: | - python3 -m pip install --upgrade pip - python3 -m pip install setuptools - - name: Package ngstrefftz sources for PyPI - run: python3 setup.py sdist - - name: pip install ngstrefftz - run: pip install dist/* + path: 'NGSTrefftz' + fetch-depth: 0 # otherwise, you will failed to push refs to dest repo + - name: build pip + run: cd NGSTrefftz/.github/workflows && sh build_pip.sh + - name: Publish source distribution to PyPI + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{ secrets.PYPI_API_TOKEN }} + packages_dir: NGSTrefftz/wheelhouse/ + repository_url: https://test.pypi.org/legacy/ + + #pypi-test: + #needs: [ubuntu] + #runs-on: ubuntu-latest + #steps: + #- name: install pkgs + #run: | + #sudo apt-get update && DEBIAN_FRONTEND="noninteractive" sudo apt-get -y install vim python3 python3-pip python3-distutils python3-tk libpython3-dev libxmu-dev tk-dev tcl-dev cmake git g++ libglu1-mesa-dev libblas-dev liblapack-dev + #pip install ngsolve + #- uses: actions/checkout@v2 + #with: + #submodules: 'True' + #- name: Update pip and Install setuptools + #run: | + #python3 -m pip install --upgrade pip + #python3 -m pip install setuptools + #- name: Package ngstrefftz sources for PyPI + #run: python3 setup.py sdist + #- name: pip install ngstrefftz + #run: pip install dist/* - pypi-publish: - needs: [pypi-test] + pypi-src: + needs: [ubuntu] runs-on: ubuntu-latest - if: github.event_name == 'release' && github.event.action == 'created' #startsWith(github.ref, 'refs/tags/v') # && github.event_name == 'push' steps: - uses: actions/checkout@v2 with: submodules: 'True' + - name: install pkgs + run: | + sudo apt-get update && DEBIAN_FRONTEND="noninteractive" sudo apt-get -y install vim python3 python3-pip python3-distutils python3-tk libpython3-dev libxmu-dev tk-dev tcl-dev cmake git g++ libglu1-mesa-dev libblas-dev liblapack-dev + pip install ngsolve - name: Update pip and Install setuptools run: | python3 -m pip install --upgrade pip python3 -m pip install setuptools - name: Package ngstrefftz sources for PyPI run: python3 setup.py sdist + - name: pip install ngstrefftz + run: pip install dist/* - name: Publish source distribution to PyPI uses: pypa/gh-action-pypi-publish@master + if: github.event_name == 'release' && github.event.action == 'created' #startsWith(github.ref, 'refs/tags/v') # && github.event_name == 'push' with: skip_existing: true user: __token__ @@ -174,98 +193,98 @@ jobs: tags: ${{ steps.meta.outputs.tags }} #labels: ${{ steps.meta.outputs.labels }} - docs: - needs: [ubuntu] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - with: - fetch-depth: 0 # otherwise, you will failed to push refs to dest repo - submodules: 'True' - path: 'NGSTrefftz' - - name: install pkgs - run: | - sudo apt-get update && DEBIAN_FRONTEND="noninteractive" sudo apt-get -y install vim libxmu-dev tk-dev tcl-dev cmake git g++ libglu1-mesa-dev libblas-dev liblapack-dev python3 python3-pip python3-distutils python3-tk libpython3-dev - sudo apt-get install -y software-properties-common - sudo add-apt-repository universe - sudo add-apt-repository ppa:ngsolve/nightly -y - sudo apt-get install ngsolve -y - sudo apt-get install npm nodejs pandoc -y - - name: pip pkgs - run: python3 -m pip list - - name: set path - run: | - echo "NETGENDIR=/usr/bin/" >> $GITHUB_ENV - - run: pip install --user -r $GITHUB_WORKSPACE/NGSTrefftz/docs/requirements.txt - - name: webgui - run: | - jupyter nbextension install --user --py widgetsnbextension - jupyter nbextension enable --user --py widgetsnbextension - jupyter nbextension install --user --py webgui_jupyter_widgets - jupyter nbextension enable --user --py webgui_jupyter_widgets - - run: python3 -c "import sys; print(sys.path)" - - name: cmake NGSTrefftz - run: | - cmake -B $GITHUB_WORKSPACE/NGSTrefftz/make -S $GITHUB_WORKSPACE/NGSTrefftz/src/ - make -C $GITHUB_WORKSPACE/NGSTrefftz/make - sudo make -C $GITHUB_WORKSPACE/NGSTrefftz/make install - python3 -c "import sys; print(sys.path)" - python3 -c "import ngstrefftz" - #ln -s /usr/lib/python3/dist-packages/ngsolve /opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/ - #ln -s /usr/lib/python3/dist-packages/ngstrefftz /opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/ - #ln -s /usr/lib/python3/dist-packages/ngstents /opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/ - - name: jupyter stuff - run: | - pip install jupyter_contrib_nbextensions - #pip install jupyter_nbextensions_configurator - jupyter contrib nbextension install --user - jupyter nbextension install --user --py widgetsnbextension - jupyter nbextension enable --user --py widgetsnbextension - - name: build tentswebgui - run: | - cd $GITHUB_WORKSPACE/NGSTrefftz/external_dependencies/ngstents/tentswebgui/ && bash build.sh - - name: install tentswebgui - run: | - cd $GITHUB_WORKSPACE/NGSTrefftz/external_dependencies/ngstents/tentswebgui/ && pip install --user . - - name: jupyter tentswebgui - run: | - jupyter nbextension install --user --py tentswebgui - jupyter nbextension enable --user --py tentswebgui - - name: Build and Commit - uses: sphinx-notes/pages@v2 - with: - repository_path: 'NGSTrefftz' - #requirements_path: ./docs/requirements.txt - - name: Push changes - uses: ad-m/github-push-action@master - if: github.event_name == 'release' && github.event.action == 'created' - with: - directory: 'NGSTrefftz' - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: gh-pages - - run: tree -d . - - name: Upload - uses: actions/upload-artifact@v1 - with: - name: gh-page - path: 'NGSTrefftz/' - - name: Debugging - if: ${{ failure() }} - run: cat /tmp/sphinx* + #docs: + #needs: [ubuntu] + #runs-on: ubuntu-latest + #steps: + #- uses: actions/checkout@master + #with: + #fetch-depth: 0 # otherwise, you will failed to push refs to dest repo + #submodules: 'True' + #path: 'NGSTrefftz' + #- name: install pkgs + #run: | + #sudo apt-get update && DEBIAN_FRONTEND="noninteractive" sudo apt-get -y install vim libxmu-dev tk-dev tcl-dev cmake git g++ libglu1-mesa-dev libblas-dev liblapack-dev python3 python3-pip python3-distutils python3-tk libpython3-dev + #sudo apt-get install -y software-properties-common + #sudo add-apt-repository universe + #sudo add-apt-repository ppa:ngsolve/nightly -y + #sudo apt-get install ngsolve -y + #sudo apt-get install npm nodejs pandoc -y + #- name: pip pkgs + #run: python3 -m pip list + #- name: set path + #run: | + #echo "NETGENDIR=/usr/bin/" >> $GITHUB_ENV + #- run: pip install --user -r $GITHUB_WORKSPACE/NGSTrefftz/docs/requirements.txt + #- name: webgui + #run: | + #jupyter nbextension install --user --py widgetsnbextension + #jupyter nbextension enable --user --py widgetsnbextension + #jupyter nbextension install --user --py webgui_jupyter_widgets + #jupyter nbextension enable --user --py webgui_jupyter_widgets + #- run: python3 -c "import sys; print(sys.path)" + #- name: cmake NGSTrefftz + #run: | + #cmake -B $GITHUB_WORKSPACE/NGSTrefftz/make -S $GITHUB_WORKSPACE/NGSTrefftz/src/ + #make -C $GITHUB_WORKSPACE/NGSTrefftz/make + #sudo make -C $GITHUB_WORKSPACE/NGSTrefftz/make install + #python3 -c "import sys; print(sys.path)" + #python3 -c "import ngstrefftz" + ##ln -s /usr/lib/python3/dist-packages/ngsolve /opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/ + ##ln -s /usr/lib/python3/dist-packages/ngstrefftz /opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/ + ##ln -s /usr/lib/python3/dist-packages/ngstents /opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/ + #- name: jupyter stuff + #run: | + #pip install jupyter_contrib_nbextensions + ##pip install jupyter_nbextensions_configurator + #jupyter contrib nbextension install --user + #jupyter nbextension install --user --py widgetsnbextension + #jupyter nbextension enable --user --py widgetsnbextension + #- name: build tentswebgui + #run: | + #cd $GITHUB_WORKSPACE/NGSTrefftz/external_dependencies/ngstents/tentswebgui/ && bash build.sh + #- name: install tentswebgui + #run: | + #cd $GITHUB_WORKSPACE/NGSTrefftz/external_dependencies/ngstents/tentswebgui/ && pip install --user . + #- name: jupyter tentswebgui + #run: | + #jupyter nbextension install --user --py tentswebgui + #jupyter nbextension enable --user --py tentswebgui + #- name: Build and Commit + #uses: sphinx-notes/pages@v2 + #with: + #repository_path: 'NGSTrefftz' + ##requirements_path: ./docs/requirements.txt + #- name: Push changes + #uses: ad-m/github-push-action@master + #if: github.event_name == 'release' && github.event.action == 'created' + #with: + #directory: 'NGSTrefftz' + #github_token: ${{ secrets.GITHUB_TOKEN }} + #branch: gh-pages + #- run: tree -d . + #- name: Upload + #uses: actions/upload-artifact@v1 + #with: + #name: gh-page + #path: 'NGSTrefftz/' + #- name: Debugging + #if: ${{ failure() }} + #run: cat /tmp/sphinx* - paper: - runs-on: ubuntu-latest - name: Paper Draft - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Build draft PDF - uses: openjournals/openjournals-draft-action@master - with: - journal: joss - paper-path: docs/paper/paper.md - - name: Upload - uses: actions/upload-artifact@v1 - with: - name: joss_paper - path: docs/paper/paper.pdf + #paper: + #runs-on: ubuntu-latest + #name: Paper Draft + #steps: + #- name: Checkout + #uses: actions/checkout@v2 + #- name: Build draft PDF + #uses: openjournals/openjournals-draft-action@master + #with: + #journal: joss + #paper-path: docs/paper/paper.md + #- name: Upload + #uses: actions/upload-artifact@v1 + #with: + #name: joss_paper + #path: docs/paper/paper.pdf diff --git a/.github/workflows/build_pip.sh b/.github/workflows/build_pip.sh new file mode 100644 index 00000000..763ca032 --- /dev/null +++ b/.github/workflows/build_pip.sh @@ -0,0 +1,44 @@ +#! /bin/bash +set -e +yum -y update +yum -y install ninja-build fontconfig-devel tk-devel tcl-devel libXmu-devel mesa-libGLU-devel ccache + +py=/opt/python/cp39-cp39/bin/python +$py fix_auditwheel_policy.py +cd ../.. + +git config --global --add safe.directory '*' + +export ORIGINAL_PATH="$PATH" + +for pyversion in 38 39 310 +do + export PYDIR="/opt/python/cp${pyversion}-cp${pyversion}/bin" + export PATH="$ORIGINAL_PATH:$PYDIR" + echo $PYDIR + #$PYDIR/pip install -U pytest-check numpy wheel scikit-build mkl==2021.* mkl-devel==2021.* + #$PYDIR/pip install netgen-mesher + #NETGENDIR=/opt/_internal/cpython-3.9.13/bin + + #rm -rf /home/app/ngstrefftz/make + rm -rf _skbuild + pip install ngsolve + + pip wheel -vvv . + auditwheel repair ngstrefftz*.whl + rm -rf *.whl + pip uninstall -y ngsolve + $PYDIR/pip uninstall -y netgen-mesher + + # avx2 build: + rm -rf _skbuild + $PYDIR/pip install ngsolve-avx2 + NETGEN_ARCH=avx2 $PYDIR/pip wheel -vvv . + auditwheel repair ngstrefftz*.whl + rm -rf *.whl + $PYDIR/pip uninstall -y ngsolve-avx2 + $PYDIR/pip uninstall -y netgen-mesher-avx2 +done + +pip install -U twine +#$PYDIR/twine upload wheelhouse/*manylinux*.whl diff --git a/.github/workflows/fix_auditwheel_policy.py b/.github/workflows/fix_auditwheel_policy.py new file mode 100644 index 00000000..b96ac297 --- /dev/null +++ b/.github/workflows/fix_auditwheel_policy.py @@ -0,0 +1,41 @@ +import json + +policy_file = "/opt/_internal/pipx/venvs/auditwheel/lib/python3.9/site-packages/auditwheel/policy/manylinux-policy.json" +data = json.load(open(policy_file)) +# todo: read libs from netgen.libs directory and remove hashes from names, then add just libmkl_rt.so.1 +additional_libs = [ + "libGLU.so.1", + "libGLX.so.0", + "libGLdispatch.so.0", + "libOpenGL.so.0", + "libXmu.so.6", + "libbz2.so.1.0.6", + "libcsg.so", + "libcsgvis.so", + "libfontconfig.so.1.11.1", + "libfreetype.so.6.14.0", + "libgeom2d.so", + "libgeom2dvis.so", + "libgui.so", + "libinterface.so", + "libmesh.so", + "libmkl_rt.so.1", + "libngcore.so", + "libnggui.so", + "libnglib.so", + "libocc.so", + "libpng15.so.15.13.0", + "libstl.so", + "libstlvis.so", + "libtcl8.so", + "libtk8.so", + "libuuid.so.1.3.0", + "libvisual.so", + "libz.so.1.2.7", + ] + +for entry in data: + if 'manylinux' in entry['name']: + entry['lib_whitelist'] += additional_libs + +json.dump(data, open(policy_file, 'w')) diff --git a/DockerfileML b/DockerfileML new file mode 100644 index 00000000..4f756481 --- /dev/null +++ b/DockerfileML @@ -0,0 +1,5 @@ +FROM quay.io/pypa/manylinux2014_x86_64 +USER root +COPY . /home/app/ngstrefftz +WORKDIR /home/app/ngstrefftz +#RUN chmod +x build_pip.sh && ./build_pip.sh diff --git a/setup.py b/setup.py index 070da278..2057a260 100644 --- a/setup.py +++ b/setup.py @@ -15,6 +15,7 @@ import os import re import subprocess + def get_version(): """ Gets the current version number. @@ -93,6 +94,11 @@ def build_extension(self, ext): cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir, '-DPYTHON_EXECUTABLE=' + sys.executable, '-DCMAKE_CXX_COMPILER=ngscxx'] + if 'PYDIR' in os.environ: + cmake_args += [f'-DCMAKE_PREFIX_PATH={os.environ["PYDIR"]}/..'] + cmake_args += [f'-DPYTHON_EXECUTABLE={os.environ["PYDIR"]}/python3'] + cmake_args += [f'-DPYTHON_LIBRARY={os.environ["PYDIR"]}/../lib'] + cmake_args += [f'-DPYTHON_INCLUDE_DIR={os.environ["PYDIR"]}/../include'] cfg = 'Debug' if self.debug else 'Release' build_args = ['--config', cfg] cmake_args += ['-DCMAKE_BUILD_TYPE=' + cfg] @@ -110,26 +116,35 @@ def build_extension(self, ext): # subprocess.check_call(['mkdir', 'ngstents'], cwd=self.build_lib) # subprocess.check_call(['mv', '_pytents.so', 'ngstents'], cwd=self.build_lib) +import netgen.version +import ngsolve +netgen_name = netgen.config.NETGEN_PYTHON_PACKAGE_NAME +avx2 = netgen_name.replace('netgen-mesher', '') # keep -avx2 suffix +name = 'ngstrefftz' + avx2 +install_requires = [ 'ngsolve'+avx2+'>='+ngsolve.__version__ ] + +if sys.argv[1] == "sdist": + package_data= {"ngstrefftz": ["*" + ,"../test/*" + ,"../external_dependencies/ngstents/*"\ + ,"../external_dependencies/ngstents/src/*"\ + ,"../external_dependencies/ngstents/py/*"\ + ]} + name += "-src" + setup( - name='ngstrefftz', + name=name, version=str(get_version()), author='Paul Stocker', author_email='p.stocker@math.uni-goettingen.de', description='NGSTrefftz is an add-on to NGSolve for Trefftz methods.', long_description='NGSTrefftz provides a framework to implement Trefftz finite element spaces for NGSolve, with several Trefftz spaces already implemented. Additionally, Trefftz-DG on tent-pitched meshes for the acoustic wave equation is implemented using meshes provided by ngstents. Furthermore, the package includes an implementation of the embedded Trefftz method.', url="https://github.com/PaulSt/ngstrefftz", + install_requires=install_requires, ext_modules=[CMakeExtension('ngstrefftz_py','src')], cmdclass=dict(build_ext=CMakeBuild), packages=["ngstrefftz"], package_dir={"ngstrefftz": "src"}, - package_data={"ngstrefftz": ["*" - ,"../test/*" - ,"../external_dependencies/ngstents/*"\ - ,"../external_dependencies/ngstents/src/*"\ - ,"../external_dependencies/ngstents/py/*"\ - ]}, python_requires='>=3.5', - # install_requires=[ - # 'NGSolve>=6.2', - # ] + package_data=package_data, ) diff --git a/test/tents.py b/test/tents.py index 714168c9..25146582 100644 --- a/test/tents.py +++ b/test/tents.py @@ -16,7 +16,7 @@ def SolveWaveTents(initmesh, order, c, t_step): >>> order = 4 >>> SetNumThreads(4) >>> c = 1 - >>> t_step = 2/sqrt(3) + >>> t_step = 0.5 >>> meshes=[ Mesh(SegMesh(4,0,math.pi)), Mesh(unit_square.GenerateMesh(maxh = 0.4)) , Mesh(unit_cube.GenerateMesh(maxh = 1))] >>> for initmesh in meshes: ... for maxh in range(3): @@ -25,14 +25,14 @@ def SolveWaveTents(initmesh, order, c, t_step): ... initmesh.Refine() ... else: ... initmesh=Mesh(SegMesh(initmesh.ne*2,0,1)) - 0.14... + 0.12... ...e-05 ...e-06 0.01... - 0.002... + 0.001... 0.0001... 0.1... - 0.06... + 0.05... 0.003... same example with Neumann boundary conditions @@ -46,11 +46,11 @@ def SolveWaveTents(initmesh, order, c, t_step): ... initmesh.Refine() ... else: ... initmesh=Mesh(SegMesh(initmesh.ne*2,0,1)) - 0.14... + 0.12... ...e-05 ...e-06 - 0.01... - 0.002... + 0.0... + 0.001... 0.0001... 0.1... 0.05... @@ -216,7 +216,7 @@ def SolveWaveTentsFO(initmesh, order, c, t_step): ... SolveWaveTentsFO(initmesh, order, c, t_step) # doctest:+ELLIPSIS ... initmesh.Refine() 0.01... - 0.002... + 0.00... 0.0001... """ From 2fe6505682669aec60335bda531396df2d90b003 Mon Sep 17 00:00:00 2001 From: Paul Date: Sat, 27 Aug 2022 14:10:41 +0200 Subject: [PATCH 2/3] run all tests --- .github/workflows/Dockerfile | 29 ++--- .github/workflows/build.yml | 190 ++++++++++++++++----------------- .github/workflows/build_pip.sh | 10 +- Dockerfile | 20 ++-- setup.py | 4 +- 5 files changed, 128 insertions(+), 125 deletions(-) diff --git a/.github/workflows/Dockerfile b/.github/workflows/Dockerfile index 7c05b4f8..cb67c742 100644 --- a/.github/workflows/Dockerfile +++ b/.github/workflows/Dockerfile @@ -2,24 +2,16 @@ FROM ubuntu:latest WORKDIR /home/app -RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get -y install vim python3 python3-pip python3-distutils python3-tk libpython3-dev libxmu-dev tk-dev tcl-dev cmake git g++ libglu1-mesa-dev libblas-dev liblapack-dev +RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get -y install vim python3 python3-pip python3-distutils git #python3-tk libpython3-dev libxmu-dev tk-dev tcl-dev cmake g++ libglu1-mesa-dev libblas-dev liblapack-dev -#RUN pip install ngsolve ngstrefftz +RUN pip install ngsolve +RUN pip install ngstrefftz -RUN apt-get update -RUN apt-get update -RUN apt-get install -y software-properties-common -RUN add-apt-repository universe -RUN add-apt-repository ppa:ngsolve/nightly -y -RUN apt-get install ngsolve -y - -ENV PYTHONPATH=/usr/lib/python3/dist-packages/ -ENV NETGENDIR=/usr/bin/ +#ENV PYTHONPATH=/usr/lib/python3/dist-packages/ +#ENV NETGENDIR=/usr/bin/ +ENV PYTHONPATH=$PYTHONPATH:/usr/local/lib/python3.10/site-packages/ RUN git clone --recursive https://github.com/PaulSt/NGSTrefftz /home/app/ngstrefftz -RUN cmake -B/home/app/ngstrefftz/make -S/home/app/ngstrefftz/src -RUN make -C/home/app/ngstrefftz/make -RUN make -C/home/app/ngstrefftz/make install RUN apt-get install npm nodejs -y RUN pip3 install jupyter_contrib_nbextensions @@ -42,3 +34,12 @@ RUN cd /home/app/ngstrefftz/external_dependencies/ngstents/tentswebgui && ./buil RUN cd /home/app/ngstrefftz/external_dependencies/ngstents/tentswebgui && pip3 install . RUN jupyter nbextension install --py tentswebgui RUN jupyter nbextension enable --py tentswebgui + +##RUN pip3 install jupyter +RUN pip3 install jupyter_contrib_nbextensions +RUN pip3 install jupyter_nbextensions_configurator +RUN pip3 install RISE +RUN pip3 install ipywidgets +RUN jupyter contrib nbextension install +#RUN cd /home/app/ngstents/tentswebgui && pip3 install --user . + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1ef779f5..acd343ef 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -159,7 +159,7 @@ jobs: password: ${{ secrets.PYPI_API_TOKEN }} docker: - needs: [ubuntu] + needs: [ubuntu,pypi] runs-on: ubuntu-latest if: github.event_name == 'release' && github.event.action == 'created' steps: @@ -193,98 +193,98 @@ jobs: tags: ${{ steps.meta.outputs.tags }} #labels: ${{ steps.meta.outputs.labels }} - #docs: - #needs: [ubuntu] - #runs-on: ubuntu-latest - #steps: - #- uses: actions/checkout@master - #with: - #fetch-depth: 0 # otherwise, you will failed to push refs to dest repo - #submodules: 'True' - #path: 'NGSTrefftz' - #- name: install pkgs - #run: | - #sudo apt-get update && DEBIAN_FRONTEND="noninteractive" sudo apt-get -y install vim libxmu-dev tk-dev tcl-dev cmake git g++ libglu1-mesa-dev libblas-dev liblapack-dev python3 python3-pip python3-distutils python3-tk libpython3-dev - #sudo apt-get install -y software-properties-common - #sudo add-apt-repository universe - #sudo add-apt-repository ppa:ngsolve/nightly -y - #sudo apt-get install ngsolve -y - #sudo apt-get install npm nodejs pandoc -y - #- name: pip pkgs - #run: python3 -m pip list - #- name: set path - #run: | - #echo "NETGENDIR=/usr/bin/" >> $GITHUB_ENV - #- run: pip install --user -r $GITHUB_WORKSPACE/NGSTrefftz/docs/requirements.txt - #- name: webgui - #run: | - #jupyter nbextension install --user --py widgetsnbextension - #jupyter nbextension enable --user --py widgetsnbextension - #jupyter nbextension install --user --py webgui_jupyter_widgets - #jupyter nbextension enable --user --py webgui_jupyter_widgets - #- run: python3 -c "import sys; print(sys.path)" - #- name: cmake NGSTrefftz - #run: | - #cmake -B $GITHUB_WORKSPACE/NGSTrefftz/make -S $GITHUB_WORKSPACE/NGSTrefftz/src/ - #make -C $GITHUB_WORKSPACE/NGSTrefftz/make - #sudo make -C $GITHUB_WORKSPACE/NGSTrefftz/make install - #python3 -c "import sys; print(sys.path)" - #python3 -c "import ngstrefftz" - ##ln -s /usr/lib/python3/dist-packages/ngsolve /opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/ - ##ln -s /usr/lib/python3/dist-packages/ngstrefftz /opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/ - ##ln -s /usr/lib/python3/dist-packages/ngstents /opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/ - #- name: jupyter stuff - #run: | - #pip install jupyter_contrib_nbextensions - ##pip install jupyter_nbextensions_configurator - #jupyter contrib nbextension install --user - #jupyter nbextension install --user --py widgetsnbextension - #jupyter nbextension enable --user --py widgetsnbextension - #- name: build tentswebgui - #run: | - #cd $GITHUB_WORKSPACE/NGSTrefftz/external_dependencies/ngstents/tentswebgui/ && bash build.sh - #- name: install tentswebgui - #run: | - #cd $GITHUB_WORKSPACE/NGSTrefftz/external_dependencies/ngstents/tentswebgui/ && pip install --user . - #- name: jupyter tentswebgui - #run: | - #jupyter nbextension install --user --py tentswebgui - #jupyter nbextension enable --user --py tentswebgui - #- name: Build and Commit - #uses: sphinx-notes/pages@v2 - #with: - #repository_path: 'NGSTrefftz' - ##requirements_path: ./docs/requirements.txt - #- name: Push changes - #uses: ad-m/github-push-action@master - #if: github.event_name == 'release' && github.event.action == 'created' - #with: - #directory: 'NGSTrefftz' - #github_token: ${{ secrets.GITHUB_TOKEN }} - #branch: gh-pages - #- run: tree -d . - #- name: Upload - #uses: actions/upload-artifact@v1 - #with: - #name: gh-page - #path: 'NGSTrefftz/' - #- name: Debugging - #if: ${{ failure() }} - #run: cat /tmp/sphinx* + docs: + needs: [ubuntu] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + with: + fetch-depth: 0 # otherwise, you will failed to push refs to dest repo + submodules: 'True' + path: 'NGSTrefftz' + - name: install pkgs + run: | + sudo apt-get update && DEBIAN_FRONTEND="noninteractive" sudo apt-get -y install vim libxmu-dev tk-dev tcl-dev cmake git g++ libglu1-mesa-dev libblas-dev liblapack-dev python3 python3-pip python3-distutils python3-tk libpython3-dev + sudo apt-get install -y software-properties-common + sudo add-apt-repository universe + sudo add-apt-repository ppa:ngsolve/nightly -y + sudo apt-get install ngsolve -y + sudo apt-get install npm nodejs pandoc -y + - name: pip pkgs + run: python3 -m pip list + - name: set path + run: | + echo "NETGENDIR=/usr/bin/" >> $GITHUB_ENV + - run: pip install --user -r $GITHUB_WORKSPACE/NGSTrefftz/docs/requirements.txt + - name: webgui + run: | + jupyter nbextension install --user --py widgetsnbextension + jupyter nbextension enable --user --py widgetsnbextension + jupyter nbextension install --user --py webgui_jupyter_widgets + jupyter nbextension enable --user --py webgui_jupyter_widgets + - run: python3 -c "import sys; print(sys.path)" + - name: cmake NGSTrefftz + run: | + cmake -B $GITHUB_WORKSPACE/NGSTrefftz/make -S $GITHUB_WORKSPACE/NGSTrefftz/src/ + make -C $GITHUB_WORKSPACE/NGSTrefftz/make + sudo make -C $GITHUB_WORKSPACE/NGSTrefftz/make install + python3 -c "import sys; print(sys.path)" + python3 -c "import ngstrefftz" + #ln -s /usr/lib/python3/dist-packages/ngsolve /opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/ + #ln -s /usr/lib/python3/dist-packages/ngstrefftz /opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/ + #ln -s /usr/lib/python3/dist-packages/ngstents /opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/ + - name: jupyter stuff + run: | + pip install jupyter_contrib_nbextensions + #pip install jupyter_nbextensions_configurator + jupyter contrib nbextension install --user + jupyter nbextension install --user --py widgetsnbextension + jupyter nbextension enable --user --py widgetsnbextension + - name: build tentswebgui + run: | + cd $GITHUB_WORKSPACE/NGSTrefftz/external_dependencies/ngstents/tentswebgui/ && bash build.sh + - name: install tentswebgui + run: | + cd $GITHUB_WORKSPACE/NGSTrefftz/external_dependencies/ngstents/tentswebgui/ && pip install --user . + - name: jupyter tentswebgui + run: | + jupyter nbextension install --user --py tentswebgui + jupyter nbextension enable --user --py tentswebgui + - name: Build and Commit + uses: sphinx-notes/pages@v2 + with: + repository_path: 'NGSTrefftz' + #requirements_path: ./docs/requirements.txt + - name: Push changes + uses: ad-m/github-push-action@master + if: github.event_name == 'release' && github.event.action == 'created' + with: + directory: 'NGSTrefftz' + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: gh-pages + - run: tree -d . + - name: Upload + uses: actions/upload-artifact@v1 + with: + name: gh-page + path: 'NGSTrefftz/' + - name: Debugging + if: ${{ failure() }} + run: cat /tmp/sphinx* - #paper: - #runs-on: ubuntu-latest - #name: Paper Draft - #steps: - #- name: Checkout - #uses: actions/checkout@v2 - #- name: Build draft PDF - #uses: openjournals/openjournals-draft-action@master - #with: - #journal: joss - #paper-path: docs/paper/paper.md - #- name: Upload - #uses: actions/upload-artifact@v1 - #with: - #name: joss_paper - #path: docs/paper/paper.pdf + paper: + runs-on: ubuntu-latest + name: Paper Draft + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Build draft PDF + uses: openjournals/openjournals-draft-action@master + with: + journal: joss + paper-path: docs/paper/paper.md + - name: Upload + uses: actions/upload-artifact@v1 + with: + name: joss_paper + path: docs/paper/paper.pdf diff --git a/.github/workflows/build_pip.sh b/.github/workflows/build_pip.sh index 763ca032..198cd062 100644 --- a/.github/workflows/build_pip.sh +++ b/.github/workflows/build_pip.sh @@ -15,19 +15,19 @@ for pyversion in 38 39 310 do export PYDIR="/opt/python/cp${pyversion}-cp${pyversion}/bin" export PATH="$ORIGINAL_PATH:$PYDIR" - echo $PYDIR + #echo $PYDIR #$PYDIR/pip install -U pytest-check numpy wheel scikit-build mkl==2021.* mkl-devel==2021.* #$PYDIR/pip install netgen-mesher #NETGENDIR=/opt/_internal/cpython-3.9.13/bin #rm -rf /home/app/ngstrefftz/make rm -rf _skbuild - pip install ngsolve + $PYDIR/pip install ngsolve - pip wheel -vvv . + $PYDIR/pip wheel -vvv . auditwheel repair ngstrefftz*.whl rm -rf *.whl - pip uninstall -y ngsolve + $PYDIR/pip uninstall -y ngsolve $PYDIR/pip uninstall -y netgen-mesher # avx2 build: @@ -40,5 +40,5 @@ do $PYDIR/pip uninstall -y netgen-mesher-avx2 done -pip install -U twine +$PYDIR/pip install -U twine #$PYDIR/twine upload wheelhouse/*manylinux*.whl diff --git a/Dockerfile b/Dockerfile index 3c9793f3..bb9882d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,12 @@ FROM paulstdocker/ngstrefftz:latest -#RUN pip3 install jupyter -RUN pip3 install jupyter_contrib_nbextensions -RUN pip3 install jupyter_nbextensions_configurator -RUN pip3 install RISE -RUN pip3 install ipywidgets -RUN jupyter contrib nbextension install -#RUN cd /home/app/ngstents/tentswebgui && pip3 install --user . +##RUN pip3 install jupyter +#RUN pip3 install jupyter_contrib_nbextensions +#RUN pip3 install jupyter_nbextensions_configurator +#RUN pip3 install RISE +#RUN pip3 install ipywidgets +#RUN jupyter contrib nbextension install +##RUN cd /home/app/ngstents/tentswebgui && pip3 install --user . ARG NB_USER=jovyan ARG NB_UID=1000 @@ -26,8 +26,8 @@ RUN jupyter nbextensions_configurator enable --user RUN jupyter nbextension enable --user codefolding/main RUN jupyter nbextension enable --user --py tentswebgui -WORKDIR /home/${NB_USER} - -COPY . ${HOME} +#WORKDIR /home/${NB_USER} +#COPY . ${HOME} +WORKDIR /home/app/ngstrefftz/docs/notebooks CMD ["jupyter", "notebook", "--port=8888", "--no-browser", "--ip=0.0.0.0", "--allow-root" ] diff --git a/setup.py b/setup.py index 2057a260..b9053880 100644 --- a/setup.py +++ b/setup.py @@ -124,13 +124,15 @@ def build_extension(self, ext): install_requires = [ 'ngsolve'+avx2+'>='+ngsolve.__version__ ] if sys.argv[1] == "sdist": - package_data= {"ngstrefftz": ["*" + package_data = {"ngstrefftz": ["*" ,"../test/*" ,"../external_dependencies/ngstents/*"\ ,"../external_dependencies/ngstents/src/*"\ ,"../external_dependencies/ngstents/py/*"\ ]} name += "-src" +else: + package_data = {} setup( name=name, From 8534df56d9eb3c80a749659017238500ebe687ba Mon Sep 17 00:00:00 2001 From: Paul Date: Sat, 27 Aug 2022 14:33:29 +0200 Subject: [PATCH 3/3] fix notebook, pypi ready --- .github/workflows/build.yml | 22 +--------------------- docs/notebooks/twavetents.ipynb | 2 +- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index acd343ef..a4ded392 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -109,27 +109,7 @@ jobs: with: password: ${{ secrets.PYPI_API_TOKEN }} packages_dir: NGSTrefftz/wheelhouse/ - repository_url: https://test.pypi.org/legacy/ - - #pypi-test: - #needs: [ubuntu] - #runs-on: ubuntu-latest - #steps: - #- name: install pkgs - #run: | - #sudo apt-get update && DEBIAN_FRONTEND="noninteractive" sudo apt-get -y install vim python3 python3-pip python3-distutils python3-tk libpython3-dev libxmu-dev tk-dev tcl-dev cmake git g++ libglu1-mesa-dev libblas-dev liblapack-dev - #pip install ngsolve - #- uses: actions/checkout@v2 - #with: - #submodules: 'True' - #- name: Update pip and Install setuptools - #run: | - #python3 -m pip install --upgrade pip - #python3 -m pip install setuptools - #- name: Package ngstrefftz sources for PyPI - #run: python3 setup.py sdist - #- name: pip install ngstrefftz - #run: pip install dist/* + #repository_url: https://test.pypi.org/legacy/ pypi-src: needs: [ubuntu] diff --git a/docs/notebooks/twavetents.ipynb b/docs/notebooks/twavetents.ipynb index bdbffcb5..65e59d83 100644 --- a/docs/notebooks/twavetents.ipynb +++ b/docs/notebooks/twavetents.ipynb @@ -15,8 +15,8 @@ "metadata": {}, "outputs": [], "source": [ - "from ngstents._pytents import TentSlab\n", "from ngstrefftz import TWave\n", + "from ngstents._pytents import TentSlab\n", "from ngsolve.TensorProductTools import *\n", "from netgen.geom2d import unit_square\n", "from ngsolve import *\n",