diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 2b59cd2f57..155b27add4 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -28,10 +28,10 @@ jobs: name: Check for syntax errors runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ env.LATEST_SUPPORTED_PYTHON_VERSION }} @@ -50,9 +50,9 @@ jobs: name: Check RST syntax runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 name: Set up python with: python-version: ${{ env.LATEST_SUPPORTED_PYTHON_VERSION }} @@ -75,7 +75,7 @@ jobs: python-version: [3.8, 3.9, "3.10", "3.11", "3.12"] os: [windows-latest, macos-13] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # Fetch complete history for accurate versioning @@ -127,13 +127,13 @@ jobs: run: make test - name: Upload wheel artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Wheel for ${{ matrix.os }} ${{ matrix.python-version }} path: dist - name: Upload conda env artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 continue-on-error: true with: name: Conda Env for ${{ matrix.os }} ${{ matrix.python-version }} @@ -141,13 +141,13 @@ jobs: - name: Authenticate GCP if: github.event_name != 'pull_request' - uses: google-github-actions/auth@v0 + uses: google-github-actions/auth@v2 with: credentials_json: ${{ secrets.GOOGLE_SERVICE_ACC_KEY }} - name: Set up GCP if: github.event_name != 'pull_request' - uses: google-github-actions/setup-gcloud@v0 + uses: google-github-actions/setup-gcloud@v2 - name: Deploy artifacts to GCS if: github.event_name != 'pull_request' @@ -162,7 +162,7 @@ jobs: python-version: [3.8, 3.9, "3.10", "3.11", "3.12"] os: [windows-latest, macos-13] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # Fetch complete history for accurate versioning @@ -196,9 +196,9 @@ jobs: - name: Check long description with twine run: twine check $(find dist -name "natcap[._-]invest*") - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: - name: Source distribution + name: Source distribution ${{ matrix.os }} ${{ matrix.python-version }} path: dist # Secrets not available in PR so don't use GCP. @@ -207,13 +207,13 @@ jobs: # different extensions) - name: Authenticate GCP if: github.event_name != 'pull_request' && matrix.os == 'macos-13' && matrix.python-version == env.LATEST_SUPPORTED_PYTHON_VERSION - uses: google-github-actions/auth@v0 + uses: google-github-actions/auth@v2 with: credentials_json: ${{ secrets.GOOGLE_SERVICE_ACC_KEY }} - name: Set up GCP if: github.event_name != 'pull_request' && matrix.os == 'macos-13' && matrix.python-version == env.LATEST_SUPPORTED_PYTHON_VERSION - uses: google-github-actions/setup-gcloud@v0 + uses: google-github-actions/setup-gcloud@v2 - name: Deploy artifacts to GCS if: github.event_name != 'pull_request' && matrix.os == 'macos-13' && matrix.python-version == env.LATEST_SUPPORTED_PYTHON_VERSION @@ -224,7 +224,7 @@ jobs: runs-on: windows-latest needs: check-syntax-errors steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # Fetch complete history for accurate versioning @@ -255,7 +255,7 @@ jobs: steps: - name: Check out repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 # Fetch complete history for accurate versioning @@ -312,7 +312,7 @@ jobs: workspace-path: ${{ github.workspace }} binary-extension: exe steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # Fetch complete history for accurate versioning @@ -369,13 +369,13 @@ jobs: - name: Authenticate GCP if: github.event_name != 'pull_request' - uses: google-github-actions/auth@v0 + uses: google-github-actions/auth@v2 with: credentials_json: ${{ secrets.GOOGLE_SERVICE_ACC_KEY }} - name: Set up GCP if: github.event_name != 'pull_request' - uses: google-github-actions/setup-gcloud@v0 + uses: google-github-actions/setup-gcloud@v2 - name: Build Workbench (PRs) if: github.event_name == 'pull_request' @@ -444,20 +444,20 @@ jobs: - name: Upload workbench binary artifact if: always() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Workbench-${{ runner.os }}-binary path: workbench/dist/*.${{ matrix.binary-extension }} - name: Upload user's guide artifact (Windows) if: matrix.os == 'windows-latest' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: InVEST-user-guide path: dist/InVEST_*_userguide.zip - name: Upload workbench logging from puppeteer - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() with: name: ${{ runner.os }}_puppeteer_log.zip' @@ -476,7 +476,7 @@ jobs: - name: Upload workspace on failure if: ${{ failure() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: InVEST-failed-${{ runner.os }}-workspace path: ${{ matrix.workspace-path}} @@ -486,11 +486,11 @@ jobs: needs: check-syntax-errors runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # Fetch complete history for accurate versioning - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: ${{ env.LATEST_SUPPORTED_PYTHON_VERSION }} @@ -501,20 +501,20 @@ jobs: - run: make sampledata sampledata_single - name: Upload sample data artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: InVEST-sample-data path: dist/*.zip - name: Authenticate GCP if: github.event_name != 'pull_request' - uses: google-github-actions/auth@v0 + uses: google-github-actions/auth@v2 with: credentials_json: ${{ secrets.GOOGLE_SERVICE_ACC_KEY }} - name: Set up GCP if: github.event_name != 'pull_request' - uses: google-github-actions/setup-gcloud@v0 + uses: google-github-actions/setup-gcloud@v2 - name: Deploy artifacts to GCS if: github.event_name != 'pull_request' diff --git a/constraints_tests.txt b/constraints_tests.txt index 447311d585..299273430e 100644 --- a/constraints_tests.txt +++ b/constraints_tests.txt @@ -12,4 +12,4 @@ GDAL<3.8.5 # Pyinstaller 6.10 breaks our windows builds. Until we can figure out the # root cause, let's cap the versions to those that work. # https://github.com/natcap/invest/issues/1622 -pyinstaller<6.10 +#pyinstaller<6.10 diff --git a/exe/hooks/rthook.py b/exe/hooks/rthook.py index 53a9af14b6..ec0b3264a8 100644 --- a/exe/hooks/rthook.py +++ b/exe/hooks/rthook.py @@ -1,9 +1,6 @@ -import sys import os -import multiprocessing import platform - -multiprocessing.freeze_support() +import sys os.environ['PROJ_LIB'] = os.path.join(sys._MEIPASS, 'proj') diff --git a/src/natcap/invest/__main__.py b/src/natcap/invest/__main__.py index 1f68c51913..167e0fc170 100644 --- a/src/natcap/invest/__main__.py +++ b/src/natcap/invest/__main__.py @@ -1,5 +1,11 @@ +import multiprocessing import sys +# We want to guarantee that this is called BEFORE any other processes start, +# which could happen at import time. +if __name__ == '__main__': + multiprocessing.freeze_support() + from . import cli if __name__ == '__main__':