diff --git a/.github/workflows/python-lint-tests.yml b/.github/workflows/python-lint-tests.yml index caa254f..e8713c4 100644 --- a/.github/workflows/python-lint-tests.yml +++ b/.github/workflows/python-lint-tests.yml @@ -11,50 +11,11 @@ on: - release/* jobs: - - ########### - # LINTING # - ########### - linting: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.9 - # Cache pip - - uses: actions/cache@v2 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip - restore-keys: ${{ runner.os }}-pip - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install . - python -m pip install mypy black isort - - name: Python Code Quality and Lint - uses: abey79/python-lint@master - with: - python-root-list: "pnoise tests" - use-pylint: false - use-pycodestyle: false - use-flake8: false - use-black: true - extra-black-options: --diff - use-mypy: true - use-isort: true - - ######### - # TESTS # - ######### - tests: - needs: linting + lint-and-tests: strategy: fail-fast: true matrix: - python-version: [3.7, 3.8, 3.9] + python-version: [3.6, 3.7, 3.8, 3.9, "3.10"] os: [ubuntu-latest, macos-latest, windows-latest] defaults: run: @@ -63,14 +24,23 @@ jobs: steps: - uses: actions/checkout@v2 + name: Checkout code + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} + - name: Install dependencies run: | pip install . pip install -r dev-requirements.txt + + - name: Lint + run: | + black --check --diff pnoise tests + isort --check --diff pnoise tests + - name: Pytest run: | pytest diff --git a/.gitignore b/.gitignore index b6e4761..8690c8f 100644 --- a/.gitignore +++ b/.gitignore @@ -105,7 +105,7 @@ celerybeat.pid .env .venv env/ -venv/ +venv*/ ENV/ env.bak/ venv.bak/ diff --git a/pnoise/__init__.py b/pnoise/__init__.py index d988735..701eeca 100644 --- a/pnoise/__init__.py +++ b/pnoise/__init__.py @@ -2,9 +2,12 @@ def _get_version() -> str: - import pkg_resources + try: + from importlib.metadata import version + except ModuleNotFoundError: + from importlib_metadata import version - return pkg_resources.get_distribution("pnoise").version + return version(__name__) __version__ = _get_version() diff --git a/setup.py b/setup.py index 4e4fc9f..25df51f 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ python_requires=">=3.6", install_requires=[ "numpy>=1.19", - "setuptools", + "importlib_metadata;python_version<'3.8'", ], classifiers=[ "License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)",