Repository: radis/radis (language: python)

Issue:
Release next version 0.15 with `cibuildwheels` 
              Said today : we'll release next version 0.15 with `cibuildwheels` and see if it works ! I'm taking this.

_Originally posted by @erwanp in https://github.com/radis/radis/issues/596#issuecomment-1677762699_
            


Discussion / hints:
@erwanp are we still doing this for 0.15?
I'm looking into it

- https://github.com/pypa/cibuildwheel/blob/main/examples/travis-ci-minimal.yml
- https://github.com/pypa/cibuildwheel/blob/main/examples/travis-ci-deploy.yml
- https://github.com/pypa/cibuildwheel/blob/main/examples/travis-ci-test-and-deploy.yml

Fix patch:
diff --git a/.travis.yml b/.travis.yml
index d23efd836..ce39c5d8c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,130 +1,166 @@
+# Runs Test scripts; Linting; Deployment on Travis-CI
 language: python
 python:
-  # We don't actually use the Travis Python, but this keeps it organized.
   #- "2.7"    # not tested anymore starting from 0.9.19
   - "3.8"
+  - "3.9"
+  - "3.10"
 os: linux
+dist: focal #needed for python 3.10 (xenial is default for Travis-CI, but does not support python 3.10)
 
-stages:
-  - name: test_fast
-    if: branch = master OR branch = develop
-  - name: test_slow
-    if: branch = master OR branch = develop
-    # we dont test on other branches
-  - name: lint
-    if: branch = master OR branch = develop
-    # we dont lint on other branches
-  - name: deploy
-    if: branch = master
+name: Test and Coverage
+install:
+  # Install Micromamba
+  # We do this conditionally because it saves us some downloading if the
+  # version is the same.
+  # For now use http instead of https according to this comment:
+  # https://github.com/mamba-org/mamba/issues/1675#issuecomment-1127160021
+  - wget -qO- https://micro.mamba.pm/api/micromamba/linux-64/1.5.8 | tar -xvj bin/micromamba
+  - ./bin/micromamba shell init -s bash -p ~/micromamba
+  - source ~/.bashrc
+  - micromamba activate base
+  # Update python version in environment
+  - sed -i -E 's/(python=)(.*)/\1'$TRAVIS_PYTHON_VERSION'/' ./environment.yml
+  # Create conda environment
+  - micromamba install xtensor -c conda-forge -y
+  # move requirements.txt to the /tmp folder, required so that .environment.yml finds it
+  - pwd
+  - cp requirements.txt /tmp/requirements.txt
+  # Create the environment:
+  - micromamba create -f ./environment.yml -y
+  # Activate and install test-only dependencies
+  - micromamba activate radis-env
+  - micromamba list
+  - pip install pytest-cov
+  - pip install -e . -v
 
-jobs:
-  include:
-    - stage: test_fast
-      name: Test and Coverage
-      install:
-        # Install Micromamba
-        # We do this conditionally because it saves us some downloading if the
-        # version is the same.
-        # For now use http instead of https according to this comment:
-        # https://github.com/mamba-org/mamba/issues/1675#issuecomment-1127160021
-        - wget -qO- https://micro.mamba.pm/api/micromamba/linux-64/0.25.1 | tar -xvj bin/micromamba
-        - ./bin/micromamba shell init -s bash -p ~/micromamba
-        - source ~/.bashrc
-        - micromamba activate base
-        # Useful for debugging any issues with conda/mamba
-        - micromamba info
-        - micromamba config list
-        # Update python version in environment
-        - sed -i -E 's/(python=)(.*)/\1'$TRAVIS_PYTHON_VERSION'/' ./environment.yml
-        # Create conda environment
-        - micromamba install xtensor -c conda-forge -y
-        # move requirements.txt to the /tmp folder, required so that .environment.yml finds it
-        - pwd
-        - cp requirements.txt /tmp/requirements.txt
-        # Create the environment:
-        - micromamba create -f ./environment.yml -y
-        # Activate and install test-only dependencies
-        - micromamba activate radis-env
-        - micromamba list
-        - pip install pytest-cov
-        - pip install -e . -v
-
-      script:
-        # Your test script goes here
-        - echo ">>> Run tests"
-        # use XVFB to have headless display port, and still run the Matplotlib tests.
-        - xvfb-run -a pytest -m "fast and not needs_db_CDSD_HITEMP_PCN and not needs_db_CDSD_HITEMP and not needs_db_CDSD_HITEMP_PC" --cov=./ --durations=10
-        # --durations=N to print the slowest N tests
-        # lookup 'addopts' in setup.cfg>[tools:pytest] for default tests
-
-      services:
-        - xvfb
-
-      before_script:
-        - export MPLBACKEND=Agg
+services:
+  - xvfb
 
