From 7d076417e0502bb0aa30cfc0a85bf0f823a6508c Mon Sep 17 00:00:00 2001 From: xiyan Date: Wed, 17 Jul 2024 10:24:56 -0400 Subject: [PATCH 01/23] feat: added hatch test action --- docs/.github/workflows/hatch_test.yml | 29 +++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 docs/.github/workflows/hatch_test.yml diff --git a/docs/.github/workflows/hatch_test.yml b/docs/.github/workflows/hatch_test.yml new file mode 100644 index 0000000..3e2f7b9 --- /dev/null +++ b/docs/.github/workflows/hatch_test.yml @@ -0,0 +1,29 @@ +name: "hatch_test" + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + run: + name: "tests & coverage" + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install hatch + run: | + python -m pip install hatch + + - name: Lint + run: hatch test --all From a0822ae5d74251f2681b27aebe020dda6acbc855 Mon Sep 17 00:00:00 2001 From: xiyan Date: Wed, 17 Jul 2024 10:29:06 -0400 Subject: [PATCH 02/23] fix: move --- {docs/.github => .github}/workflows/hatch_test.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {docs/.github => .github}/workflows/hatch_test.yml (100%) diff --git a/docs/.github/workflows/hatch_test.yml b/.github/workflows/hatch_test.yml similarity index 100% rename from docs/.github/workflows/hatch_test.yml rename to .github/workflows/hatch_test.yml From e66ee4993c3b5e8f59c0d66e444dbfe1806579db Mon Sep 17 00:00:00 2001 From: xiyan Date: Wed, 17 Jul 2024 10:35:03 -0400 Subject: [PATCH 03/23] feat: trigger --- .github/workflows/hatch_test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/hatch_test.yml b/.github/workflows/hatch_test.yml index 3e2f7b9..b386e10 100644 --- a/.github/workflows/hatch_test.yml +++ b/.github/workflows/hatch_test.yml @@ -4,7 +4,9 @@ on: push: branches: [main] pull_request: - branches: [main] + types: + - opened + workflow_dispatch: jobs: run: From 0f9a878df07f53490f338327f32b6b44d56bafba Mon Sep 17 00:00:00 2001 From: xiyan Date: Wed, 17 Jul 2024 10:36:53 -0400 Subject: [PATCH 04/23] feat: trigger on all push --- .github/workflows/hatch_test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/hatch_test.yml b/.github/workflows/hatch_test.yml index b386e10..b6a3685 100644 --- a/.github/workflows/hatch_test.yml +++ b/.github/workflows/hatch_test.yml @@ -2,7 +2,6 @@ name: "hatch_test" on: push: - branches: [main] pull_request: types: - opened From cfe9cf4179e8b763c31bb5e62b62a09af0eb0ccd Mon Sep 17 00:00:00 2001 From: xiyan Date: Wed, 17 Jul 2024 10:39:36 -0400 Subject: [PATCH 05/23] feat: eliminate python versions --- .github/workflows/hatch_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hatch_test.yml b/.github/workflows/hatch_test.yml index b6a3685..8a1c358 100644 --- a/.github/workflows/hatch_test.yml +++ b/.github/workflows/hatch_test.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python-version: ["3.7", "3.10"] steps: - uses: actions/checkout@v4 From 34428919fa04bb4437b4e4884b8e1fb2d774ec56 Mon Sep 17 00:00:00 2001 From: xiyan Date: Wed, 17 Jul 2024 10:41:09 -0400 Subject: [PATCH 06/23] feat: run only matrix version --- .github/workflows/hatch_test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/hatch_test.yml b/.github/workflows/hatch_test.yml index 8a1c358..fbda462 100644 --- a/.github/workflows/hatch_test.yml +++ b/.github/workflows/hatch_test.yml @@ -26,5 +26,5 @@ jobs: run: | python -m pip install hatch - - name: Lint - run: hatch test --all + - name: Run tests + run: hatch test --python ${{ matrix.python-version }} --cover-quiet --randomize --parallel --retries 5 --retry-delay 3 From 6cfc32667decfab9cbeff588b990b03455a2f7bd Mon Sep 17 00:00:00 2001 From: xiyan Date: Wed, 17 Jul 2024 10:43:32 -0400 Subject: [PATCH 07/23] feat: requires hatch version --- .github/workflows/hatch_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hatch_test.yml b/.github/workflows/hatch_test.yml index fbda462..2b4103e 100644 --- a/.github/workflows/hatch_test.yml +++ b/.github/workflows/hatch_test.yml @@ -24,7 +24,7 @@ jobs: - name: Install hatch run: | - python -m pip install hatch + python -m pip install hatch>=1.10.0 - name: Run tests run: hatch test --python ${{ matrix.python-version }} --cover-quiet --randomize --parallel --retries 5 --retry-delay 3 From 180ff701ebe90e30d5ce9c4e0170667aac56dd1b Mon Sep 17 00:00:00 2001 From: xiyan Date: Wed, 17 Jul 2024 10:47:56 -0400 Subject: [PATCH 08/23] feat: hatch install via pypa --- .github/workflows/hatch_test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/hatch_test.yml b/.github/workflows/hatch_test.yml index 2b4103e..c685f57 100644 --- a/.github/workflows/hatch_test.yml +++ b/.github/workflows/hatch_test.yml @@ -17,14 +17,14 @@ jobs: steps: - uses: actions/checkout@v4 + + - name: Install Hatch + uses: pypa/hatch@install + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Install hatch - run: | - python -m pip install hatch>=1.10.0 - - name: Run tests run: hatch test --python ${{ matrix.python-version }} --cover-quiet --randomize --parallel --retries 5 --retry-delay 3 From 15484a59dd9be3f5f09404fc1b4bfaace161b37a Mon Sep 17 00:00:00 2001 From: xiyan Date: Wed, 17 Jul 2024 10:49:29 -0400 Subject: [PATCH 09/23] feat: remove coverage --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index fea4f09..6b067e4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,6 @@ path = "minject/__init__.py" [tool.hatch.envs.default] dependencies = [ # Developer dependencies. E.g. for testing, building, packaging, etc. - "coverage", "mypy", "pre-commit", "pylint", From 742104695e6eb21f0fe3aab442d060940e52f3a4 Mon Sep 17 00:00:00 2001 From: xiyan Date: Wed, 17 Jul 2024 10:51:37 -0400 Subject: [PATCH 10/23] revert --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 6b067e4..fea4f09 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,7 @@ path = "minject/__init__.py" [tool.hatch.envs.default] dependencies = [ # Developer dependencies. E.g. for testing, building, packaging, etc. + "coverage", "mypy", "pre-commit", "pylint", From 58eb0db33e6b1e3adc98c21c5c9f6eed6507262d Mon Sep 17 00:00:00 2001 From: xiyan Date: Wed, 17 Jul 2024 10:54:51 -0400 Subject: [PATCH 11/23] hatch-test templates to default --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index fea4f09..21e3899 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,5 +32,8 @@ dependencies = [ "typing", ] +[tool.hatch.envs.hatch-test] +template = "default" + [[tool.hatch.envs.hatch-test.matrix]] python = ["3.7", "3.10"] From 5b3651e7a1804017492f1169135ec6b0bb6580e2 Mon Sep 17 00:00:00 2001 From: xiyan Date: Wed, 17 Jul 2024 10:56:40 -0400 Subject: [PATCH 12/23] pip installer --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 21e3899..8ba1afb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,7 @@ dependencies = [ [tool.hatch.envs.hatch-test] template = "default" +installer = "pip" [[tool.hatch.envs.hatch-test.matrix]] python = ["3.7", "3.10"] From 99f14c6915da7d652f868b504ec44c99ed8be8df Mon Sep 17 00:00:00 2001 From: xiyan Date: Wed, 17 Jul 2024 10:59:21 -0400 Subject: [PATCH 13/23] revert --- pyproject.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8ba1afb..fea4f09 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,9 +32,5 @@ dependencies = [ "typing", ] -[tool.hatch.envs.hatch-test] -template = "default" -installer = "pip" - [[tool.hatch.envs.hatch-test.matrix]] python = ["3.7", "3.10"] From e50b1b4a84481791c42c3e706cf4ae92cddb2d7b Mon Sep 17 00:00:00 2001 From: xiyan Date: Wed, 17 Jul 2024 11:08:35 -0400 Subject: [PATCH 14/23] no cover --- pyproject.toml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index fea4f09..0b0d8b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,9 @@ [project] name = "minject" description = "A small dependency injection library for Python." -classifiers=['Development Status :: 4 - Beta'] +classifiers = ['Development Status :: 4 - Beta'] dynamic = ["version"] -authors = [{name = "Matt McHenry", email = "mmchenry@duolingo.com"}, {name = "Alek Binion", email = "alek@duolingo.com"}, {name = "Service Framework Team", email = "service-framework-team@duolingo.com"}] +authors = [{ name = "Matt McHenry", email = "mmchenry@duolingo.com" }, { name = "Alek Binion", email = "alek@duolingo.com" }, { name = "Service Framework Team", email = "service-framework-team@duolingo.com" }] requires-python = ">=3.7" dependencies = [ @@ -34,3 +34,8 @@ dependencies = [ [[tool.hatch.envs.hatch-test.matrix]] python = ["3.7", "3.10"] + +[envs.hatch-test.overrides] +matrix.deps.env-vars = [ + { key = "UV_PRERELEASE", value = "allow" }, +] From b676d3da642c7a7743608874270018b3695316de Mon Sep 17 00:00:00 2001 From: xiyan Date: Wed, 17 Jul 2024 11:09:05 -0400 Subject: [PATCH 15/23] no cover --- .github/workflows/hatch_test.yml | 2 +- pyproject.toml | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/hatch_test.yml b/.github/workflows/hatch_test.yml index c685f57..78c35d7 100644 --- a/.github/workflows/hatch_test.yml +++ b/.github/workflows/hatch_test.yml @@ -27,4 +27,4 @@ jobs: python-version: ${{ matrix.python-version }} - name: Run tests - run: hatch test --python ${{ matrix.python-version }} --cover-quiet --randomize --parallel --retries 5 --retry-delay 3 + run: hatch test --python ${{ matrix.python-version }} --randomize --parallel --retries 5 --retry-delay 3 diff --git a/pyproject.toml b/pyproject.toml index 0b0d8b3..aca14b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,8 +34,3 @@ dependencies = [ [[tool.hatch.envs.hatch-test.matrix]] python = ["3.7", "3.10"] - -[envs.hatch-test.overrides] -matrix.deps.env-vars = [ - { key = "UV_PRERELEASE", value = "allow" }, -] From 3235110be7bfb3c44edd221c908d7521d6963331 Mon Sep 17 00:00:00 2001 From: xiyan Date: Wed, 17 Jul 2024 11:15:09 -0400 Subject: [PATCH 16/23] lower coverage version --- pyproject.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index aca14b3..048e65f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,5 +32,10 @@ dependencies = [ "typing", ] +[tool.hatch.envs.hatch-test] +dependencies= [ + "coverage[toml] < 7.3.0" +] + [[tool.hatch.envs.hatch-test.matrix]] python = ["3.7", "3.10"] From 125b4ea642dc79ceb08cc3203181538923058256 Mon Sep 17 00:00:00 2001 From: xiyan Date: Wed, 17 Jul 2024 11:19:49 -0400 Subject: [PATCH 17/23] template --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 048e65f..1dbafe5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,6 +33,7 @@ dependencies = [ ] [tool.hatch.envs.hatch-test] +template = "default" dependencies= [ "coverage[toml] < 7.3.0" ] From eba7d38d2dcb87c6fe7fee59513caa18f14e665d Mon Sep 17 00:00:00 2001 From: xiyan Date: Wed, 17 Jul 2024 11:23:41 -0400 Subject: [PATCH 18/23] specify dependencies --- pyproject.toml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1dbafe5..5497252 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,9 +33,17 @@ dependencies = [ ] [tool.hatch.envs.hatch-test] -template = "default" -dependencies= [ - "coverage[toml] < 7.3.0" +dependencies = [ + # The default hatch-test dependencies are not compatible with Python 3.7, a version we want to test against. Hence + # we need to specify our own dependencies here. + # https://github.com/pypa/hatch/blob/3adae6c0dfd5c20dfe9bf6bae19b44a696c22a43/src/hatch/env/internal/test.py + "coverage[toml] < 7.3.0", + 'coverage-enable-subprocess==1.0', + 'pytest~=8.1', + 'pytest-mock~=3.12', + 'pytest-randomly~=3.15', + 'pytest-rerunfailures~=14.0', + 'pytest-xdist[psutil]~=3.5', ] [[tool.hatch.envs.hatch-test.matrix]] From 33aab80ee7f347a5dd593e38eb98a180a4488191 Mon Sep 17 00:00:00 2001 From: xiyan Date: Wed, 17 Jul 2024 11:25:04 -0400 Subject: [PATCH 19/23] remove constraints --- pyproject.toml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5497252..0da7a5f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,13 +37,13 @@ dependencies = [ # The default hatch-test dependencies are not compatible with Python 3.7, a version we want to test against. Hence # we need to specify our own dependencies here. # https://github.com/pypa/hatch/blob/3adae6c0dfd5c20dfe9bf6bae19b44a696c22a43/src/hatch/env/internal/test.py - "coverage[toml] < 7.3.0", - 'coverage-enable-subprocess==1.0', - 'pytest~=8.1', - 'pytest-mock~=3.12', - 'pytest-randomly~=3.15', - 'pytest-rerunfailures~=14.0', - 'pytest-xdist[psutil]~=3.5', + "coverage[toml]", + 'coverage-enable-subprocess', + 'pytest', + 'pytest-mock', + 'pytest-randomly', + 'pytest-rerunfailures', + 'pytest-xdist[psutil]', ] [[tool.hatch.envs.hatch-test.matrix]] From 1475c1151b91fe9b8d629f8700ab06ba7ed81f66 Mon Sep 17 00:00:00 2001 From: xiyan Date: Wed, 17 Jul 2024 11:27:49 -0400 Subject: [PATCH 20/23] added back quiet cover --- .github/workflows/hatch_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hatch_test.yml b/.github/workflows/hatch_test.yml index 78c35d7..c685f57 100644 --- a/.github/workflows/hatch_test.yml +++ b/.github/workflows/hatch_test.yml @@ -27,4 +27,4 @@ jobs: python-version: ${{ matrix.python-version }} - name: Run tests - run: hatch test --python ${{ matrix.python-version }} --randomize --parallel --retries 5 --retry-delay 3 + run: hatch test --python ${{ matrix.python-version }} --cover-quiet --randomize --parallel --retries 5 --retry-delay 3 From 6d33d18c8e48d19292c28cfe51504f418ff5c140 Mon Sep 17 00:00:00 2001 From: xiyan Date: Wed, 17 Jul 2024 11:40:16 -0400 Subject: [PATCH 21/23] added back quiet cover --- .github/workflows/hatch_test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/hatch_test.yml b/.github/workflows/hatch_test.yml index c685f57..7449290 100644 --- a/.github/workflows/hatch_test.yml +++ b/.github/workflows/hatch_test.yml @@ -2,9 +2,9 @@ name: "hatch_test" on: push: + branches: + - master pull_request: - types: - - opened workflow_dispatch: jobs: From fa3791329e5eec7d536323d46a8b1bf7cfbb69b2 Mon Sep 17 00:00:00 2001 From: xiyan Date: Wed, 17 Jul 2024 11:41:24 -0400 Subject: [PATCH 22/23] change name --- .github/workflows/hatch_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hatch_test.yml b/.github/workflows/hatch_test.yml index 7449290..631a6f4 100644 --- a/.github/workflows/hatch_test.yml +++ b/.github/workflows/hatch_test.yml @@ -1,4 +1,4 @@ -name: "hatch_test" +name: "Unit Tests" on: push: From 0f1c83b6ff2d16679712361a582f1899f2e3b2d0 Mon Sep 17 00:00:00 2001 From: Xiyan Date: Wed, 17 Jul 2024 12:15:08 -0400 Subject: [PATCH 23/23] Update pyproject.toml Co-authored-by: Alek Binion --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 0da7a5f..99e0bb5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "minject" description = "A small dependency injection library for Python." classifiers = ['Development Status :: 4 - Beta'] dynamic = ["version"] -authors = [{ name = "Matt McHenry", email = "mmchenry@duolingo.com" }, { name = "Alek Binion", email = "alek@duolingo.com" }, { name = "Service Framework Team", email = "service-framework-team@duolingo.com" }] +authors = [{ name = "Matt McHenry", email = "mmchenry@duolingo.com" }, { name = "Alek Binion", email = "alek@duolingo.com" }, { name = "Xiyan Shao", email = "xiyan@duolingo.com"}, { name = "Service Framework Team", email = "service-framework-team@duolingo.com" }] requires-python = ">=3.7" dependencies = [