diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e6424df8..0459ec35 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,31 +7,30 @@ on: [push, pull_request] jobs: build: - runs-on: ubuntu-latest strategy: matrix: python-version: [3.6, 3.7, 3.8] steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - - name: Install linting dependencies - run: | - python -m pip install --upgrade pip - pip install flake8 isort==4.3.21 yapf - - name: Lint with flake8 - run: flake8 --max-complexity 20 . - - name: Lint with isort - run: isort -rc --check-only --diff pycocotools/ lvis/ - - name: Format with yapf - run: yapf -r -d pycocotools/ lvis/ - - name: Install python dependencies - run: pip install numpy - - name: Build and install pycocotools - run: cd pycocotools && rm -rf *.eggs-info && pip install . - - name: Build and install lvis - run: cd lvis && rm -rf *.eggs-info && pip install . + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Install linting dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 isort==4.3.21 yapf + - name: Lint with flake8 + run: flake8 --max-complexity 20 . + - name: Lint with isort + run: isort -rc --check-only --diff pycocotools/ lvis/ + - name: Format with yapf + run: yapf -r -d pycocotools/ lvis/ + - name: Install python dependencies + run: pip install numpy + - name: Build and install pycocotools + run: cd pycocotools && rm -rf *.eggs-info && pip install . + - name: Build and install lvis + run: cd lvis && rm -rf *.eggs-info && pip install . diff --git a/pycocotools/setup.py b/pycocotools/setup.py index 1a81fd95..e7cb07eb 100644 --- a/pycocotools/setup.py +++ b/pycocotools/setup.py @@ -1,4 +1,4 @@ -import numpy as np +from setuptools import dist # Install numpy and cython at start from setuptools import Extension, setup # To compile and install locally run "python setup.py build_ext --inplace" @@ -8,6 +8,13 @@ # the Visual C++ 2015 build tools. # They can safely be removed. +dist.Distribution().fetch_build_eggs(['cython>=0.27.3', 'numpy']) + +try: + import numpy as np +except ImportError: + exit('Please install numpy first.') + ext_modules = [ Extension( 'pycocotools._mask', @@ -24,5 +31,5 @@ install_requires=[ 'setuptools>=18.0', 'cython>=0.27.3', 'matplotlib>=2.1.0' ], - version='12.0.3', + version='12.0.4', ext_modules=ext_modules)