+before_script:
+# pipeline does not continue if anything fails
+# >> If before_install, install or before_script returns a non-zero exit code, the build is errored and
+# >> stops immediately. (https://docs.travis-ci.com/user/job-lifecycle/#breaking-the-build)
+  - export MPLBACKEND=Agg
+  - echo ">>> Run Fast tests first"
+  # use XVFB to have headless display port, and still run the Matplotlib tests.
+  - xvfb-run -a pytest -m "fast and not needs_db_CDSD_HITEMP_PCN and not needs_db_CDSD_HITEMP and not needs_db_CDSD_HITEMP_PC" --durations=10
 
-    - stage: test_slow
-      name: Test and Coverage (slow)
+script:
+  # Your test script goes here
+  # >> If script returns a non-zero exit code, the build is failed, but continues to run before being
+  # >> marked as failed.  (https://docs.travis-ci.com/user/job-lifecycle/#breaking-the-build)
+  - echo ">>> Run All tests now"
+  - xvfb-run -a pytest --cov=./ --durations=10 #re-run fast tests but that is ok because they are fast
+  # --durations=N to print the slowest N tests
+  # lookup 'addopts' in setup.cfg>[tools:pytest] for default tests
 
-      install:
-        # Install Micromamba
-        # We do this conditionally because it saves us some downloading if the
-        # version is the same.
-        # For now use http instead of https according to this comment:
-        # https://github.com/mamba-org/mamba/issues/1675#issuecomment-1127160021
-        - wget -qO- https://micro.mamba.pm/api/micromamba/linux-64/0.25.1 | tar -xvj bin/micromamba
-        - ./bin/micromamba shell init -s bash -p ~/micromamba
-        - source ~/.bashrc
-        - micromamba activate base
-        # Update python version in environment
-        - sed -i -E 's/(python=)(.*)/\1'$TRAVIS_PYTHON_VERSION'/' ./environment.yml
-        # Create conda environment
-        - micromamba install xtensor -c conda-forge -y
-        # move requirements.txt to the /tmp folder, required so that .environment.yml finds it
-        - pwd
-        - cp requirements.txt /tmp/requirements.txt
-        # Create the environment:
-        - micromamba create -f ./environment.yml -y
-        # Activate and install test-only dependencies
-        - micromamba activate radis-env
-        - micromamba list
-        - pip install pytest-cov
-        - pip install -e . -v
-
-      script:
-        # Your test script goes here
-        - echo ">>> Run tests"
-        # use XVFB to have headless display port, and still run the Matplotlib tests.
-        - xvfb-run -a pytest --cov=./ --durations=10 #run all tests but that's ok because the redondant tests are fast!
-        # --durations=N to print the slowest N tests
-        # lookup 'addopts' in setup.cfg>[tools:pytest] for default tests
+after_success:
+  # codecoverage
+  - pip install codecov
+  - codecov
 
-      services:
-        - xvfb
 
