From b663d49b7cb0cb6bf2dcfcbb17cf93eb10406391 Mon Sep 17 00:00:00 2001 From: CaedenPH Date: Sun, 23 Oct 2022 15:57:42 +0100 Subject: [PATCH 01/22] ci: Consolidate requirements into `pyproject.toml` --- pyproject.toml | 43 +++++++++++++++++++++++++++++++++++++++++++ requirements.txt | 22 ---------------------- 2 files changed, 43 insertions(+), 22 deletions(-) create mode 100644 pyproject.toml delete mode 100644 requirements.txt diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000000..891a1c630cd6 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,43 @@ +[project] +name = "Python algorithms" +description = "All algorithms implemented in Python" +version = "1.0.0" + +authors = [ + { name = "Christian Clauss", email = "cclauss@me.com" }, + { name = "Dhruv Manilawala", email = "dhruvmanila@gmail.com" }, + { name = "John law", email = "dhruvmanila@gmail.com" } +] + +dependencies = [ + "beautifulsoup4", + "fake_useragent", + "keras", + "lxml", + "matplotlib", + "numpy", + "opencv-python", + "pandas", + "pillow", + "projectq", + "qiskit", + "requests", + "rich", + "scikit-fuzzy", + "sklearn", + "statsmodels", + "sympy", + "tensorflow", + "texttable", + "tweepy", + "xgboost", + "yulewalker" +] + +[project.optional-dependencies] +dev = [ + "pre-commit" +] + +[build-system] +requires = ["pytest",] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 9ffe784c945d..000000000000 --- a/requirements.txt +++ /dev/null @@ -1,22 +0,0 @@ -beautifulsoup4 -fake_useragent -keras -lxml -matplotlib -numpy -opencv-python -pandas -pillow -projectq -qiskit -requests -rich -scikit-fuzzy -sklearn -statsmodels -sympy -tensorflow -texttable -tweepy -xgboost -yulewalker From 380784cc2936da0644f86eb292f7dbf76b5ebb38 Mon Sep 17 00:00:00 2001 From: CaedenPH Date: Sun, 23 Oct 2022 16:01:06 +0100 Subject: [PATCH 02/22] ci: Remove `requirements-txt-fixer` --- .pre-commit-config.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5bdda50be0c4..1e76044b4c70 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,6 @@ repos: (?x)^( data_structures/heap/binomial_heap.py )$ - - id: requirements-txt-fixer - repo: https://github.com/psf/black rev: 22.10.0 From 7e8ca85a7bcf4d1bd3fb5001a2ecce2ebee2b6f2 Mon Sep 17 00:00:00 2001 From: CaedenPH Date: Sun, 23 Oct 2022 16:17:38 +0100 Subject: [PATCH 03/22] fix: Validate pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 891a1c630cd6..f71bc1eab7c1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [project] -name = "Python algorithms" +name = "python-algorithms" description = "All algorithms implemented in Python" version = "1.0.0" From c7f9baaf36f4c2d50dfb3b04bad8170a82622fe6 Mon Sep 17 00:00:00 2001 From: CaedenPH Date: Sun, 23 Oct 2022 16:18:52 +0100 Subject: [PATCH 04/22] ci: Add `validate-pyproject` to `pre-commit` --- .pre-commit-config.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1e76044b4c70..123ea480fa7f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -67,6 +67,11 @@ repos: project_euler/problem_022/p022_names.txt )$ + - repo: https://github.com/abravalheri/validate-pyproject + rev: v0.10.1 + hooks: + - id: validate-pyproject + - repo: local hooks: - id: validate-filenames From 11bfabc0e2c50c43b8226eb75ead3038e764d3fd Mon Sep 17 00:00:00 2001 From: Caeden Perelli-Harris Date: Sun, 23 Oct 2022 16:21:13 +0100 Subject: [PATCH 05/22] Update pyproject.toml Co-authored-by: Christian Clauss --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f71bc1eab7c1..799d7ebb72f9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ version = "1.0.0" authors = [ { name = "Christian Clauss", email = "cclauss@me.com" }, { name = "Dhruv Manilawala", email = "dhruvmanila@gmail.com" }, - { name = "John law", email = "dhruvmanila@gmail.com" } + { name = "John Law", email = "dhruvmanila@gmail.com" } ] dependencies = [ From 1eb7fac021fca3ff68b03ae0e03c54625f70fcad Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 23 Oct 2022 18:44:49 +0200 Subject: [PATCH 06/22] pip install --editable ".[dev]" --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8481b962a256..c7d34b254394 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,6 +21,7 @@ jobs: run: | python -m pip install --upgrade pip setuptools six wheel python -m pip install pytest-cov -r requirements.txt + python -m pip install --editable ".[dev]" - name: Run tests run: pytest --doctest-modules --ignore=project_euler/ --ignore=scripts/validate_solutions.py --cov-report=term-missing:skip-covered --cov=. . - if: ${{ success() }} From 52b6c2604ee1a742794166e324cd20479a9142f9 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 23 Oct 2022 18:46:31 +0200 Subject: [PATCH 07/22] python -m pip install --editable ".[dev]" --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c7d34b254394..bed2cee83041 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip setuptools six wheel - python -m pip install pytest-cov -r requirements.txt + python -m pip install pytest-cov python -m pip install --editable ".[dev]" - name: Run tests run: pytest --doctest-modules --ignore=project_euler/ --ignore=scripts/validate_solutions.py --cov-report=term-missing:skip-covered --cov=. . From 61388bd24d3a57dcf96a130ead6e45ee779940fa Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 23 Oct 2022 18:51:19 +0200 Subject: [PATCH 08/22] [build-system] requires = ["setuptools ~= 65.5"] --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 799d7ebb72f9..a70263be3ffb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,6 @@ +[build-system] +requires = ["setuptools ~= 65.5"] + [project] name = "python-algorithms" description = "All algorithms implemented in Python" From 8db92db58b10762f5a1467fd58841f97c0f3739d Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 23 Oct 2022 18:53:02 +0200 Subject: [PATCH 09/22] [build-system] requires = ["setuptools ~= 65.5"] --- pyproject.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a70263be3ffb..316e52878deb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,6 +41,3 @@ dependencies = [ dev = [ "pre-commit" ] - -[build-system] -requires = ["pytest",] From e03175f4bad72c1bc063cd34b05f4c6a9cecad05 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 23 Oct 2022 18:54:37 +0200 Subject: [PATCH 10/22] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bed2cee83041..846b0e2d21ea 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: run: | python -m pip install --upgrade pip setuptools six wheel python -m pip install pytest-cov - python -m pip install --editable ".[dev]" + python -m pip install ".[dev]" # --editable - name: Run tests run: pytest --doctest-modules --ignore=project_euler/ --ignore=scripts/validate_solutions.py --cov-report=term-missing:skip-covered --cov=. . - if: ${{ success() }} From 1dfd693ed3c0d0915aafd267d0c1b267d48bff63 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 23 Oct 2022 19:03:03 +0200 Subject: [PATCH 11/22] [build-system] requires = ["setuptools ~= 65.5", "wheel"] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 316e52878deb..47541b42b3a2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools ~= 65.5"] +requires = ["setuptools ~= 65.5", "wheel"] [project] name = "python-algorithms" From 17c8142144bccfa8812060cec2509cf98b4eb5f6 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 23 Oct 2022 19:08:57 +0200 Subject: [PATCH 12/22] build-backend = "setuptools.build_meta" --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 47541b42b3a2..50b37cb010d2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,6 @@ [build-system] requires = ["setuptools ~= 65.5", "wheel"] +build-backend = "setuptools.build_meta" [project] name = "python-algorithms" From e4f4ff757d0d08652016e1c0d33ee7e0674a926c Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 23 Oct 2022 19:17:42 +0200 Subject: [PATCH 13/22] packages --- pyproject.toml | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 50b37cb010d2..420089d788d2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,6 +13,50 @@ authors = [ { name = "John Law", email = "dhruvmanila@gmail.com" } ] +packages = [ + "arithmetic_analysis", + "audio_filters", + "backtracking", + "bit_manipulation", + "blockchain", + "boolean_algebra", + "cellular_automata", + "ciphers", + "compression", + "computer_vision", + "conversions", + "data_structures", + "digital_image_processing", + "divide_and_conquer", + "dynamic_programming", + "electronics", + "file_transfer", + "financial", + "fractals", + "fuzzy_logic", + "genetic_algorithm", + "geodesy", + "graphics", + "graphs", + "greedy_methods", + "hashes", + "knapsack", + "linear_algebra", + "machine_learning", + "maths", + "matrix", + "networking_flow", + "neural_network", + "other", + "physics", + "project_euler", + "quantum", + "scheduling", + "searches", + "sorts", + "strings", + "web_programming", +] dependencies = [ "beautifulsoup4", "fake_useragent", From a72c39f29bc406058f564726c910c1cf0999a164 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 23 Oct 2022 19:25:12 +0200 Subject: [PATCH 14/22] [tool.setuptools] packages = [] --- pyproject.toml | 60 ++++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 420089d788d2..19a3745ec305 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,6 +13,37 @@ authors = [ { name = "John Law", email = "dhruvmanila@gmail.com" } ] +dependencies = [ + "beautifulsoup4", + "fake_useragent", + "keras", + "lxml", + "matplotlib", + "numpy", + "opencv-python", + "pandas", + "pillow", + "projectq", + "qiskit", + "requests", + "rich", + "scikit-fuzzy", + "sklearn", + "statsmodels", + "sympy", + "tensorflow", + "texttable", + "tweepy", + "xgboost", + "yulewalker" +] + +[project.optional-dependencies] +dev = [ + "pre-commit" +] + +[tool.setuptools] packages = [ "arithmetic_analysis", "audio_filters", @@ -57,32 +88,3 @@ packages = [ "strings", "web_programming", ] -dependencies = [ - "beautifulsoup4", - "fake_useragent", - "keras", - "lxml", - "matplotlib", - "numpy", - "opencv-python", - "pandas", - "pillow", - "projectq", - "qiskit", - "requests", - "rich", - "scikit-fuzzy", - "sklearn", - "statsmodels", - "sympy", - "tensorflow", - "texttable", - "tweepy", - "xgboost", - "yulewalker" -] - -[project.optional-dependencies] -dev = [ - "pre-commit" -] From fdc05428ef3ec6f64a9612d4e537c49aef3a3cc7 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 23 Oct 2022 19:29:16 +0200 Subject: [PATCH 15/22] Update pyproject.toml --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 19a3745ec305..20b676e63a48 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,8 @@ dev = [ ] [tool.setuptools] -packages = [ +# packages = [ ] does not work! +py_modules = [ "arithmetic_analysis", "audio_filters", "backtracking", From 2faf714f30c85f5e462638b8ff820073dab12085 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 23 Oct 2022 19:32:59 +0200 Subject: [PATCH 16/22] Update pyproject.toml --- pyproject.toml | 47 ++--------------------------------------------- 1 file changed, 2 insertions(+), 45 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 20b676e63a48..68537455231e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,48 +44,5 @@ dev = [ ] [tool.setuptools] -# packages = [ ] does not work! -py_modules = [ - "arithmetic_analysis", - "audio_filters", - "backtracking", - "bit_manipulation", - "blockchain", - "boolean_algebra", - "cellular_automata", - "ciphers", - "compression", - "computer_vision", - "conversions", - "data_structures", - "digital_image_processing", - "divide_and_conquer", - "dynamic_programming", - "electronics", - "file_transfer", - "financial", - "fractals", - "fuzzy_logic", - "genetic_algorithm", - "geodesy", - "graphics", - "graphs", - "greedy_methods", - "hashes", - "knapsack", - "linear_algebra", - "machine_learning", - "maths", - "matrix", - "networking_flow", - "neural_network", - "other", - "physics", - "project_euler", - "quantum", - "scheduling", - "searches", - "sorts", - "strings", - "web_programming", -] +packages = [ ] +# py_modules = [ ] does not work! From 495e5fe2815853d7871cae83ab42a9feb66f60be Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 23 Oct 2022 19:41:34 +0200 Subject: [PATCH 17/22] Update build.yml --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 846b0e2d21ea..17e300475b99 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,8 +20,8 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip setuptools six wheel - python -m pip install pytest-cov - python -m pip install ".[dev]" # --editable + python -m pip install pytest pytest-cov + python -m pip install ".[dev]" # --editable - name: Run tests run: pytest --doctest-modules --ignore=project_euler/ --ignore=scripts/validate_solutions.py --cov-report=term-missing:skip-covered --cov=. . - if: ${{ success() }} From 8f9a6ea3b5ac6152407daeb519e19543bad26e27 Mon Sep 17 00:00:00 2001 From: John Law Date: Tue, 25 Oct 2022 22:41:26 +0100 Subject: [PATCH 18/22] Fix my email --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 68537455231e..7a65f1cd22cc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ version = "1.0.0" authors = [ { name = "Christian Clauss", email = "cclauss@me.com" }, { name = "Dhruv Manilawala", email = "dhruvmanila@gmail.com" }, - { name = "John Law", email = "dhruvmanila@gmail.com" } + { name = "John Law", email = "johnlaw.po@gmail.com" } ] dependencies = [ From 17926cfbefde2ec77458f929d177eff6462ba71a Mon Sep 17 00:00:00 2001 From: Caeden Perelli-Harris Date: Sun, 30 Oct 2022 08:36:03 +0000 Subject: [PATCH 19/22] Update pyproject.toml Co-authored-by: Dhruv Manilawala --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 480c105b9743..3f4ab780b5ed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,6 @@ dev = [ [tool.setuptools] packages = [ ] -# py_modules = [ ] does not work! [tool.pytest.ini_options] markers = [ From d7b96650c77065ac0b3269a1fdf44a24773770d1 Mon Sep 17 00:00:00 2001 From: CaedenPH Date: Sun, 30 Oct 2022 13:36:54 +0000 Subject: [PATCH 20/22] ci: Add `pytest` and `pytest-cov` to dev dependencies --- pyproject.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 3f4ab780b5ed..c5ec0788668f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,7 +40,9 @@ dependencies = [ [project.optional-dependencies] dev = [ - "pre-commit" + "pre-commit", + "pytest", + "pytest-cov" ] [tool.setuptools] From 9bbd9b9921c7e76032f93c069de985b753850eef Mon Sep 17 00:00:00 2001 From: CaedenPH Date: Sun, 30 Oct 2022 13:40:51 +0000 Subject: [PATCH 21/22] ci: Only install dependencies --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d9efa634d658..23cee2905d8a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip setuptools six wheel - python -m pip install pytest pytest-cov python -m pip install ".[dev]" # --editable - name: Run tests run: pytest --ignore=project_euler/ --ignore=scripts/validate_solutions.py --cov-report=term-missing:skip-covered --cov=. . From e9ce37294124bb62b7a3a11d574ca2373f54c044 Mon Sep 17 00:00:00 2001 From: CaedenPH Date: Sun, 30 Oct 2022 15:52:28 +0000 Subject: [PATCH 22/22] chore: Fix merge mistake --- .pre-commit-config.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4e764d2e4488..6ce6dbb5588d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,10 +7,6 @@ repos: - id: end-of-file-fixer types: [python] - id: trailing-whitespace - exclude: | - (?x)^( - data_structures/heap/binomial_heap.py - )$ - repo: https://github.com/MarcoGorelli/auto-walrus rev: v0.2.1