diff --git a/.github/workflows/build.yml b/.github/workflows/release.yml similarity index 58% rename from .github/workflows/build.yml rename to .github/workflows/release.yml index b74c6540..50362459 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/release.yml @@ -2,6 +2,10 @@ name: Deploy Main on: release: types: [published] + +env: + PYTHON_VERSION: "3.12" + jobs: deploy-pypi: runs-on: ubuntu-latest @@ -11,20 +15,22 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + fetch-depth: 1 + fetch-tags: true - name: Install Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: ${{ env.PYTHON_VERSION }} - - name: Install Twine and Build - run: sudo pip install twine build - - - name: Create the distribution + - name: Setup and build run: | - git fetch --prune --unshallow --tags - sudo python3 -m build + curl -LsSf https://astral.sh/uv/install.sh | sh + uv pip install --system --break-system-packages -r requirements.txt + uv pip install --system --break-system-packages twine build + python3 -m build - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 @@ -35,18 +41,20 @@ jobs: defaults: run: shell: bash -l {0} - environment: deployment steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + fetch-depth: 1 + fetch-tags: true - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: ${{ env.PYTHON_VERSION }} # Much better than manual installation, original version Miniconda2-4.7.10-Linux-x86_64.sh is broken - name: Install Miniconda - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v3 with: auto-activate-base: true activate-environment: "" @@ -57,9 +65,8 @@ jobs: conda config --set always_yes yes --set auto_update_conda false conda update conda conda install -n base conda-libmamba-solver - conda install python=3.10 conda-build colorama pip ruamel ruamel.yaml rich jsonschema -c conda-forge - git fetch --prune --unshallow --tags - pip install -e . + conda install python=${{ env.PYTHON_VERSION }} conda-build colorama pip ruamel ruamel.yaml rich jsonschema uv -c conda-forge + uv pip install -e . # echo yes before login to prevent anaconda bug breaking automation # git tags MUST be fetched otherwise output will be blank @@ -71,10 +78,11 @@ jobs: conda install anaconda-client conda config --set anaconda_upload no --set solver libmamba echo yes | anaconda login --username ${{ secrets.ANACONDA_CLOUD_USERNAME }} --password ${{ secrets.ANACONDA_CLOUD_PASSWORD }} - VERSION_FROM_GIT_TAG=$(git tag --list "v*[0-9]" --sort=version:refname | tail -1 | cut -c 2-) conda build . -c mosek -c anaconda -c pvlib -c slacgismo -c conda-forge -c stanfordcvxgrp - echo "gitversion=$(git tag --list "v*[0-9]" --sort=version:refname | tail -1 | cut -c 2-)" >> $GITHUB_OUTPUT + tag_ver=$(git tag --list "v*[0-9]" --sort=version:refname | tail -1 | cut -c 2-) + echo "gitversion=${tag_ver}" >> $GITHUB_OUTPUT + VERSION_FROM_GIT_TAG="${tag_ver}" conda build . -c mosek -c anaconda -c pvlib -c slacgismo -c conda-forge -c stanfordcvxgrp - name: Upload the Anaconda Package id: condaload run: | - anaconda upload -u slacgismo /usr/share/miniconda3/conda-bld/noarch/solar-data-tools-${{ steps.condabuild.outputs.gitversion }}-*.tar.bz2 + anaconda upload -u slacgismo /usr/share/miniconda3/conda-bld/noarch/solar-data-tools-${{ steps.condabuild.outputs.gitversion }}-*.tar.bz2 diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index a09d3b58..ccdd31a8 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -6,40 +6,50 @@ on: jobs: build-pypi: runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10", "3.11", "3.12"] steps: - name: Checkout Repository - uses: actions/checkout@v3 - - - uses: actions/setup-python@v4 + uses: actions/checkout@v4 with: - python-version: "3.10" + fetch-depth: 1 + fetch-tags: true - - name: Install Twine and Build - run: sudo pip install twine build + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} - - name: Create the distribution + - name: Setup and build run: | - git fetch --prune --unshallow --tags - sudo python3 -m build - + curl -LsSf https://astral.sh/uv/install.sh | sh + uv pip install --system --break-system-packages -r requirements.txt + uv pip install --system --break-system-packages twine build + python3 -m build build-conda: runs-on: ubuntu-latest # sets default shell to remove need for source to run the conda shell + strategy: + matrix: + python-version: ["3.10", "3.11", "3.12"] defaults: run: shell: bash -l {0} environment: test-deployment steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + fetch-depth: 1 + fetch-tags: true - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: ${{ matrix.python-version }} # Much better than manual installation, original version Miniconda2-4.7.10-Linux-x86_64.sh is broken - name: Install Miniconda - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v3 with: auto-activate-base: true activate-environment: "" @@ -50,9 +60,8 @@ jobs: conda config --set always_yes yes --set auto_update_conda false conda update conda conda install -n base conda-libmamba-solver - conda install python=3.10 conda-build colorama pip ruamel ruamel.yaml rich jsonschema -c conda-forge - git fetch --prune --unshallow --tags - pip install -e . + conda install python=${{matrix.python-version}} conda-build colorama pip ruamel ruamel.yaml rich jsonschema uv -c conda-forge + uv pip install -e . # echo yes before login to prevent anaconda bug breaking automation # git tags MUST be fetched otherwise output will be blank @@ -63,5 +72,6 @@ jobs: run: | conda install anaconda-client conda config --set anaconda_upload no --set solver libmamba - VERSION_FROM_GIT_TAG=$(git tag --list "v*[0-9]" --sort=version:refname | tail -1 | cut -c 2-)test conda build . -c mosek -c anaconda -c pvlib -c slacgismo -c conda-forge -c stanfordcvxgrp - echo "gitversion=$(git tag --list "v*[0-9]" --sort=version:refname | tail -1 | cut -c 2-)" >> $GITHUB_OUTPUT + tag_ver=$(git tag --list "v*[0-9]" --sort=version:refname | tail -1 | cut -c 2-) + echo "gitversion=${tag_ver}" >> $GITHUB_OUTPUT + VERSION_FROM_GIT_TAG="${tag_ver}test" conda build . -c mosek -c anaconda -c pvlib -c slacgismo -c conda-forge -c stanfordcvxgrp diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index acce5898..10c5e9e6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,25 +1,17 @@ repos: -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 hooks: - - id: trailing-whitespace - - id: end-of-file-fixer - - id: check-added-large-files -- repo: https://github.com/psf/black - rev: 22.3.0 + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-added-large-files + - id: check-yaml + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.4.2 hooks: - - id: black -#- repo: https://github.com/pycqa/flake8 -# rev: '' # pick a git hash / tag to point to -# hooks: -# - id: flake8 -# args: # arguments to configure flake8 -# # making isort line length compatible with black -# - "--max-line-length=88" -# - "--max-complexity=18" -# - "--select=B,C,E,F,W,T4,B9" -# -# # these are errors that will be ignored by flake8 -# # check out their meaning here -# # https://flake8.pycqa.org/en/latest/user/error-codes.html -# - "--ignore=E203,E266,E501,W503,F403,F401,E402,C901,E741,F811,F841,E722" + - id: ruff + types_or: [python, pyi, jupyter] + verbose: true + args: [--exit-zero] + - id: ruff-format + types_or: [python, pyi, jupyter] diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..12901f99 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.analysis.typeCheckingMode": "basic" +} diff --git a/pyproject.toml b/pyproject.toml index bbd511da..be927ae7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -71,4 +71,4 @@ mosek = [ Homepage = "https://github.com/slacgismo/solar-data-tools" Documentation = "https://solar-data-tools.readthedocs.io/" "Bug Tracker" = "https://github.com/slacgismo/solar-data-tools/issues" -Discussions = "https://github.com/slacgismo/solar-data-tools/discussions" \ No newline at end of file +Discussions = "https://github.com/slacgismo/solar-data-tools/discussions"