diff --git a/.github/workflows/ci_test-base.yml b/.github/workflows/ci_test-base.yml index c5e591591eb..bef26244b70 100644 --- a/.github/workflows/ci_test-base.yml +++ b/.github/workflows/ci_test-base.yml @@ -49,7 +49,7 @@ jobs: uses: actions/cache@v2 with: path: ${{ steps.pip-cache.outputs.dir }} - key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }} + key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('tests/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip-py${{ matrix.python-version }}- @@ -57,7 +57,7 @@ jobs: run: | python -m pip install --upgrade --user pip pip install --requirement ./requirements.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html - pip install coverage pytest --quiet --upgrade-strategy only-if-needed + pip install "pytest>6.0" "pytest-cov>2.10" --upgrade-strategy only-if-needed python --version pip --version pip list @@ -66,7 +66,7 @@ jobs: - name: Test Package [only] run: | # NOTE: run coverage on tests does not propagare faler status for Win, https://github.com/nedbat/coveragepy/issues/1003 - coverage run --source torchmetrics -m pytest torchmetrics -v --junitxml=junit/test-results-${{ runner.os }}-${{ matrix.python-version }}.xml + python -m pytest torchmetrics -v --cov=torchmetrics --junitxml=junit/test-results-${{ runner.os }}-${{ matrix.python-version }}.xml - name: Upload pytest test results uses: actions/upload-artifact@v2 diff --git a/.github/workflows/ci_test-full.yml b/.github/workflows/ci_test-full.yml index fba4052272c..464be81b72b 100644 --- a/.github/workflows/ci_test-full.yml +++ b/.github/workflows/ci_test-full.yml @@ -68,7 +68,7 @@ jobs: uses: actions/cache@v2 with: path: ${{ steps.pip-cache.outputs.dir }} - key: ${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}-pip-${{ hashFiles('requirements.txt') }} + key: ${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}-pip-${{ hashFiles('requirements.txt') }}-${{ hashFiles('tests/requirements.txt') }} restore-keys: | ${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}-pip- diff --git a/.github/workflows/code-format.yml b/.github/workflows/code-format.yml index 2d3fe31d9e5..f926fdbb0e4 100644 --- a/.github/workflows/code-format.yml +++ b/.github/workflows/code-format.yml @@ -3,9 +3,9 @@ name: Check Code formatting # see: https://help.github.com/en/actions/reference/events-that-trigger-workflows on: # Trigger the workflow on push or pull request, but only for the master branch push: - branches: [master] + branches: [master, "release/*"] pull_request: - branches: [master] + branches: [master, "release/*"] jobs: flake8: @@ -18,7 +18,7 @@ jobs: - name: Install dependencies run: | pip install flake8 - pip --version + pip list shell: bash - name: PEP8 run: | @@ -33,8 +33,8 @@ jobs: python-version: 3.8 - name: Install isort run: | - pip install isort==5.6.4 - pip --version + pip install "isort==5.6.4" + pip list - name: isort run: | isort --settings-path=./pyproject.toml . --check --diff @@ -48,8 +48,23 @@ jobs: python-version: 3.8 - name: Install mypy run: | - pip install mypy + pip install "mypy==0.790" pip list - name: mypy run: | mypy + +# format-check-yapf: +# runs-on: ubuntu-20.04 +# steps: +# - uses: actions/checkout@master +# - uses: actions/setup-python@v2 +# with: +# python-version: 3.8 +# - name: Install dependencies +# run: | +# pip install "yapf==0.30" +# pip list +# shell: bash +# - name: yapf +# run: yapf --diff --parallel --recursive . diff --git a/Makefile b/Makefile index aeb867f96cd..b692a3996bc 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ clean: test: clean env # run tests with coverage - python -m coverage run --source torchmetrics -m pytest torchmetrics tests -v + python -m pytest torchmetrics tests -v --cov=torchmetrics python -m coverage report docs: clean diff --git a/README.md b/README.md index 2d51ba66b3f..37097597652 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ pip install torchmetrics ```
- Other installions + Other installations Install using conda ```bash @@ -69,7 +69,7 @@ pip install https://github.com/PyTorchLightning/metrics/archive/master.zip TorchMetrics is a collection of 25+ PyTorch metrics implementations and an easy-to-use API to create custom metrics. It offers: * A standardized interface to increase reproducibility -* Reduces Boilerplate +* Reduces boilerplate * Automatic accumulation over batches * Metrics optimized for distributed-training * Automatic synchronization between multiple devices @@ -243,8 +243,8 @@ to get help becoming a contributor! For help or questions, join our huge community on [Slack](https://join.slack.com/t/pytorch-lightning/shared_invite/zt-f6bl2l0l-JYMK3tbAgAmGRrlNr00f1A)! ## Citations -We’re excited to continue the strong legacy of opensource software and have been inspired over the years by -Caffee, Theano, Keras, PyTorch, torchbearer, ignite, sklearn and fast.ai. When/if a paper is written about this, +We’re excited to continue the strong legacy of open source software and have been inspired over the years by +Caffe, Theano, Keras, PyTorch, torchbearer, ignite, sklearn and fast.ai. When/if a paper is written about this, we’ll be happy to cite these frameworks and the corresponding authors. ## License diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7ed9ba6f7f2..e06f01e117b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -56,11 +56,29 @@ jobs: displayName: 'Sanity check' - bash: | - python -m coverage run --source torchmetrics -m pytest torchmetrics tests -v --durations=50 + python -m pytest torchmetrics tests -v --cov=torchmetrics --junitxml=$(Build.StagingDirectory)/test-results.xml --durations=50 displayName: 'Testing' - bash: | python -m coverage report - python -m coverage xml - python -m codecov --token=$(CODECOV_TOKEN) --flags=gpu,pytest --name="GPU-coverage" --env=linux,azure + python -m coverage xml -o '$(Build.SourcesDirectory)/coverage.xml' + python -m coverage html + python -m codecov --token=$(CODECOV_TOKEN) --commit=$(Build.SourceVersion) --flags=gpu,pytest --name="GPU-coverage" --env=linux,azure + ls -l displayName: 'Statistics' + + - task: PublishTestResults@2 + displayName: 'Publish test results' + inputs: + testResultsFiles: '$(Build.StagingDirectory)/test-results.xml' + testRunTitle: '$(Agent.OS) - $(Build.DefinitionName) - Python $(python.version)' + condition: succeededOrFailed() + + - task: PublishCodeCoverageResults@1 + displayName: 'Publish coverage report' + inputs: + codeCoverageTool: 'cobertura' + summaryFileLocation: '$(Build.SourcesDirectory)/coverage.xml' + reportDirectory: '$(Build.SourcesDirectory)/htmlcov' + testRunTitle: '$(Agent.OS) - $(Build.BuildNumber)[$(Agent.JobName)] - Python $(python.version)' + condition: succeededOrFailed() diff --git a/tests/requirements.txt b/tests/requirements.txt index 778eca0a62a..560e13b6294 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,14 +1,15 @@ -coverage>=5.2 +coverage>5.2 codecov>=2.1 pytest>=6.0 pytest-cov>2.10 -pytest-xdist +# pytest-xdist # pytest-flake8 flake8 check-manifest twine>=3.2 isort>=5.0 -mypy>=0.720 +mypy>=0.790 +yapf>=0.29.0 cloudpickle>=1.3 pytorch-lightning>=1.0