-      after_success:
-        # codecoverage
-        - pip install codecov
-        - codecov
-
-      before_script:
-        - export MPLBACKEND=Agg
+stages: #This sequence defines the order of the stages
+  - name: test
+    if: branch = master OR branch = develop
+  - name: lint
+    if: branch = master OR branch = develop
+  - name: build_wheels
+    if: branch = master OR branch = develop
+  - name: deploy
+    if: branch = master
+  # - name: MacOS_py310
+  #   if: branch = master OR branch = develop
+  # - name: Win_py310
+  #   if: branch = master OR branch = develop
+  - name: Py312
+    if: branch = master
 
+jobs:
+  include: #start by testing other OS - TO-DO sort install of micromamba https://mamba.readthedocs.io/en/latest/installation/micromamba-installation.html
+    # - stage: MacOS_py310
+    #   name: Python 3.10 on macOS
+    #   python: "3.10"
+    #   os: osx
+    #   osx_image: xcode11.2
+    #   language: shell
+    # - stage: Win_py310 #https://github.com/mamba-org/micromamba-releases/releases/latest/download/micromamba-win-64
+    #   name: Python 3.10 on Windows
+    #   python: "3.10"
+    #   os: windows
+    #   language: shell
+    #   before_install:
+    #     - choco upgrade python -y --version 3.10.0
+    #     - python -m pip install --upgrade pip
+    #   env: PATH=/c/Python310:/c/Python310/Scripts:$PATH
+    #   install:
+    #     # Install Micromamba
+    #     - Invoke-WebRequest -Uri 'https://micro.mamba.pm/api/micromamba/win-64/1.5.8' -OutFile 'micromamba.tar.bz2'
+    #     - Expand-Archive -Path 'micromamba.tar.bz2' -DestinationPath 'micromamba'
+    #     - Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
+    #     - micromamba shell init -s powershell -p ~/micromamba
+    #     - micromamba activate base
+    #     # Update python version in environment
+    #     - (Get-Content -Path 'environment.yml') -replace '(python=)(.*)', ('$1' + $env:TRAVIS_PYTHON_VERSION) | Set-Content -Path 'environment.yml'
+    #     # Create conda environment
+    #     - micromamba install xtensor -c conda-forge -y
+    #     # move requirements.txt to the /tmp folder, required so that .environment.yml finds it
+    #     - Copy-Item -Path 'requirements.txt' -Destination 'C:\tmp\requirements.txt'
+    #     # Create the environment:
+    #     - micromamba create -f 'environment.yml' -y
+    #     # Activate and install test-only dependencies
+    #     - micromamba activate radis-env
+    #     - micromamba list
+    #     - pip install pytest-cov
+    #     - pip install -e . -v
+  ### Extra Python versions - start
+    - stage: Py312
+      name: "Python 3.12"
+      python: 3.12
+  ### Extra Python versions - end
     - stage: lint
       name: Code Quality Checks
+      python: 3.10
       install:
         - pip install pre-commit
         - pre-commit install
+      before_script: skip #do NOT run the before_script of "tests" stage
       script:
         - pre-commit run --all-files
       after_failure: #better for checking the origin of a bug
         - cat /home/travis/.cache/pre-commit/pre-commit.log
 
+    - stage: build_wheels
+      name: Build the Wheels on Linux, Windows
+      # Added from https://github.com/pypa/cibuildwheel/blob/main/examples/travis-ci-deploy.yml; see https://github.com/radis/radis/issues/650
+      include:
+        # perform a linux build
+        - services: docker
+        # and a windows build
+        - os: windows
+          language: shell
+          before_install:
+            - choco upgrade python -y --version 3.8.6
+            - export PATH="/c/Python38:/c/Python38/Scripts:$PATH"
+            # make sure it's on PATH as 'python3'
+            - ln -s /c/Python38/python.exe /c/Python38/python3.exe
+
+      install: skip
+        #- python3 -m pip install cibuildwheel==2.19.1 #If you intend to build a pure-Python wheel, you don't need cibuildwheel
+
+      before_script: skip #do NOT run the before_script of "tests" stage
+
+      script:
+        # build the wheels, put them into './dist'
+        # - python3 -m cibuildwheel --output-dir dist #If you intend to build a pure-Python wheel, you don't need cibuildwheel
+        - python3 -m pip wheel -w dist .
+
     - stage: deploy
       name: Deploy to PyPI
       install:
         - sudo apt-get update
