diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index de9b1c6..b4d9e80 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -11,15 +11,31 @@ Those are the main contributing guidelines for contributing to this project: ## Get started -In order to contribute, the safest is to create your [own fork of spleeter](https://help.github.com/en/github/getting-started-with-github/fork-a-repo) first. The following set of commands will clone this new repository, create a virtual environment provisioned with the dependencies and run the tests (will take a few minutes): +This project is managed using [Poetry](https://python-poetry.org/docs/basic-usage/), +in order to contribute, the safest is to create your +[own fork of spleeter](https://help.github.com/en/github/getting-started-with-github/fork-a-repo) first and then setup your development environment: ```bash +# Clone spleeter repository fork git clone https://github.com//spleeter && cd spleeter -python -m venv spleeterenv && source spleeterenv/bin/activate -pip install -r requirements.txt && pip install pytest pytest-xdist -make test +# Install poetry +pip install poetry +# Install spleeter dependencies +poetry install +# Run unit test suite +poetry run pytest tests/ ``` You can then make your changes and experiment freely. Once you're done, remember to check that the tests still run. If you've added a new feature, add tests! Then finally, you're more than welcome to create a [Pull Request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork) in **Spleeter** main repo. We will look at it as soon as possible and eventually integrate your changes in the project. + +## PR requirements + +Following command should be ran successfully before to consider a PR for merging: + +```bash +poetry run pytest tests/ +poetry run black spleeter +poetry run isort spleeter +``` diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md index c2ec40e..235c595 100644 --- a/.github/ISSUE_TEMPLATE/bug.md +++ b/.github/ISSUE_TEMPLATE/bug.md @@ -5,10 +5,10 @@ title: "[Bug] name your bug" labels: bug, invalid --- - +- [ ] I didn't find a similar issue already open. +- [ ] I read the documentation (README AND Wiki) +- [ ] I have installed FFMpeg +- [ ] My problem is related to Spleeter only, not a derivative product (such as Webapplication, or GUI provided by others) ## Description diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index bdb95c9..c03d7e7 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,4 +1,6 @@ -# [Spleeter-XXXX] - pull request title +# Pull request title + +- [ ] I read [contributing guideline](.github/CONTRIBUTING.md) ## Description @@ -8,6 +10,10 @@ A few sentences describing the overall goals of the pull request's commits. You tested it, right? +- [ ] I implemented unit test whicn ran successfully using `poetry run pytest tests/` +- [ ] Code has been formatted using `poetry run black spleeter` +- [ ] Imports has been formatted using `poetry run isort spleeter`` + ## Documentation link and external references -Please provide any info that may help us better understand your code. +Please provide any info that may help us better understand your code. \ No newline at end of file diff --git a/poetry.lock b/poetry.lock index 0a003cc..33973ba 100644 --- a/poetry.lock +++ b/poetry.lock @@ -360,6 +360,21 @@ zipp = ">=0.5" docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] testing = ["pytest (>=3.5,!=3.7.3)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pytest-cov", "jaraco.test (>=3.2.0)", "packaging", "pep517", "pyfakefs", "flufl.flake8", "pytest-black (>=0.3.7)", "pytest-mypy", "importlib-resources (>=1.3)"] +[[package]] +name = "importlib-resources" +version = "4.1.1" +description = "Read resources from Python packages" +category = "main" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +zipp = {version = ">=0.4", markers = "python_version < \"3.8\""} + +[package.extras] +docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] +testing = ["pytest (>=3.5,!=3.7.3)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pytest-cov", "jaraco.test (>=3.2.0)", "pytest-black (>=0.3.7)", "pytest-mypy"] + [[package]] name = "iniconfig" version = "1.1.1" @@ -1151,7 +1166,7 @@ evaluation = ["musdb", "museval"] [metadata] lock-version = "1.1" python-versions = ">=3.6.1,<3.9" -content-hash = "428642b824d3b5804f1939efcb60aa0fe892ff4a5a11180c2e48d0cfbb3b21c3" +content-hash = "68d74d7fe62255b9aa3744c6d4612705f06649864c04209346c6da52e2234cd1" [metadata.files] absl-py = [ @@ -1398,6 +1413,10 @@ importlib-metadata = [ {file = "importlib_metadata-3.3.0-py3-none-any.whl", hash = "sha256:bf792d480abbd5eda85794e4afb09dd538393f7d6e6ffef6e9f03d2014cf9450"}, {file = "importlib_metadata-3.3.0.tar.gz", hash = "sha256:5c5a2720817414a6c41f0a49993908068243ae02c1635a228126519b509c8aed"}, ] +importlib-resources = [ + {file = "importlib_resources-4.1.1-py3-none-any.whl", hash = "sha256:0a948d0c8c3f9344de62997e3f73444dbba233b1eaf24352933c2d264b9e4182"}, + {file = "importlib_resources-4.1.1.tar.gz", hash = "sha256:6b45007a479c4ec21165ae3ffbe37faf35404e2041fac6ae1da684f38530ca73"}, +] iniconfig = [ {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"}, diff --git a/pyproject.toml b/pyproject.toml index e6c6c60..190c9cf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "spleeter" -version = "2.1.1" +version = "2.1.2" description = "The Deezer source separation library with pretrained models based on tensorflow." authors = ["Deezer Research "] license = "MIT License" @@ -55,6 +55,7 @@ museval = {version = "0.3.0", optional = true} tensorflow = "2.3.0" pandas = "1.1.2" numpy = "<1.19.0,>=1.16.0" +importlib-resources = {version = "^4.1.1", python = "<3.7"} [tool.poetry.dev-dependencies] pytest = "^6.2.1" diff --git a/spleeter/utils/configuration.py b/spleeter/utils/configuration.py index ba6318b..6a026b1 100644 --- a/spleeter/utils/configuration.py +++ b/spleeter/utils/configuration.py @@ -3,11 +3,17 @@ """ Module that provides configuration loading function. """ -import importlib.resources as loader import json from os.path import exists from typing import Dict +try: + import importlib.resources as loader +except ImportError: + # Try backported to PY<37 `importlib_resources`. + # pyright: reportMissingImports=false + import importlib_resources as loader + from .. import SpleeterError, resources __email__ = "spleeter@deezer.com"