diff --git a/.travis.yml b/.travis.yml index ed1bca620..f512b11ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,69 +1,127 @@ language: python -python: -- '3.6' -- '3.7-dev' - -git: - depth: 200 -sudo: required -dist: trusty +matrix: + include: + - name: Bionic python 3.7 + os: linux + dist: bionic + python: 3.7 + env: + - REPO=https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh + - OS=linux-64 + - name: trusty python 3.6 + os: linux + dist: trusty + python: 3.6 + env: + - REPO=https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh + - OS=linux-64 + - name: xenial python 3.7 + os: linux + dist: xenial + python: 3.7 + env: + - REPO=https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh + - OS=linux-64 + - name: xenial python 3.6 + os: linux + dist: xenial + python: 3.6 + env: + - REPO=https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh + - OS=linux-64 + - name: osx python 3.7 + os: osx + language: generic + env: + - REPO=https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh + - TRAVIS_PYTHON_VERSION=3.7 + - OS=osx-64 + - name: osx python 3.6 + os: osx + language: generic + env: + - REPO=https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh + - TRAVIS_PYTHON_VERSION=3.6 + - OS=osx-64 before_install: - - sudo apt-get update - - ldd --version - - gcc --version - - export START=$(pwd) +- gcc --version +- export START=$(pwd) install: -- if [[ "$TRAVIS_PYTHON_VERSION" == "3.7-dev" ]]; then export VADD="py37"; else export VADD="py36"; fi -- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh - -O miniconda.sh +- wget "$REPO" -O miniconda.sh - bash miniconda.sh -b -p $HOME/miniconda - export PATH="$HOME/miniconda/bin:$PATH" - hash -r - conda config --set always_yes yes --set changeps1 no -- conda install conda-build -- conda update -q conda -- conda update -n root conda-build -- conda config --set anaconda_upload no - conda config --append channels conda-forge - conda config --append channels tofuproject - conda info -a -- if [[ "$TRAVIS_PYTHON_VERSION" == "3.7-dev" ]]; then export THIS_PY_VERSION="3.7"; - else THIS_PY_VERSION=$TRAVIS_PYTHON_VERSION; - fi -- conda install -q python=$THIS_PY_VERSION conda-build anaconda-client nose - nose-timer coverage codecov +- conda install -q python="$TRAVIS_PYTHON_VERSION" conda-verify nose nose-timer coverage + codecov - export REV=$(python -c "import _updateversion as up; out=up.updateversion(); print(out)") - export VERSION=$(echo $REV | tr - .) - echo $REV -- conda build conda_recipe -- export PKG_DIR=$HOME/miniconda/conda-bld/linux-64/ -- conda install tofu --use-local +- pip install -e ".[dev]" script: - cd $HOME -- nosetests tofu.tests --nocapture -v --with-id --with-timer --with-coverage - --cover-package=tofu +- nosetests tofu.tests --nocapture -v --with-id --with-timer --with-coverage --cover-package=tofu after_success: - codecov - chmod +x $START/anaconda_upload.sh - echo $TRAVIS_TAG before_deploy: +- echo "BEFORE DEPLOY START........" - ls $START - cd $START +- conda config --set anaconda_upload no +- conda install anaconda-client conda-build +- conda build conda_recipe +- export PKG_REAL=$(conda build . --output | tail -1) +- echo "BEFORE DEPLOY END.........." deploy: - - provider: script - user: "ToFuProject" - script: $START/anaconda_upload.sh + - provider: pypi + distributions: sdist + user: __token__ + skip_existing: true on: tags: true - all_branches: true - skip_cleanup: true + branch: deploy-test + server: https://test.pypi.org/legacy/ + password: + secure: xfVFuoz9YYNChzmT8DC9y+8eH6zdFkfoy3B51uqy8b+vhJNzCzLay4F0uSHvhHy6iYorM6UQKr6soC4D7n3PhmnFOTX/cgLtd/p4gBWGYZF6yXacvw+UHKMshgbAhn2sEynxdSAqdAlNttMI8jsUu9RhbzGiv1l5zSNnFWF4Zsly02G68UnztxIGoz8AYTRW2N2oQhGrl/ryj/YG4mSRKjled6BzK7kNoJUqLGl12DqdMMTEmdJ9NHBXgK3Dv0ya17ReFz3TcxE/4+Yc38NwSR4Ia2EvVSMtyIaccQ1uSrXwW8JQOMn+9CmDWZVUMDD2bzKYbm2WGGM9Fh8WrHnwlWRujoLDofhYEK0Cus11gULFF+J88XucOJlyJNrHP6TWxdSVVoQfwWr2ABqZIvilsvHpF+sjDLqomTNHdi+BbzP2koRv0nJb9K1W24bjPLtSK8+plX7suv7gdBNwlsJ+dPLDM87v4+jGHGthQ6P4X2guTMHZm1PU0PSPB9LCbENCN1uktLLhkgx7gZ42Ag+Jwiu02ENkChLaEB4WpPb9mjLnomu5LDYXFGtPJ/uLMOi3VCXyda0LrzqDhXYT3Cg4hvXySwJcgMYSXalfTxnTm9oouePiEXDbK+XwjMP9mjC5CeMg3SaFFTywqaTH0WUqiOBUJ6H3Gsm0sB15Tj4lNKQ= + - provider: pypi + distributions: bdist_wheel + user: __token__ + skip_existing: true + on: + condition: $OS = osx-64 + tags: true + branch: deploy-test + server: https://test.pypi.org/legacy/ + password: + secure: xfVFuoz9YYNChzmT8DC9y+8eH6zdFkfoy3B51uqy8b+vhJNzCzLay4F0uSHvhHy6iYorM6UQKr6soC4D7n3PhmnFOTX/cgLtd/p4gBWGYZF6yXacvw+UHKMshgbAhn2sEynxdSAqdAlNttMI8jsUu9RhbzGiv1l5zSNnFWF4Zsly02G68UnztxIGoz8AYTRW2N2oQhGrl/ryj/YG4mSRKjled6BzK7kNoJUqLGl12DqdMMTEmdJ9NHBXgK3Dv0ya17ReFz3TcxE/4+Yc38NwSR4Ia2EvVSMtyIaccQ1uSrXwW8JQOMn+9CmDWZVUMDD2bzKYbm2WGGM9Fh8WrHnwlWRujoLDofhYEK0Cus11gULFF+J88XucOJlyJNrHP6TWxdSVVoQfwWr2ABqZIvilsvHpF+sjDLqomTNHdi+BbzP2koRv0nJb9K1W24bjPLtSK8+plX7suv7gdBNwlsJ+dPLDM87v4+jGHGthQ6P4X2guTMHZm1PU0PSPB9LCbENCN1uktLLhkgx7gZ42Ag+Jwiu02ENkChLaEB4WpPb9mjLnomu5LDYXFGtPJ/uLMOi3VCXyda0LrzqDhXYT3Cg4hvXySwJcgMYSXalfTxnTm9oouePiEXDbK+XwjMP9mjC5CeMg3SaFFTywqaTH0WUqiOBUJ6H3Gsm0sB15Tj4lNKQ= - provider: pypi + distributions: sdist user: "Didou09" - distributions: "sdist" - skip_cleanup: true skip_existing: true on: tags: true - all_branches: true + branch: master password: secure: JNEDTDJVx/2fXNfHntNQ99iDRNuQ4uB3y+DBWVIBycCT95+UCb36YPtKzmruEk/UUS29Xgq4IYCGdfCSWE9smKqG8tV1PcHiw705m+AzcpKy77YtzbVECFBxqY4W36O2pHrkwEUzP/7acjFwNsnUFzArqEzsBJ+KdLaa4OPHJXCh30GA0GyqlrXYbBKG+DA9hX5vtsGo4C6w9noALYF3fS7pKPiI6ipKFnAlzGgHQ7Ke0uQME8N3IAFhmh+Z5xMtIIDWxlnqv+KszdG4DIaGV/W6NIJNAbRhzkqUd+Chu6LoPAd/XkHDTeirR/MBkNUc5UcRJxRnP9rUTRo1gCO/buTYuNRgFkMvqhV5a033+x9edWgtUiKNJIMPLXOxe0RJvc5GWji+Co77HtHxRmGRM2rnYqWMtZeYZlFbUdvHu/8jf0d6I8jyUgAoJYdlMA2u/ipENP3S6by4epE9qycUPXiIVh6r3DZbf3vPTMFvTZYAjBrA0NOzihv1xgcXwemmNUFOQSpe0io4UcFxtS9lLMo+30UMQjCHSnbEVM3zSlZmbMOKpkVOlKlt8Lz5NxwVgWtu9FuW2pGukLtE8AWbqvY9urXAPZCQqZlOIklIjJQIqOITnuw9LEV09cgvPHXfdvNni3ldbMlIQ89zryM6dYvhYryTiEZGK4JDR3wAKJA= + - provider: pypi + distributions: bdist_wheel + user: "Didou09" + skip_existing: true + on: + condition: $OS = osx-64 + tags: true + branch: master + password: + secure: JNEDTDJVx/2fXNfHntNQ99iDRNuQ4uB3y+DBWVIBycCT95+UCb36YPtKzmruEk/UUS29Xgq4IYCGdfCSWE9smKqG8tV1PcHiw705m+AzcpKy77YtzbVECFBxqY4W36O2pHrkwEUzP/7acjFwNsnUFzArqEzsBJ+KdLaa4OPHJXCh30GA0GyqlrXYbBKG+DA9hX5vtsGo4C6w9noALYF3fS7pKPiI6ipKFnAlzGgHQ7Ke0uQME8N3IAFhmh+Z5xMtIIDWxlnqv+KszdG4DIaGV/W6NIJNAbRhzkqUd+Chu6LoPAd/XkHDTeirR/MBkNUc5UcRJxRnP9rUTRo1gCO/buTYuNRgFkMvqhV5a033+x9edWgtUiKNJIMPLXOxe0RJvc5GWji+Co77HtHxRmGRM2rnYqWMtZeYZlFbUdvHu/8jf0d6I8jyUgAoJYdlMA2u/ipENP3S6by4epE9qycUPXiIVh6r3DZbf3vPTMFvTZYAjBrA0NOzihv1xgcXwemmNUFOQSpe0io4UcFxtS9lLMo+30UMQjCHSnbEVM3zSlZmbMOKpkVOlKlt8Lz5NxwVgWtu9FuW2pGukLtE8AWbqvY9urXAPZCQqZlOIklIjJQIqOITnuw9LEV09cgvPHXfdvNni3ldbMlIQ89zryM6dYvhYryTiEZGK4JDR3wAKJA= + - provider: script + user: "ToFuProject" + script: $START/anaconda_upload.sh + on: + tags: true + branch: master + skip_cleanup: true diff --git a/Notebooks/Cython_speedup_notes.ipynb b/Notebooks/Cython_speedup_notes.ipynb index bead1fb51..9635fdd7c 100644 --- a/Notebooks/Cython_speedup_notes.ipynb +++ b/Notebooks/Cython_speedup_notes.ipynb @@ -94,20 +94,20 @@ "output_type": "stream", "text": [ "For L = 1000\n", - "0.360000 μs, using the untyped_func\n", - "0.123000 μs, using the somewhat_typed_func\n", - "0.113000 μs, using the typed_func\n", - "0.029000 μs, using the inline_typed_func\n", + "0.798000 μs, using the untyped_func\n", + "0.027000 μs, using the somewhat_typed_func\n", + "0.017000 μs, using the typed_func\n", + "0.008000 μs, using the inline_typed_func\n", "For L = 10000\n", - "5.174000 μs, using the untyped_func\n", - "0.024000 μs, using the somewhat_typed_func\n", - "0.012000 μs, using the typed_func\n", - "0.015000 μs, using the inline_typed_func\n", + "8.871000 μs, using the untyped_func\n", + "0.027000 μs, using the somewhat_typed_func\n", + "0.014000 μs, using the typed_func\n", + "0.014000 μs, using the inline_typed_func\n", "For L = 100000\n", - "43.197000 μs, using the untyped_func\n", - "0.151000 μs, using the somewhat_typed_func\n", - "0.025000 μs, using the typed_func\n", - "0.024000 μs, using the inline_typed_func\n" + "81.221000 μs, using the untyped_func\n", + "0.148000 μs, using the somewhat_typed_func\n", + "0.010000 μs, using the typed_func\n", + "0.015000 μs, using the inline_typed_func\n" ] } ], @@ -200,7 +200,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -210,19 +210,19 @@ "\n", "-------- TESTS -------\n", "Running numpy buffers\n", - "0.020667 0.009333 0.098333 0.882333 6.571667 58.261333 670.627333 μs\n", + "0.010667 0.027000 0.108667 0.926667 11.027667 95.586333 1118.653333 μs\n", "Running cpython.array buffer\n", - "0.327333 0.090000 0.323333 0.742333 7.339333 70.054000 1853.809000 μs\n", + "0.074667 0.091667 0.351667 3.606667 25.803333 230.891000 2605.097000 μs\n", "Running cpython.array memoryview\n", - "0.890333 0.785000 1.215667 1.305667 6.270667 44.810333 538.815667 μs\n", + "0.325333 0.398667 1.079000 1.887667 7.430000 79.003667 1005.866000 μs\n", "Running cpython.array raw C type with trick\n", - "0.044000 0.048667 0.380000 1.419333 10.037000 100.486667 2541.475333 μs\n", + "0.035000 0.041667 0.119667 0.787667 8.991000 93.519667 1401.235667 μs\n", "Running C pointers\n", - "0.006000 0.006333 0.023667 0.159000 2.129667 25.866667 363.967667 μs\n", + "0.005000 0.006667 0.057333 0.563333 5.081000 35.753000 887.650667 μs\n", "Running malloc memoryview\n", - "0.588667 0.630333 0.663667 1.224333 2.392333 23.987667 379.138667 μs\n", + "0.482333 1.043333 0.778000 1.127333 6.685000 53.277667 798.593333 μs\n", "Running argument memoryview\n", - "0.011667 0.016333 0.112000 0.722667 5.305000 45.683333 525.975333 μs\n" + "0.008000 0.019000 0.156000 1.217000 10.740000 96.713667 1305.644333 μs\n" ] } ], @@ -391,7 +391,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ @@ -402,9 +402,28 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 6, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "For L = 1000\n", + "10.211000 μs, using the sequential loop\n", + "58.846000 μs, using the parallel 1 loop\n", + "25.343000 μs, using the parallel 2 loop\n", + "For L = 10000\n", + "53.134000 μs, using the sequential loop\n", + "180.918000 μs, using the parallel 1 loop\n", + "49.014000 μs, using the parallel 2 loop\n", + "For L = 100000\n", + "827.005000 μs, using the sequential loop\n", + "601.007000 μs, using the parallel 1 loop\n", + "132.242000 μs, using the parallel 2 loop\n" + ] + } + ], "source": [ "%%cython --compile=-fopenmp --link-args=-fopenmp\n", "\n", @@ -650,7 +669,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.2" + "version": "3.7.5" } }, "nbformat": 4, diff --git a/_updateversion.py b/_updateversion.py index 9ae7ad0cc..d948f779b 100644 --- a/_updateversion.py +++ b/_updateversion.py @@ -6,6 +6,7 @@ _HERE = os.path.abspath(os.path.dirname(__file__)) + def updateversion(path=_HERE): # Fetch version from git tags, and write to version.py # Also, when git is not available (PyPi package), use stored version.py @@ -13,13 +14,13 @@ def updateversion(path=_HERE): try: version_git = subprocess.check_output(["git", "describe"]).rstrip().decode() - except: - with open(version_py,'r') as fh: - version_git = fh.read().strip().split("=")[-1].replace("'",'') - version_git = version_git.lower().replace('v','') + except subprocess.CalledProcessError: + with open(version_py, 'r') as fh: + version_git = fh.read().strip().split("=")[-1].replace("'", '') + version_git = version_git.lower().replace('v', '').replace(' ', '') version_msg = "# Do not edit, pipeline versioning governed by git tags!" - with open(version_py,"w") as fh: + with open(version_py, "w") as fh: msg = "{0}__version__ = '{1}'{0}".format(os.linesep, version_git) fh.write(version_msg + msg) return version_git diff --git a/conda_recipe/conda_upload.sh b/conda_recipe/conda_upload.sh index d50ad2fb0..4fe6fa2b5 100644 --- a/conda_recipe/conda_upload.sh +++ b/conda_recipe/conda_upload.sh @@ -1,20 +1,6 @@ # Only need to change these two variables -PKG_NAME=tofu USER=ToFuProject -OS=linux-64 -#mkdir ~/conda-bld -#conda config --set anaconda_upload no -#conda update -n root conda-build -#conda config --append channels conda-forge -#conda config --append channels tofuproject -#export CONDA_BLD_PATH=~/conda-bld -#export VERSION=`date +%Y.%m.%d` -#export VERSION=$(head -n 1 version.txt) - -#conda build conda_recipe echo "Available conda packages:" -echo $(find $CONDA_BLD_PATH/$OS/ -type f -name $PKG_NAME*.tar.bz2) -PKG_REAL=$(find $CONDA_BLD_PATH/$OS/ -type f -name $PKG_NAME-$VERSION-$VADD*.tar.bz2) echo $PKG_REAL anaconda -t $CONDA_UPLOAD_TOKEN upload -u $USER -l main $PKG_REAL --force diff --git a/conda_recipe/meta.yaml b/conda_recipe/meta.yaml index caf994d59..2f0a3752c 100644 --- a/conda_recipe/meta.yaml +++ b/conda_recipe/meta.yaml @@ -4,16 +4,12 @@ package: source: git_url: https://github.com/ToFuProject/tofu.git - #git_branch: {{ environ['TRAVIS_BRANCH'] }} git_rev: {{ environ['REV'] }} - # "patches:" might be the answer for clang compilers ? build: script_env: - # - REV - - VERSION + - PKG_REAL - TRAVIS_BRANCH - - CONDA_BLD_PATH requirements: @@ -21,7 +17,7 @@ requirements: # here same as run, as we are using cython build: - python - - setuptools + - setuptools >=40.8.0 - setuptools_scm - numpy - scipy diff --git a/examples/tutorials/tuto_plot_custom_emissivity.py b/examples/tutorials/tuto_plot_custom_emissivity.py index 5959a37af..d6aecf05c 100644 --- a/examples/tutorials/tuto_plot_custom_emissivity.py +++ b/examples/tutorials/tuto_plot_custom_emissivity.py @@ -95,4 +95,4 @@ def project_to_2D(xyz): t=time_vector) sig.plot(ntMax=1) -plt.show(block=False) +plt.show(block=True) diff --git a/setup.py b/setup.py index 8119e5b5c..443fdd0f2 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,6 @@ from setuptools import setup, find_packages from setuptools import Extension # ... packages that need to be in pyproject.toml -import Cython as cth from Cython.Distutils import build_ext import numpy as np # ... @@ -36,6 +35,7 @@ logging.basicConfig(level=logging.INFO) logger = logging.getLogger("tofu.setup") + class CleanCommand(Clean): description = "Remove build artifacts from the source tree" @@ -136,6 +136,7 @@ def check_for_openmp(cc_var): shutil.rmtree(tmpdir) return result + # ....... Using function if is_platform_windows: openmp_installed = False @@ -155,7 +156,7 @@ def updateversion(path=_HERE): try: version_git = subprocess.check_output(["git", "describe"]).rstrip().decode() - except Exception as err: + except subprocess.CalledProcessError: with open(version_py, 'r') as fh: version_git = fh.read().strip().split("=")[-1].replace("'", '') version_git = version_git.lower().replace('v', '') @@ -166,6 +167,7 @@ def updateversion(path=_HERE): fh.write(version_msg + msg) return version_git + def get_version_tofu(path=_HERE): # Try from git @@ -177,7 +179,6 @@ def get_version_tofu(path=_HERE): [ "git", "rev-parse", - "--symbolic-full-name", "--abbrev-ref", "HEAD", ] @@ -185,7 +186,7 @@ def get_version_tofu(path=_HERE): .rstrip() .decode() ) - if git_branch in ["master"]: + if git_branch in ["master", "deploy-test"]: version_tofu = updateversion() else: isgit = False @@ -198,14 +199,16 @@ def get_version_tofu(path=_HERE): with open(version_tofu, "r") as fh: version_tofu = fh.read().strip().split("=")[-1].replace("'", "") - version_tofu = version_tofu.lower().replace("v", "") + version_tofu = version_tofu.lower().replace("v", "").replace(" ", "") return version_tofu + version_tofu = get_version_tofu(path=_HERE) print("") print("Version for setup.py : ", version_tofu) print("") + # ============================================================================= # ============================================================================= diff --git a/tofu/geom/_comp.py b/tofu/geom/_comp.py index 8ddef84bf..b91a9c6fb 100644 --- a/tofu/geom/_comp.py +++ b/tofu/geom/_comp.py @@ -3,7 +3,6 @@ """ # Built-in -import sys import warnings # Common @@ -63,6 +62,7 @@ def _Struct_set_Poly( else: Vol, BaryV = _GG.Poly_VolAngTor(Poly) msg = "Pb. with volume computation for Ves object of type 'Tor' !" + msg = "\n Here Volume = " + str(Vol) assert Vol > 0.0, msg # Compute the non-normalized vector of each side of the Poly diff --git a/tofu/version.py b/tofu/version.py index 3c7f44519..61a5c84d9 100644 --- a/tofu/version.py +++ b/tofu/version.py @@ -1,2 +1,2 @@ # Do not edit, pipeline versioning governed by git tags! -__version__ = '1.4.2-a5-71-g56f30784' +__version__ = '1.4.2b16'