+      before_script: skip #do NOT run the before_script of "tests" stage
       script:
         - echo "Deploying to PyPI"
       before_deploy:
@@ -136,4 +172,5 @@ jobs:
         password:
           secure: dxZOpuKL1ezk3MM5FgY89zJYNL484x0jUZ+c3IB5q2GjpWl6qmCogoWG37iGZIcmldeIdVzga3pj5CC32eht4B0hJQX5QLVjCq9wwpfLs7Tkj4ODiAzvOchSLhfBOSLOIX33iW/+wxDjZ3fG61TzPI1z3ksdNh7+imdVYiV+G4FmOcxJKjFEgGm7CAwfbxso47ab9jbgm6FHbCC7HfpSiSrMpyIDSorJFk5XR11+Hoe6JjbKr11eeWuoO8EXKvSQeeJpsu0minqFyAy8nf9af/aU3NJU1LOlFM1DuoYlpQKwnbop5lBodU28zt4Asa1h8lp8Zu+wZSIaZSOeEoC6U/H/5zAE03W8SytWyWgNEtwuYLSiWacbOzeZOclVRoNu4P6Fz9hFdZuSANQlSQN7cBYFJiA8cbJDU4nb3srFoKlBLxCH9ZC3/K7rnZpjPmy7A35plNf+1dAEpB6adiWwsGy/VwCywHyJsBq7N3z6lN9wZ2SUPekl4y/sLobYPqg8y48u4bMqfd05Ub1QDUB3MSNALMa+OcczJvxNHZj+Bk4ooai/t/GOMOWNyy78VES7S/J77cWUheq+mW80ywCS8gcyF6ARR4EJxJGwp4q2RHwGdVvxbzc/uaKgi6I1bmLRw4cjJvOXx5ulLdANUftfMg4ATW/VAFqYLrdS/LpGX5A=
         skip_existing: true
+        skip_cleanup: true    # to keep wheels (in the ./dist folder?)
         distributions: "sdist bdist_wheel"
diff --git a/examples/1_Spectra_handling/README.rst b/examples/1_Spectra_handling/README.rst
index c520c3416..6eda61b58 100644
--- a/examples/1_Spectra_handling/README.rst
+++ b/examples/1_Spectra_handling/README.rst
@@ -1,3 +1,3 @@
 Calculate and handle spectra
 ---------------
-Computation of spectra, with redondancy of some modules in the examples. Benchmark of the RADIS code can also be found in ``\radis\test\benchmark``.
\ No newline at end of file
+Computation of spectra, with redondancy of some modules in the examples. Benchmark of the RADIS code can also be found in ``\radis\test\benchmark``.
diff --git a/examples/2_Experimental_spectra/README.rst b/examples/2_Experimental_spectra/README.rst
index 5adcc4e76..9dcab1960 100644
--- a/examples/2_Experimental_spectra/README.rst
+++ b/examples/2_Experimental_spectra/README.rst
@@ -1,3 +1,3 @@
 Fitting experimental spectra (basics)
 ---------------
-Usefull functions to upload experimental data and fit them with simple models.
\ No newline at end of file
+Usefull functions to upload experimental data and fit them with simple models.
diff --git a/examples/4_GPU/README.rst b/examples/4_GPU/README.rst
index 21e9dcff9..2269f53fb 100644
--- a/examples/4_GPU/README.rst
+++ b/examples/4_GPU/README.rst
@@ -1,3 +1,3 @@
 GPU calculations
 ---------------
