From 0eabe63c58a5763aa6b8a3188f93e5219fdf75fb Mon Sep 17 00:00:00 2001 From: Anthony Corletti Date: Thu, 8 Jun 2023 16:37:28 -0400 Subject: [PATCH 1/6] chore: faster build install --- .coveragerc | 10 -- .flake8 | 7 - .github/workflows/docs.yaml | 27 +-- .github/workflows/publish.yaml | 31 +++- .github/workflows/test.yaml | 29 ++-- CONTRIBUTING.md | 35 ++-- dataquality/py.typed | 0 mypy.ini | 3 - pyproject.toml | 135 ++++++++++++--- pytest.ini | 3 - scripts/bump-version.sh | 7 - scripts/clean.sh | 9 - scripts/coverage-html-test-report.sh | 3 - scripts/docs-build.sh | 7 - scripts/format.sh | 8 - scripts/install.sh | 6 - scripts/lint.sh | 6 - scripts/publish.sh | 4 - scripts/set-local-env.sh | 3 - scripts/test.sh | 7 - setup.cfg | 16 ++ setup.py | 3 + tasks.py | 240 +++++++++++++++++++++++++++ 23 files changed, 442 insertions(+), 157 deletions(-) delete mode 100644 .coveragerc delete mode 100644 .flake8 create mode 100644 dataquality/py.typed delete mode 100644 mypy.ini delete mode 100644 pytest.ini delete mode 100755 scripts/bump-version.sh delete mode 100755 scripts/clean.sh delete mode 100755 scripts/coverage-html-test-report.sh delete mode 100755 scripts/docs-build.sh delete mode 100755 scripts/format.sh delete mode 100755 scripts/install.sh delete mode 100755 scripts/lint.sh delete mode 100755 scripts/publish.sh delete mode 100755 scripts/set-local-env.sh delete mode 100755 scripts/test.sh create mode 100644 setup.cfg create mode 100644 setup.py create mode 100644 tasks.py diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index 53bf4ff99..000000000 --- a/.coveragerc +++ /dev/null @@ -1,10 +0,0 @@ -[run] -source = - dataquality - tests - -omit = - *__init__.py - *metrics.py - -parallel = True diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 58e87e0c9..000000000 --- a/.flake8 +++ /dev/null @@ -1,7 +0,0 @@ -[flake8] -max-line-length = 88 -extend-ignore = E203,D10,D415 -docstring-convention = rest -exclude = tests/qa -per-file-ignores = - tests/utils/spacy_integration_constants.py: E501 diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index cd7655d09..ef433c073 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -5,12 +5,10 @@ on: branches: - main -env: - GALILEO_API_URL: "http://localhost:8000" - jobs: test: runs-on: ubuntu-latest + strategy: matrix: python-version: [3.8] @@ -18,21 +16,30 @@ jobs: steps: - uses: actions/checkout@v3 + - name: set up python uses: actions/setup-python@v4 with: + cache: "pip" + cache-dependency-path: "pyproject.toml" python-version: ${{ matrix.python-version }} + + - name: install invoke + run: pip install invoke + - name: install dependencies - run: scripts/install.sh + run: inv install + - name: docs - run: scripts/docs-build.sh + run: inv docs-build + - name: Pushes to another repository uses: cpina/github-action-push-to-another-repository@main env: API_TOKEN_GITHUB: ${{ secrets.GH_TOKEN }} with: - source-directory: 'docs/autodocs/_build/markdown' - target-directory: 'autodocs' - destination-github-username: 'rungalileo' - destination-repository-name: 'docs' - user-email: team@rungalileo.io \ No newline at end of file + source-directory: "docs/autodocs/_build/markdown" + target-directory: "autodocs" + destination-github-username: "rungalileo" + destination-repository-name: "docs" + user-email: team@rungalileo.io diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 3fbf18f85..ec86edd6f 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -6,22 +6,37 @@ on: - created jobs: - publish: + main: runs-on: ubuntu-latest + + strategy: + matrix: + python-version: ["3.9"] + steps: - name: checkout uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: apt-get update + run: sudo apt-get update -y - name: set up python uses: actions/setup-python@v4 with: - python-version: "3.9" + python-version: ${{ matrix.python-version }} + cache: "pip" + cache-dependency-path: "pyproject.toml" + + - name: install invoke + run: pip install invoke - - name: install flit - run: pip install flit + - name: build + run: inv build - - name: publish to pypi + - name: publish env: - FLIT_USERNAME: ${{ secrets.FLIT_USERNAME }} - FLIT_PASSWORD: ${{ secrets.FLIT_PASSWORD }} - run: scripts/publish.sh + TWINE_USERNAME: ${{ secrets.FLIT_USERNAME }} + TWINE_PASSWORD: ${{ secrets.FLIT_PASSWORD }} + run: inv publish diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 72c3c8f4f..60940d2de 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -7,32 +7,39 @@ on: pull_request: types: [opened, synchronize] -env: - GALILEO_API_URL: "http://localhost:8000" - jobs: test: runs-on: galileo + strategy: matrix: - python-version: [3.7, 3.8, 3.9] + python-version: ["3.7", "3.8", "3.9"] fail-fast: false steps: - uses: actions/checkout@v3 + - name: set up python uses: actions/setup-python@v4 with: + cache: "pip" + cache-dependency-path: "pyproject.toml" python-version: ${{ matrix.python-version }} + + - name: install invoke + run: pip install invoke + - name: install dependencies - run: | - if [[ ${{ matrix.python-version }} == "3.7" ]]; then - scripts/install.sh --extras=py37 - else - scripts/install.sh - fi + if: matrix.python-version != "3.7" + run: inv install + + - name: install dependencies (python 3.7) + if: matrix.python-version == "3.7" + run: inv install -e dev,test,doc,py37 + - name: test - run: scripts/test.sh + run: inv test + - name: upload coverage uses: codecov/codecov-action@v1 with: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index afa784ae6..500002844 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -28,33 +28,26 @@ $ which python pip ## Flit -This project uses `flit` to manage our project's dependencies. +This project uses `setuptools` to manage our project's dependencies and `invoke` for running tasks. -After activating the environment as described above, install flit: +After activating the environment as described above, install `invoke` and setup your local environment: ```sh -$ pip install flit -``` - -Install dependencies - -```sh -./scripts/install.sh +pip install --upgrade pip +pip install invoke +inv all ``` ## Development -Developing with Flit is simple. Symlink this repo to your venv so you can make changes -and test them without reinstalling the package. -Run the following from the root of dataquality: +To install a development version of the package in another python environment, simply use that virtual enviroment's pip: + ```sh -flit install -s +pip install -e . ``` -You can specify which python environment to install into using the `--python` flag -(useful for developing/testing from external venvs) - ### Debugging + If you're looking to debug some code in dataquality, for example with `pdb` in jupyter, you can do that easily: 1. Install and symlink `dataquality` as shown above @@ -66,7 +59,7 @@ you can do that easily: ## Formatting ```sh -./scripts/format.sh +inv format ``` ## Tests @@ -76,13 +69,13 @@ You will need to have a local cluster running, read our [API documentation](http Set some local env variables ``` -. ./scripts/set-local-env.sh +GALILEO_CONSOLE_URL="http://localhost:3000" ``` Now run your tests! ```sh -./scripts/test-cov-html.sh +inv test ``` @@ -91,7 +84,7 @@ Now run your tests! Run this from this project's root directory to boot up tests. ``` -. ./scripts/set-local-env.sh; jupyter notebook docs/ +GALILEO_CONSOLE_URL="http://localhost:3000" jupyter notebook docs/ ``` @@ -100,7 +93,7 @@ Run this from this project's root directory to boot up tests. Everything is done through github actions. Make sure to bump the version of the package ``` -./scripts/bump-version.sh +inv update-version-number ``` commit the change and publish a new version. diff --git a/dataquality/py.typed b/dataquality/py.typed new file mode 100644 index 000000000..e69de29bb diff --git a/mypy.ini b/mypy.ini deleted file mode 100644 index 056621a4c..000000000 --- a/mypy.ini +++ /dev/null @@ -1,3 +0,0 @@ -[mypy] -ignore_missing_imports = True -disallow_untyped_defs = True diff --git a/pyproject.toml b/pyproject.toml index d94c51788..458507268 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,16 +1,18 @@ [build-system] -requires = ["flit_core >=2,<3"] -build-backend = "flit_core.buildapi" - -[tool.flit.metadata] -module = "dataquality" -author = "Galileo Technologies, Inc" -author-email = "team@rungalileo.io" -home-page = "https://www.github.com/rungalileo/dataquality" -description-file = "README.md" -requires-python = ">=3.7" requires = [ + "setuptools>=65.0", + "wheel>=0.37", +] +build-backend = "setuptools.build_meta" + +[project] +name = "dataquality" +dynamic = ["version"] +readme = "README.md" +license = {text = 'See LICENSE'} +requires-python = ">=3.7" +dependencies = [ "pydantic>=1.8.2", "requests>=2.25.1", "types-requests>=2.25.2", @@ -37,14 +39,18 @@ requires = [ "evaluate", "accelerate", ] +[[project.authors]] +name = "Galileo Technologies, Inc." +email = "devs+dq@rungalileo.io" -[tool.flit.scripts] +[project.scripts] dqyolo = "dataquality.dqyolo:main" -[tool.flit.metadata.urls] +[project.urls] +Homepage = "https://github.com/rungalileo/dataquality" Documentation = "https://rungalileo.gitbook.io/galileo" -[tool.flit.metadata.requires-extra] +[project.optional-dependencies] doc = [ "furo", "sphinx", @@ -58,7 +64,7 @@ test = [ "ultralytics", "pytest>=7.2.1", "freezegun>=1.2.2", - "coverage>=7.0.5", + "coverage[toml]>=7.0.5", "pytest-cov>=4.0.0", "scikit-learn>=1.0", "tensorflow>=2.9.1", @@ -83,14 +89,13 @@ test = [ ] dev = [ "mypy>=1.0.0", - "flake8", + "ruff>=0.0.98", "black>=23.1.0", - "isort>=5.11.5", - "autoflake", "jupyter==1.0.0", + "invoke>=1.6.0", ] - -# Need to be installed with `pip install 'dataquality[cuda]' --extra-index-url=https://pypi.nvidia.com/ ` +# Install this by adding the --extra-index-url option as shown below +# `pip install 'dataquality[cuda]' --extra-index-url=https://pypi.nvidia.com/ ` cuda = [ "ucx-py-cu11<=0.30", "rmm-cu11==23.2.0", @@ -100,22 +105,104 @@ cuda = [ "cudf-cu11==23.2.0", "cuml-cu11==23.2.0" ] - minio = [ "minio>=7.1.0,<7.2.0" ] - py37 = [ "cachetools>=5.2.0", "types-cachetools>=5.3.0.0", "importlib-metadata<5.0.0", "timm<=0.6.13", ] - setfit = [ "setfit" ] -[tool.isort] -profile = "black" +[tool.setuptools.dynamic] +version = {attr = "dataquality.__version__"} + +[tool.pytest.ini_options] +env = [ + "GALILEO_API_URL=http://localhost:8000" +] +addopts = [ + "-n", + "auto", + "-o", + "console_output_style=progress", + "--durations=10", + "--disable-warnings", + "--cov=dataquality", + "--cov=tests", + "--cov-report=term-missing", + "--cov-report=xml", + "--cov-report=html", +] + +[tool.coverage.run] +parallel = true +source = [ + "dataquality/", + "tests/" +] +omit = [ + "*__init__.py", + "*metrics.py", +] + +[tool.coverage.report] +exclude_lines = [ + 'pragma: no cover', + 'raise NotImplementedError' +] + +[tool.coverage.html] +directory = "htmlcov" + +[tool.coverage.xml] +output = "coverage.xml" + +[tool.mypy] +ignore_missing_imports = true +disallow_untyped_defs = true + +[tool.ruff] +line-length = 88 +ignore = ["D10"] +include = ["*.py"] +select = ["E", "F", "I"] +target-version = "py310" +extend-ignore = [ + "D203", + "D204", + "D213", + "D215", + "D400", + "D404", + "D406", + "D407", + "D408", + "D409", + "D413", + "D415", + "E731", +] + +[tool.black] +target-version = ['py310'] +include = '\.pyi?$' +exclude = ''' +/( + \.eggs + | \.git + | \.hg + | \.*_cache + | \.tox + | \.venv + | build + | dist + | __pycache__ +)/ +''' + diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 24e342659..000000000 --- a/pytest.ini +++ /dev/null @@ -1,3 +0,0 @@ -[pytest] -env = - GALILEO_CONSOLE_URL=http://localhost:3000 diff --git a/scripts/bump-version.sh b/scripts/bump-version.sh deleted file mode 100755 index 67032cad5..000000000 --- a/scripts/bump-version.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -e - -current_version=$(python -c "import dataquality; print(dataquality.__version__)") -echo "current version: $current_version" -read -p "new version: " new_version - -sed -i '' -e "s/$current_version/$new_version/g" dataquality/__init__.py diff --git a/scripts/clean.sh b/scripts/clean.sh deleted file mode 100755 index ef547541b..000000000 --- a/scripts/clean.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -ex - -if [ -d 'dist' ] ; then - rm -r dist -fi - -if [ -d 'site' ] ; then - rm -r site -fi diff --git a/scripts/coverage-html-test-report.sh b/scripts/coverage-html-test-report.sh deleted file mode 100755 index 1d8435e47..000000000 --- a/scripts/coverage-html-test-report.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -ex - -./scripts/test.sh --cov-report=html ${@} diff --git a/scripts/docs-build.sh b/scripts/docs-build.sh deleted file mode 100755 index 28efe82cc..000000000 --- a/scripts/docs-build.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -ex - -cd docs/autodocs - -make markdown - -cd .. \ No newline at end of file diff --git a/scripts/format.sh b/scripts/format.sh deleted file mode 100755 index e70a09e37..000000000 --- a/scripts/format.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -ex - -# Sort imports one per line, so autoflake can remove unused imports -isort --force-single-line-imports dataquality tests - -autoflake --remove-all-unused-imports --recursive --remove-unused-variables --in-place dataquality tests --exclude=__init__.py -black dataquality tests -isort dataquality tests diff --git a/scripts/install.sh b/scripts/install.sh deleted file mode 100755 index a7dd5a71e..000000000 --- a/scripts/install.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -ex - -pip install --upgrade pip -pip install flit - -flit install --deps=develop --symlink $@ diff --git a/scripts/lint.sh b/scripts/lint.sh deleted file mode 100755 index 2d648fcef..000000000 --- a/scripts/lint.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -ex - -mypy dataquality -flake8 dataquality tests -black dataquality tests --check -isort dataquality tests --check-only diff --git a/scripts/publish.sh b/scripts/publish.sh deleted file mode 100755 index 9a2b8f9a8..000000000 --- a/scripts/publish.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -ex - -flit publish - diff --git a/scripts/set-local-env.sh b/scripts/set-local-env.sh deleted file mode 100755 index bb0dd3a1e..000000000 --- a/scripts/set-local-env.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -ex - -export GALILEO_CONSOLE_URL="http://localhost:3000" diff --git a/scripts/test.sh b/scripts/test.sh deleted file mode 100755 index c7a22f408..000000000 --- a/scripts/test.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -ex - -. ./scripts/set-local-env.sh - -./scripts/lint.sh - -pytest --cov=dataquality --cov=tests --cov-report=term-missing -n auto --cov-report=xml --durations=10 -o console_output_style=progress --disable-warnings ${@} diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 000000000..93a1d39ab --- /dev/null +++ b/setup.cfg @@ -0,0 +1,16 @@ +[metadata] +license = MIT +long_description = file: README.md +long_description_content_type = text/markdown + +[options] +packages = find: +include_package_data = True + +[options.packages.find] +exclude = + tests + +[options.package_data] +dataquality = + py.typed diff --git a/setup.py b/setup.py new file mode 100644 index 000000000..606849326 --- /dev/null +++ b/setup.py @@ -0,0 +1,3 @@ +from setuptools import setup + +setup() diff --git a/tasks.py b/tasks.py new file mode 100644 index 000000000..e10475001 --- /dev/null +++ b/tasks.py @@ -0,0 +1,240 @@ +from enum import Enum, unique +from typing import List, Optional + +from invoke import task +from invoke.context import Context + +PACKAGE_NAME = "dataquality" +VERSION_FILE = f"{PACKAGE_NAME}/__init__.py" +SOURCES = " ".join(["dataquality", "tests", "tasks.py"]) + + +@task +def clean(ctx: Context) -> None: + """clean + + Remove all build, test, coverage and Python artifacts. + """ + ctx.run( + " ".join( + [ + "rm -rf", + ".coverage", + ".ipynb_checkpoints", + ".mypy_cache", + ".pytest_cache", + ".ruff_cache", + "*.egg-info", + "*.egg", + "build", + "coverage.xml", + "dist", + "htmlcov", + "site", + ] + ), + pty=True, + echo=True, + ) + + +@task +def install( + ctx: Context, extras: Optional[List[str]] = None, editable: bool = True +) -> None: + """install + + Install dependencies. + """ + if extras is None: + extras = ["dev", "test", "doc"] + ctx.run( + "pip install --upgrade pip", + pty=True, + echo=True, + ) + if editable: + cmd = f"pip install -e '.[{','.join(extras)}]'" + else: + cmd = f"pip install '.[{','.join(extras)}]'" + ctx.run( + cmd, + pty=True, + echo=True, + ) + + +@task +def lint(ctx: Context) -> None: + """lint + + Check typing and formatting. + """ + ctx.run( + "mypy dataquality tasks.py", + pty=True, + echo=True, + ) + ctx.run( + f"black {SOURCES} --check", + pty=True, + echo=True, + ) + ctx.run( + f"ruff {SOURCES}", + pty=True, + echo=True, + ) + + +@task +def format(ctx: Context) -> None: + """format + + Format the code. + """ + ctx.run( + f"black {SOURCES}", + pty=True, + echo=True, + ) + ctx.run( + f"ruff {SOURCES} --fix", + pty=True, + echo=True, + ) + + +@task +def test(ctx: Context) -> None: + """test + + Run the tests. + """ + ctx.run( + "pytest", + pty=True, + echo=True, + ) + + +@task +def build(ctx: Context) -> None: + """build + + Build the package. + """ + ctx.run( + "pip install --upgrade build", + pty=True, + echo=True, + ) + ctx.run( + "python -m build", + pty=True, + echo=True, + ) + + +@task +def publish(ctx: Context) -> None: + """publish + + Publish the package. + """ + ctx.run( + "pip install --upgrade twine", + pty=True, + echo=True, + ) + ctx.run( + "twine upload dist/*", + pty=True, + echo=True, + ) + + +@task +def all(ctx: Context) -> None: + """all + + Run all the tasks that matter for local dev. + """ + clean(ctx) + install(ctx) + format(ctx) + lint(ctx) + test(ctx) + + +@task +def docs_build(ctx: Context) -> None: + """docs-build + + Build the docs. + """ + ctx.run( + "cd docs/autodocs", + pty=True, + echo=True, + ) + ctx.run( + "make markdown", + pty=True, + echo=True, + ) + ctx.run( + "cd ../..", + pty=True, + echo=True, + ) + + +@unique +class BumpType(Enum): + MAJOR = "major" + MINOR = "minor" + + +def _bump_version(version: str, bump: Optional[BumpType] = None) -> str: + """Bump a version string. + + Args: + version (str): The version string to bump. + bump (str): The type of bump to perform. + + Returns: + str: The bumped version string. + """ + from packaging.version import Version + + v = Version(version) + if bump == BumpType.MAJOR: + v = Version(f"{v.major + 1}.0.0") + elif bump == BumpType.MINOR: + v = Version(f"{v.major}.{v.minor + 1}.0") + else: + v = Version(f"{v.major}.{v.minor}.{v.micro + 1}") + return str(v) + + +@task(aliases=["uv"]) +def update_version_number(ctx: Context, part: Optional[BumpType] = None) -> None: + """update version number + + Specify the part of the version number to bump. The default is to bump the + micro version number. Other options are major and minor. + """ + from dataquality import __version__ + + print(f"Current version: {__version__}") + new_version = _bump_version(__version__, part) + with open(VERSION_FILE, "r") as f: + lines = f.readlines() + with open(VERSION_FILE, "w") as f: + for line in lines: + if line.startswith("__version__"): + f.write(f'__version__ = "{new_version}"\n') + else: + f.write(line) + print(f"New version: {new_version}") From adbab2282acc5c0231e28d0df6366849dd79ed2d Mon Sep 17 00:00:00 2001 From: Anthony Corletti Date: Thu, 8 Jun 2023 16:42:10 -0400 Subject: [PATCH 2/6] cleanup --- CONTRIBUTING.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 500002844..4f949e099 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -26,7 +26,7 @@ $ which python pip [`pyenv`](https://github.com/pyenv/pyenv) is suggested for local python development. -## Flit +## Development This project uses `setuptools` to manage our project's dependencies and `invoke` for running tasks. @@ -38,8 +38,6 @@ pip install invoke inv all ``` -## Development - To install a development version of the package in another python environment, simply use that virtual enviroment's pip: ```sh From 33ef133e141249befe9b136572c305a1ffca4168 Mon Sep 17 00:00:00 2001 From: Anthony Corletti Date: Thu, 8 Jun 2023 16:47:20 -0400 Subject: [PATCH 3/6] fix typos in gh action workflow file --- .github/workflows/test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 60940d2de..37eb92dc0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -30,11 +30,11 @@ jobs: run: pip install invoke - name: install dependencies - if: matrix.python-version != "3.7" + if: ${{ matrix.python-version }} != "3.7" run: inv install - name: install dependencies (python 3.7) - if: matrix.python-version == "3.7" + if: ${{ matrix.python-version }} == "3.7" run: inv install -e dev,test,doc,py37 - name: test From 24168a1038012436f660af0e92617c5c39b254b5 Mon Sep 17 00:00:00 2001 From: Anthony Corletti Date: Thu, 8 Jun 2023 16:55:42 -0400 Subject: [PATCH 4/6] cleanup install --- .github/workflows/test.yaml | 2 +- tasks.py | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 37eb92dc0..5c50bd6e0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -35,7 +35,7 @@ jobs: - name: install dependencies (python 3.7) if: ${{ matrix.python-version }} == "3.7" - run: inv install -e dev,test,doc,py37 + run: inv install --no-editable -e dev,test,doc,py37 - name: test run: inv test diff --git a/tasks.py b/tasks.py index e10475001..906133683 100644 --- a/tasks.py +++ b/tasks.py @@ -39,24 +39,30 @@ def clean(ctx: Context) -> None: @task -def install( - ctx: Context, extras: Optional[List[str]] = None, editable: bool = True -) -> None: +def install(ctx: Context, extras: Optional[str] = None, editable: bool = True) -> None: """install Install dependencies. + + Args: + ctx (Context): The invoke context. + extras (str, optional): The extras to install. Defaults to None. If None, + then the default extras are installed. Specify as a comma-separated + string. + editable (bool, optional): Whether to install in editable mode. Defaults to + True. """ if extras is None: - extras = ["dev", "test", "doc"] + extras = "dev,test,doc" ctx.run( "pip install --upgrade pip", pty=True, echo=True, ) if editable: - cmd = f"pip install -e '.[{','.join(extras)}]'" + cmd = f"pip install -e '.[{extras}]'" else: - cmd = f"pip install '.[{','.join(extras)}]'" + cmd = f"pip install '.[{extras}]'" ctx.run( cmd, pty=True, From e4033a450a2ff8500c6e1acac1a6e8472e7f589c Mon Sep 17 00:00:00 2001 From: Anthony Corletti Date: Thu, 8 Jun 2023 17:04:13 -0400 Subject: [PATCH 5/6] cleanup install --- .github/workflows/test.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 5c50bd6e0..989334ef4 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -30,12 +30,12 @@ jobs: run: pip install invoke - name: install dependencies - if: ${{ matrix.python-version }} != "3.7" - run: inv install - - - name: install dependencies (python 3.7) - if: ${{ matrix.python-version }} == "3.7" - run: inv install --no-editable -e dev,test,doc,py37 + run: | + if [[ ${{ matrix.python-version }} == "3.7" ]]; then + inv install --no-editable -e dev,test,doc,py37 + else + inv install --no-editable + fi - name: test run: inv test From e2d2f19feb363ef466d2b9caab68d2d84e1077f6 Mon Sep 17 00:00:00 2001 From: Anthony Corletti Date: Thu, 8 Jun 2023 17:10:08 -0400 Subject: [PATCH 6/6] clearer --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 989334ef4..90b5605ed 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -32,7 +32,7 @@ jobs: - name: install dependencies run: | if [[ ${{ matrix.python-version }} == "3.7" ]]; then - inv install --no-editable -e dev,test,doc,py37 + inv install --no-editable --extras dev,test,doc,py37 else inv install --no-editable fi