Repository: CDSETool/CDSETool (language: python)

Issue:
Add type annotations
Add a pyright config section to pyproject.toml, type annotations to many methods/functions, and a py.typed marker so clients to the library can use the types when type checking their code.

Added some string quotes to a couple of tests to please the type checker, and changed some code to make it easier for the type checker to figure out what is going on.


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 279e439..55cc2f4 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -15,15 +15,32 @@ jobs:
       matrix:
         python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
     steps:
-    - uses: actions/checkout@v4
-    - name: Set up Python ${{ matrix.python-version }}
-      uses: actions/setup-python@v5
-      with:
-        python-version: ${{ matrix.python-version }}
-    - name: Install dependencies
-      run: |
-        python -m pip install --upgrade pip
-        pip install .[test]
-    - name: Analysing the code with pylint
-      run: |
-        pylint $(git ls-files 'src/*.py')
+      - uses: actions/checkout@v4
+      - name: Set up Python ${{ matrix.python-version }}
+        uses: actions/setup-python@v5
+        with:
+          python-version: ${{ matrix.python-version }}
+      - name: Install dependencies
+        run: |
+          python -m pip install --upgrade pip
+          pip install .[test]
+      - name: Analysing the code with pylint
+        run: |
+          pylint $(git ls-files 'src/*.py')
+
+  pyright:
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
+    steps:
+      - uses: actions/checkout@v4
+      - name: Set up Python ${{ matrix.python-version }}
+        uses: actions/setup-python@v5
+        with:
+          python-version: ${{ matrix.python-version }}
+      - name: Install dependencies
+        run: |
+          python -m pip install --upgrade pip
+          pip install -e .[test]
+      - uses: jakebailey/pyright-action@v2


Test patch:
diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml
index e093ac2..fc0f24f 100644
--- a/.github/workflows/pytest.yml
+++ b/.github/workflows/pytest.yml
@@ -27,7 +27,7 @@ jobs:
     - name: Install dependencies
       run: |
         python -m pip install --upgrade pip
-        pip install -e .[test,shape]
+        pip install -e .[test]
     - name: Test with pytest
       run: |
         pytest --cov=cdsetool --cov-report xml