-Unleash the power of your GPU to speed up your calculations.
\ No newline at end of file
+Unleash the power of your GPU to speed up your calculations.
diff --git a/examples/5_MatLab/README.rst b/examples/5_MatLab/README.rst
index 4df0d832a..914c5a6ae 100644
--- a/examples/5_MatLab/README.rst
+++ b/examples/5_MatLab/README.rst
@@ -4,4 +4,4 @@ RADIS can be accessed from Matlab by setting up Python environment in Matlab ::
 
     s = py.radis.calc_spectrum(1900,2300,molecule='CO',isotope='1,2,3',pressure=1.01325,Tgas=700,mole_fraction=0.1,path_length=1,databank='hitran');
     s.apply_slit(0.5,'nm');
-    s.plot(show=true);
\ No newline at end of file
+    s.plot(show=true);
diff --git a/examples/6_Misc/README.rst b/examples/6_Misc/README.rst
index cddabbc33..abcfd8684 100644
--- a/examples/6_Misc/README.rst
+++ b/examples/6_Misc/README.rst
@@ -1,3 +1,3 @@
 Miscellaneous
 ---------------
-Various other things that don't fit into the other categories.
\ No newline at end of file
+Various other things that don't fit into the other categories.
diff --git a/radis/db/classes.py b/radis/db/classes.py
index b8220d5c1..461f80114 100644
--- a/radis/db/classes.py
+++ b/radis/db/classes.py
@@ -311,6 +311,7 @@ def get_molecule(molecule_id):
     "C2",
     "C2H2",
     "C2H4",
+    "C3",
     "CH",
     "CH3",
     "CH3Cl",


Test patch:
diff --git a/radis/test/db/test_molecule_lists.py b/radis/test/db/test_molecule_lists.py
index 89c8a24b7..c6df13fd6 100644
--- a/radis/test/db/test_molecule_lists.py
+++ b/radis/test/db/test_molecule_lists.py
@@ -35,6 +35,7 @@ def fetch_ExoMol_molecules():
     return molecules
 
 
+
 @pytest.mark.fast  # this test fails as soon as ExoMol adds a new molecule (often!)
 @pytest.mark.needs_connection
 def test_ExoMol_molecules_list(verbose=True, *args, **kwargs):
@@ -93,8 +94,6 @@ def fetch_ExoMol_isotopes(verbose=True, *args, **kwargs):
 
 
 #%%
-
-
 def fetch_HITRAN_molecules():
 
     import re
@@ -116,6 +115,7 @@ def fetch_HITRAN_molecules():
     return molecules
 
 
+@pytest.mark.fast
 @pytest.mark.needs_connection
 def test_HITRAN_molecules_list(verbose=True, *args, **kwargs):
     """Test that HITRAN molecule list in RADIS remains up to date"""
diff --git a/radis/test/gpu/test_gpu.py b/radis/test/gpu/test_gpu.py
index eb8e0da29..5c3e093b0 100644
--- a/radis/test/gpu/test_gpu.py
+++ b/radis/test/gpu/test_gpu.py
@@ -18,6 +18,7 @@
 from radis.test.utils import getTestFile
 
 
+@pytest.mark.fast
 def test_eq_spectrum_emulated_gpu(
     backend="cpu-cuda", verbose=False, plot=False, *args, **kwargs
 ):
@@ -96,6 +97,7 @@ def test_eq_spectrum_gpu(plot=False, *args, **kwargs):
         test_eq_spectrum_emulated_gpu(backend="gpu-cuda", plot=plot, *args, **kwargs)
 
 
+@pytest.mark.fast
 def test_multiple_gpu_calls():
     from radis import SpectrumFactory
 
diff --git a/radis/test/test_phys.py b/radis/test/test_phys.py
index 17b8edbde..b2bff11d2 100644
--- a/radis/test/test_phys.py
+++ b/radis/test/test_phys.py
@@ -112,6 +112,7 @@ def test_convert(verbose=True, *args, **kwargs):
     return True
 
 
+@pytest.mark.fast
 def test_units(verbose=True, *args, **kwargs):
 
     # Test unit-ware arrays