From 3aea95eb0157a32f0691903f58ad73faaa3b56aa Mon Sep 17 00:00:00 2001 From: h1alexbel Date: Thu, 4 Jul 2024 17:57:08 +0300 Subject: [PATCH 1/8] feat(#5): sr-data poetry build, checks --- .github/workflows/poetry.yml | 4 +++ .gitignore | 1 + sr-data/pyproject.toml | 5 ++- sr-data/src/sr_data/__init__.py | 21 +++++++++++ sr-data/src/sr_data/all.py | 35 +++++++++++++++++++ sr-data/src/sr_data/verifications/__init__.py | 21 +++++++++++ sr-data/src/sr_data/verifications/install.py | 28 +++++++++++++++ 7 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 sr-data/src/sr_data/__init__.py create mode 100644 sr-data/src/sr_data/all.py create mode 100644 sr-data/src/sr_data/verifications/__init__.py create mode 100644 sr-data/src/sr_data/verifications/install.py diff --git a/.github/workflows/poetry.yml b/.github/workflows/poetry.yml index baa1a4c..f41d4ae 100644 --- a/.github/workflows/poetry.yml +++ b/.github/workflows/poetry.yml @@ -49,3 +49,7 @@ jobs: - name: Poetry build run: | poetry install + - name: Check with Pylint and Flake8 + run: | + pylint $(git ls-files '*.py') + flake8 $(git ls-files '*.py') diff --git a/.gitignore b/.gitignore index 3e49db1..e7c033b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ build/ +dist/ venv/ bin/ pwd/ diff --git a/sr-data/pyproject.toml b/sr-data/pyproject.toml index 2c0bf14..024fd26 100644 --- a/sr-data/pyproject.toml +++ b/sr-data/pyproject.toml @@ -22,14 +22,17 @@ [tool.poetry] name = "sr-data" version = "0.0.0" -description = "Collected, processed data from GitHub API to CSV" +description = "GitHub repositories data to vectors" authors = ["h1alexbel "] license = "MIT" readme = "README.md" +packages = [{include = "sr_data", from = "src"}] [tool.poetry.dependencies] python = "^3.11 || ^3.12" +[tool.poetry.scripts] +sr-data = "sr_data.all:main" [build-system] requires = ["setuptools", "wheel"] diff --git a/sr-data/src/sr_data/__init__.py b/sr-data/src/sr_data/__init__.py new file mode 100644 index 0000000..1351e23 --- /dev/null +++ b/sr-data/src/sr_data/__init__.py @@ -0,0 +1,21 @@ +# The MIT License (MIT) +# +# Copyright (c) 2024 Aliaksei Bialiauski +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/sr-data/src/sr_data/all.py b/sr-data/src/sr_data/all.py new file mode 100644 index 0000000..1634274 --- /dev/null +++ b/sr-data/src/sr_data/all.py @@ -0,0 +1,35 @@ +# The MIT License (MIT) +# +# Copyright (c) 2024 Aliaksei Bialiauski +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +from .verifications.install import install + + +def main(): + install( + [ + "npm install -g ghminer@0.0.5", + "echo \"All dependencies are installed and up to date!\"" + ] + ) + + +if __name__ == "__main__": + main() diff --git a/sr-data/src/sr_data/verifications/__init__.py b/sr-data/src/sr_data/verifications/__init__.py new file mode 100644 index 0000000..1351e23 --- /dev/null +++ b/sr-data/src/sr_data/verifications/__init__.py @@ -0,0 +1,21 @@ +# The MIT License (MIT) +# +# Copyright (c) 2024 Aliaksei Bialiauski +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/sr-data/src/sr_data/verifications/install.py b/sr-data/src/sr_data/verifications/install.py new file mode 100644 index 0000000..501d514 --- /dev/null +++ b/sr-data/src/sr_data/verifications/install.py @@ -0,0 +1,28 @@ +# The MIT License (MIT) +# +# Copyright (c) 2024 Aliaksei Bialiauski +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +import os + + +def install(commands: []): + print("Installing tools...") + for cmd in commands: + os.system(cmd) From 4f7fe9a0355c6bdf0b4e52d7a5c4bcf64a762cba Mon Sep 17 00:00:00 2001 From: h1alexbel Date: Thu, 4 Jul 2024 18:05:35 +0300 Subject: [PATCH 2/8] feat(#5): poetry itself --- .github/workflows/poetry.yml | 4 ++-- pyproject.toml | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/poetry.yml b/.github/workflows/poetry.yml index f41d4ae..b50db86 100644 --- a/.github/workflows/poetry.yml +++ b/.github/workflows/poetry.yml @@ -51,5 +51,5 @@ jobs: poetry install - name: Check with Pylint and Flake8 run: | - pylint $(git ls-files '*.py') - flake8 $(git ls-files '*.py') + poetry run pylint $(git ls-files '*.py') + poetry run flake8 $(git ls-files '*.py') diff --git a/pyproject.toml b/pyproject.toml index b65b518..6e8886e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,10 +37,6 @@ sr-detector = { path = "./sr-detector" } pylint = "^3.2.5" flake8 = "^7.1.0" -[tool.poetry.scripts] -pylint = "pylint ." -flake8 = "flake8 ." - [build-system] requires = ["setuptools", "wheel"] build-backend = "setuptools.build_meta" From 2dd137d1fd86fea3ceb1089d5ecfa43e938a2332 Mon Sep 17 00:00:00 2001 From: h1alexbel Date: Thu, 4 Jul 2024 18:09:25 +0300 Subject: [PATCH 3/8] feat(#5): clean for pylint --- sr-data/src/sr_data/all.py | 9 ++++++++- sr-data/src/sr_data/verifications/install.py | 9 +++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/sr-data/src/sr_data/all.py b/sr-data/src/sr_data/all.py index 1634274..4d43422 100644 --- a/sr-data/src/sr_data/all.py +++ b/sr-data/src/sr_data/all.py @@ -19,14 +19,21 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. + +""" +all.py. +""" from .verifications.install import install +""" +Run all tasks. +""" + def main(): install( [ "npm install -g ghminer@0.0.5", - "echo \"All dependencies are installed and up to date!\"" ] ) diff --git a/sr-data/src/sr_data/verifications/install.py b/sr-data/src/sr_data/verifications/install.py index 501d514..3cbe803 100644 --- a/sr-data/src/sr_data/verifications/install.py +++ b/sr-data/src/sr_data/verifications/install.py @@ -19,10 +19,19 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. + +""" +install.py +""" import os +""" +Install tools using provided commands. +""" + def install(commands: []): print("Installing tools...") for cmd in commands: os.system(cmd) + os.system("echo \"All dependencies are installed and up to date!\"") From af0df420e388529bcfad2aad91786fdbb0b90f43 Mon Sep 17 00:00:00 2001 From: h1alexbel Date: Thu, 4 Jul 2024 18:15:09 +0300 Subject: [PATCH 4/8] feat(#5): valid docstrings --- sr-data/src/sr_data/all.py | 14 ++++++-------- sr-data/src/sr_data/verifications/install.py | 14 ++++++-------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/sr-data/src/sr_data/all.py b/sr-data/src/sr_data/all.py index 4d43422..6833135 100644 --- a/sr-data/src/sr_data/all.py +++ b/sr-data/src/sr_data/all.py @@ -1,3 +1,6 @@ +""" +Run all tasks. +""" # The MIT License (MIT) # # Copyright (c) 2024 Aliaksei Bialiauski @@ -19,18 +22,13 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. - -""" -all.py. -""" from .verifications.install import install -""" -Run all tasks. -""" - def main(): + """ + Run all tasks. + """ install( [ "npm install -g ghminer@0.0.5", diff --git a/sr-data/src/sr_data/verifications/install.py b/sr-data/src/sr_data/verifications/install.py index 3cbe803..899268c 100644 --- a/sr-data/src/sr_data/verifications/install.py +++ b/sr-data/src/sr_data/verifications/install.py @@ -1,3 +1,6 @@ +""" +install.py +""" # The MIT License (MIT) # # Copyright (c) 2024 Aliaksei Bialiauski @@ -19,18 +22,13 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. - -""" -install.py -""" import os -""" -Install tools using provided commands. -""" - def install(commands: []): + """ + Install tools using provided commands. + """ print("Installing tools...") for cmd in commands: os.system(cmd) From 295c3da668e94650d1bb3656eda08a5e2615e779 Mon Sep 17 00:00:00 2001 From: h1alexbel Date: Thu, 4 Jul 2024 18:21:38 +0300 Subject: [PATCH 5/8] feat(#5): quotes --- .github/workflows/poetry.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/poetry.yml b/.github/workflows/poetry.yml index b50db86..379766c 100644 --- a/.github/workflows/poetry.yml +++ b/.github/workflows/poetry.yml @@ -51,5 +51,5 @@ jobs: poetry install - name: Check with Pylint and Flake8 run: | - poetry run pylint $(git ls-files '*.py') - poetry run flake8 $(git ls-files '*.py') + poetry run pylint "$(git ls-files '*.py')" + poetry run flake8 "$(git ls-files '*.py')" From 74a11b0fd7bd590ae4a2b88a11ce7c4788aa7201 Mon Sep 17 00:00:00 2001 From: h1alexbel Date: Thu, 4 Jul 2024 18:26:22 +0300 Subject: [PATCH 6/8] feat(#5): one line --- .github/workflows/poetry.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/poetry.yml b/.github/workflows/poetry.yml index 379766c..958a469 100644 --- a/.github/workflows/poetry.yml +++ b/.github/workflows/poetry.yml @@ -51,5 +51,4 @@ jobs: poetry install - name: Check with Pylint and Flake8 run: | - poetry run pylint "$(git ls-files '*.py')" - poetry run flake8 "$(git ls-files '*.py')" + git ls-files '*.py' | xargs -I {} sh -c 'poetry run pylint "$@" && poetry run flake8 "$@"' _ {} From 1c77d72556c6de0dc1c45f10d35058fdb2aeaa91 Mon Sep 17 00:00:00 2001 From: h1alexbel Date: Thu, 4 Jul 2024 18:33:41 +0300 Subject: [PATCH 7/8] feat(#5): check step --- .github/workflows/poetry.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/poetry.yml b/.github/workflows/poetry.yml index 958a469..65be972 100644 --- a/.github/workflows/poetry.yml +++ b/.github/workflows/poetry.yml @@ -49,6 +49,24 @@ jobs: - name: Poetry build run: | poetry install + check: + strategy: + fail-fast: false + matrix: + python-version: [ "3.11", "3.12" ] + poetry-version: [ "1.8.3" ] + os: [ ubuntu-22.04 ] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Run image + uses: abatilo/actions-poetry@v2 + with: + poetry-version: ${{ matrix.poetry-version }} - name: Check with Pylint and Flake8 run: | + poetry install git ls-files '*.py' | xargs -I {} sh -c 'poetry run pylint "$@" && poetry run flake8 "$@"' _ {} From fbd3feffa14bb7fbc8cfc002d1948d797a3cc6a5 Mon Sep 17 00:00:00 2001 From: h1alexbel Date: Fri, 5 Jul 2024 15:51:55 +0300 Subject: [PATCH 8/8] feat(#5): 3.10 too --- .github/workflows/poetry.yml | 4 ++-- pyproject.toml | 2 +- sr-data/pyproject.toml | 2 +- sr-detector/pyproject.toml | 2 +- sr-train/pyproject.toml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/poetry.yml b/.github/workflows/poetry.yml index 65be972..0989b26 100644 --- a/.github/workflows/poetry.yml +++ b/.github/workflows/poetry.yml @@ -33,7 +33,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ "3.11", "3.12" ] + python-version: [ "3.10", "3.11", "3.12" ] poetry-version: [ "1.8.3" ] os: [ ubuntu-22.04, macos-12, windows-2022 ] runs-on: ${{ matrix.os }} @@ -53,7 +53,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ "3.11", "3.12" ] + python-version: [ "3.10", "3.11", "3.12" ] poetry-version: [ "1.8.3" ] os: [ ubuntu-22.04 ] runs-on: ${{ matrix.os }} diff --git a/pyproject.toml b/pyproject.toml index 6e8886e..c7faa59 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,7 @@ license = "MIT" readme = "README.md" [tool.poetry.dependencies] -python = "^3.11 || ^3.12" +python = "^3.10 || ^3.11 || ^3.12" sr-data = { path = "./sr-data" } sr-train = { path = "./sr-train" } sr-detector = { path = "./sr-detector" } diff --git a/sr-data/pyproject.toml b/sr-data/pyproject.toml index 024fd26..87b7cce 100644 --- a/sr-data/pyproject.toml +++ b/sr-data/pyproject.toml @@ -29,7 +29,7 @@ readme = "README.md" packages = [{include = "sr_data", from = "src"}] [tool.poetry.dependencies] -python = "^3.11 || ^3.12" +python = "^3.10 || ^3.11 || ^3.12" [tool.poetry.scripts] sr-data = "sr_data.all:main" diff --git a/sr-detector/pyproject.toml b/sr-detector/pyproject.toml index ce5ae8f..7430aef 100644 --- a/sr-detector/pyproject.toml +++ b/sr-detector/pyproject.toml @@ -28,7 +28,7 @@ license = "MIT" readme = "README.md" [tool.poetry.dependencies] -python = "^3.11 || ^3.12" +python = "^3.10 || ^3.11 || ^3.12" [build-system] requires = ["setuptools", "wheel"] diff --git a/sr-train/pyproject.toml b/sr-train/pyproject.toml index da66633..691faa0 100644 --- a/sr-train/pyproject.toml +++ b/sr-train/pyproject.toml @@ -28,7 +28,7 @@ license = "MIT" readme = "README.md" [tool.poetry.dependencies] -python = "^3.11 || ^3.12" +python = "^3.10 || ^3.11 || ^3.12" [build-system]