From 2427c6865b2a1a8ef3bcccd252e6b5ec6c022a68 Mon Sep 17 00:00:00 2001 From: Artanias <43622365+Artanias@users.noreply.github.com> Date: Tue, 4 Nov 2025 15:47:26 +0300 Subject: [PATCH 1/9] build: upgrades used base docker image to Ubuntu 24.04. --- .github/workflows/check_n_push_image.yml | 28 ++-- .pre-commit-config.yaml | 4 +- CONTRIBUTING.md | 2 +- Makefile | 8 +- README.md | 6 +- debian/control.in | 4 +- debian/preinst.in | 2 +- ....dockerfile => base_ubuntu2404.dockerfile} | 19 ++- ...> base_ubuntu2404.dockerfile.dockerignore} | 0 docker/docker.mk | 6 +- ....dockerfile => test_ubuntu2404.dockerfile} | 7 +- ...u2204.dockerfile => ubuntu2404.dockerfile} | 3 + locales/codeplag.pot | 124 ++++++++++-------- .../translations/en/LC_MESSAGES/codeplag.po | 122 +++++++++-------- .../translations/ru/LC_MESSAGES/codeplag.po | 122 +++++++++-------- pyproject.toml | 6 +- setup.py | 22 +++- src/codeplag/codeplagcli.py | 22 ++-- src/codeplag/cplag/utils.py | 11 +- 19 files changed, 285 insertions(+), 233 deletions(-) rename docker/{base_ubuntu2204.dockerfile => base_ubuntu2404.dockerfile} (58%) rename docker/{base_ubuntu2204.dockerfile.dockerignore => base_ubuntu2404.dockerfile.dockerignore} (100%) rename docker/{test_ubuntu2204.dockerfile => test_ubuntu2404.dockerfile} (74%) rename docker/{ubuntu2204.dockerfile => ubuntu2404.dockerfile} (89%) diff --git a/.github/workflows/check_n_push_image.yml b/.github/workflows/check_n_push_image.yml index e61c210a..9a9d8e4b 100644 --- a/.github/workflows/check_n_push_image.yml +++ b/.github/workflows/check_n_push_image.yml @@ -19,26 +19,26 @@ on: jobs: check-code: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - - name: Set up Python 3.10 + - name: Set up Python 3.12 uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: '3.12' - name: Lint with ruff and pyright run: | make substitute-sources pip install $(python3 setup.py --install-requirements) pip install $(python3 setup.py --build-requirements) + pip install $(python3 setup.py --lint-requirements) pip install --requirement docs/notebooks/requirements.txt - pip install pre-commit==4.3.0 make pre-commit docker-build-test-autotest: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 @@ -61,8 +61,8 @@ jobs: - name: Create main docker image, run tests and save image for the next job run: | export $(cat .env | xargs) - make docker-image DOCKER_TAG=${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu22.04:${{ steps.get_version.outputs.version }} - docker image save --output /tmp/codeplag-ubuntu22.04.tar ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu22.04:${{ steps.get_version.outputs.version }} + make docker-image DOCKER_TAG=${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu24.04:${{ steps.get_version.outputs.version }} + docker image save --output /tmp/codeplag-ubuntu24.04.tar ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu24.04:${{ steps.get_version.outputs.version }} - name: Pytest coverage comment uses: MishaKav/pytest-coverage-comment@v1 @@ -86,13 +86,13 @@ jobs: if: ${{ startsWith(github.event.ref, 'refs/tags/v') }} uses: actions/upload-artifact@v4 with: - name: codeplag-ubuntu22.04 - path: /tmp/codeplag-ubuntu22.04.tar + name: codeplag-ubuntu24.04 + path: /tmp/codeplag-ubuntu24.04.tar retention-days: 1 if-no-files-found: error push-image: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 needs: [check-code, docker-build-test-autotest] if: startsWith(github.event.ref, 'refs/tags/v') @@ -103,7 +103,7 @@ jobs: - name: Download created in the previous stage image uses: actions/download-artifact@v4 with: - name: codeplag-ubuntu22.04 + name: codeplag-ubuntu24.04 path: /tmp - name: Get current util version @@ -113,8 +113,8 @@ jobs: - name: Load Docker created image run: | - docker load --input /tmp/codeplag-ubuntu22.04.tar - docker image tag ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu22.04:${{ steps.get_version.outputs.version }} ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu22.04:latest + docker load --input /tmp/codeplag-ubuntu24.04.tar + docker image tag ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu24.04:${{ steps.get_version.outputs.version }} ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu24.04:latest - name: Login to Docker Hub uses: docker/login-action@v3 @@ -123,4 +123,4 @@ jobs: password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - name: Push docker image - run: docker image push --all-tags ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu22.04 + run: docker image push --all-tags ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu24.04 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index aae5989b..0f982cc7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,8 +1,8 @@ default_language_version: - python: python3.10 + python: python3.12 repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.14.2 + rev: v0.14.3 hooks: - id: ruff args: [ --fix ] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ff073617..99e5c32a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,7 @@ First of all thank you for your desire to contribute in that project. ## Development environment -Before starting work with this project you need to install [Python 3.10](https://www.python.org/), [Docker](https://www.docker.com/) (for commands like 'make docker-test'). +Before starting work with this project you need to install [Python 3.12](https://www.python.org/), [Docker](https://www.docker.com/) (for commands like 'make docker-test'). After that you'll need to install and setup pre-commit hooks for checking style of source code, formatting it and checking types: diff --git a/Makefile b/Makefile index 3d9ee305..1518f0d2 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,12 @@ -UTIL_VERSION := 0.5.30 -UTIL_NAME := codeplag +UTIL_VERSION := $(shell grep -Po 'version\s*=\s*"\K[\w.]+' pyproject.toml) +UTIL_NAME := $(shell grep -Po 'name\s*=\s*"\K(\w.)+' pyproject.toml) PWD := $(shell pwd) USER_UID ?= $(shell id --user) USER_GID ?= $(shell id --group) -BASE_DOCKER_VERSION := 1.3 -DIST := ubuntu22.04 +BASE_DOCKER_VERSION := 1.0 +DIST := ubuntu24.04 BASE_DOCKER_TAG := $(shell echo $(UTIL_NAME)-base-${DIST}:$(BASE_DOCKER_VERSION)) TEST_DOCKER_TAG := $(shell echo $(UTIL_NAME)-test-${DIST}:$(UTIL_VERSION)) DOCKER_TAG ?= $(shell echo $(UTIL_NAME)-${DIST}:$(UTIL_VERSION)) diff --git a/README.md b/README.md index 4d9fccf4..8d49b0f7 100644 --- a/README.md +++ b/README.md @@ -50,8 +50,8 @@ Program for finding plagiarism in the source code written in Python 3, C, and C+ ### 1.3 Install with package manager apt-get - Requirements: - - OS Ubuntu Linux == 22.04 - - Python version == 3.10 + - OS Ubuntu Linux == 24.04 + - Python version == 3.12 - For this purpose, you need to get installing package from releases [tab](https://github.com/OSLL/code-plagiarism/releases) with extension .deb; - The next step is run commands on the target system: @@ -81,8 +81,8 @@ If you want to use MongoDB cache for saving reports and works metadata, complete # Before local checking, you need to install dependencies into your virtual environment. $ python3 -m pip install --requirement docs/notebooks/requirements.txt $ python3 -m pip install $(python3 -m setup.py --build-requirements) + $ python3 -m pip install $(python3 -m setup.py --lint-requirements) $ python3 -m pip install $(python3 -m setup.py --install-requirements) - $ python3 -m pip install pre-commit==4.3.0 $ make pre-commit ``` diff --git a/debian/control.in b/debian/control.in index 01a3781f..4114b66c 100644 --- a/debian/control.in +++ b/debian/control.in @@ -6,6 +6,6 @@ Build-Depends: debhelper (>= 10) Package: @UTIL_NAME@-util Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, python3 (>= 3.10), python3-pip (>= 19.0), - clang, libncurses5, man +Depends: ${shlibs:Depends}, ${misc:Depends}, python3 (>= 3.12), python3-pip (>= 19.0), + clang, libncurses6, man Description: Program for finding plagiarism in the source code written on Python3, C, C++ based on compare AST metadata. diff --git a/debian/preinst.in b/debian/preinst.in index f7b987d6..898cf7f4 100644 --- a/debian/preinst.in +++ b/debian/preinst.in @@ -2,4 +2,4 @@ echo "Pre installation ($@) ..." -pip3 install @PYTHON_REQUIRED_LIBS@ +pip3 install --break-system-packages @PYTHON_REQUIRED_LIBS@ diff --git a/docker/base_ubuntu2204.dockerfile b/docker/base_ubuntu2404.dockerfile similarity index 58% rename from docker/base_ubuntu2204.dockerfile rename to docker/base_ubuntu2404.dockerfile index 2e10fa9f..300bd09c 100644 --- a/docker/base_ubuntu2204.dockerfile +++ b/docker/base_ubuntu2404.dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:22.04 +FROM ubuntu:24.04 ARG PYTHON_REQUIRED_LIBS ARG UTIL_NAME @@ -9,13 +9,18 @@ RUN if [ "$(dpkg-divert --truename /usr/bin/man)" = "/usr/bin/man.REAL" ]; then dpkg-divert --quiet --remove --rename /usr/bin/man; \ fi RUN apt-get update -RUN apt-get install -y python3-pip -RUN pip3 install --upgrade setuptools -RUN apt-get install -y clang libncurses5 -RUN apt-get install -y man -RUN apt-get install -y vim nano less +RUN apt-get install -y --no-install-recommends \ + python3-pip \ + clang \ + libncurses6 \ + vim \ + nano \ + less +RUN apt-get clean -RUN pip3 install $PYTHON_REQUIRED_LIBS +RUN pip3 install --break-system-packages $PYTHON_REQUIRED_LIBS + +RUN rm --recursive --force /tmp/* /var/tmp/* VOLUME /usr/src/works WORKDIR /usr/src/$UTIL_NAME diff --git a/docker/base_ubuntu2204.dockerfile.dockerignore b/docker/base_ubuntu2404.dockerfile.dockerignore similarity index 100% rename from docker/base_ubuntu2204.dockerfile.dockerignore rename to docker/base_ubuntu2404.dockerfile.dockerignore diff --git a/docker/docker.mk b/docker/docker.mk index 1ed1bae2..854bc803 100644 --- a/docker/docker.mk +++ b/docker/docker.mk @@ -28,7 +28,7 @@ docker-base-image: substitute-sources substitute-docker --tag "$(BASE_DOCKER_TAG)" \ --build-arg PYTHON_REQUIRED_LIBS="$(PYTHON_REQUIRED_LIBS)" \ --build-arg UTIL_NAME="$(UTIL_NAME)" \ - --file docker/base_ubuntu2204.dockerfile \ + --file docker/base_ubuntu2404.dockerfile \ . \ ) @@ -42,7 +42,7 @@ docker-test-image: docker-base-image --build-arg PYTHON_BUILD_LIBS="$(PYTHON_BUILD_LIBS)" \ --build-arg LOGS_PATH="$(LOGS_PATH)" \ --build-arg UTIL_NAME="$(UTIL_NAME)" \ - --file docker/test_ubuntu2204.dockerfile \ + --file docker/test_ubuntu2404.dockerfile \ . .PHONY: docker-test-mongo-run @@ -109,7 +109,7 @@ docker-image: docker-base-image docker-test-image --build-arg UTIL_NAME="$(UTIL_NAME)" \ --build-arg DEBIAN_PACKAGES_PATH="$(DEBIAN_PACKAGES_PATH)" \ --build-arg DEB_PKG_NAME="$(DEB_PKG_NAME)" \ - --file docker/ubuntu2204.dockerfile \ + --file docker/ubuntu2404.dockerfile \ . \ ) diff --git a/docker/test_ubuntu2204.dockerfile b/docker/test_ubuntu2404.dockerfile similarity index 74% rename from docker/test_ubuntu2204.dockerfile rename to docker/test_ubuntu2404.dockerfile index 2d41f03b..78260113 100644 --- a/docker/test_ubuntu2204.dockerfile +++ b/docker/test_ubuntu2404.dockerfile @@ -9,8 +9,8 @@ ARG UTIL_NAME ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update -RUN apt-get install -y debhelper -RUN pip3 install $PYTHON_TEST_LIBS $PYTHON_BUILD_LIBS +RUN apt-get install -y --no-install-recommends debhelper python3-dev build-essential +RUN pip3 install --break-system-packages $PYTHON_TEST_LIBS $PYTHON_BUILD_LIBS RUN mkdir -p $LOGS_PATH # TODO: Move to middle docker file or make another solution @@ -24,4 +24,7 @@ ADD locales/ /usr/src/$UTIL_NAME/locales ADD docker/docker.mk /usr/src/$UTIL_NAME/docker/docker.mk ADD debian/ /usr/src/$UTIL_NAME/debian +RUN apt-get clean +RUN rm --recursive --force /tmp/* /var/tmp/* + CMD make test diff --git a/docker/ubuntu2204.dockerfile b/docker/ubuntu2404.dockerfile similarity index 89% rename from docker/ubuntu2204.dockerfile rename to docker/ubuntu2404.dockerfile index ebec565b..b6ba1d11 100644 --- a/docker/ubuntu2204.dockerfile +++ b/docker/ubuntu2404.dockerfile @@ -13,6 +13,9 @@ RUN apt-get install -y /usr/src/$UTIL_NAME/$DEBIAN_PACKAGES_PATH/$DEB_PKG_NAME.d RUN install -D -m 0644 $DEBIAN_PACKAGES_PATH/$UTIL_NAME.1 /usr/share/man/man1/ RUN rm --recursive /usr/src/$UTIL_NAME/debian +RUN apt-get clean +RUN rm --recursive --force /tmp/* /var/tmp/* + RUN register-python-argcomplete $UTIL_NAME >> ~/.bashrc CMD ["/bin/bash"] diff --git a/locales/codeplag.pot b/locales/codeplag.pot index 965d386c..2134e144 100644 --- a/locales/codeplag.pot +++ b/locales/codeplag.pot @@ -5,74 +5,80 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: codeplag 0.5.24\n" -"POT-Creation-Date: 2025-07-02 00:41+0300\n" +"Project-Id-Version: codeplag 0.6.0\n" +"POT-Creation-Date: 2025-11-04 15:37+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Artyom Semidolin\n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.15.0\n" +"Generated-By: Babel 2.17.0\n" -#: src/codeplag/codeplagcli.py:48 +#: src/codeplag/codeplagcli.py:46 +#, python-brace-format msgid "You cannot specify the same value multiple times. You provided '{values}'." msgstr "" -#: src/codeplag/codeplagcli.py:66 +#: src/codeplag/codeplagcli.py:63 msgid "Enter MongoDB password: " msgstr "" -#: src/codeplag/codeplagcli.py:76 +#: src/codeplag/codeplagcli.py:73 +#, python-brace-format msgid "Directory '{path}' not found or not a directory." msgstr "" -#: src/codeplag/codeplagcli.py:89 +#: src/codeplag/codeplagcli.py:86 +#, python-brace-format msgid "File '{path}' not found or not a file." msgstr "" -#: src/codeplag/codeplagcli.py:101 +#: src/codeplag/codeplagcli.py:98 +#, python-brace-format msgid "Modifies and shows static settings of the '{util_name}' util." msgstr "" -#: src/codeplag/codeplagcli.py:107 +#: src/codeplag/codeplagcli.py:104 +#, python-brace-format msgid "Settings commands of the '{util_name}' util." msgstr "" -#: src/codeplag/codeplagcli.py:116 +#: src/codeplag/codeplagcli.py:113 +#, python-brace-format msgid "Manage the '{util_name}' util settings." msgstr "" -#: src/codeplag/codeplagcli.py:121 +#: src/codeplag/codeplagcli.py:118 msgid "Path to the environment file with GitHub access token." msgstr "" -#: src/codeplag/codeplagcli.py:127 +#: src/codeplag/codeplagcli.py:125 msgid "" "If defined, then saves reports about suspect works into provided file or " "directory. If directory by provided path doesn't exists than saves " "reports as a file." msgstr "" -#: src/codeplag/codeplagcli.py:138 +#: src/codeplag/codeplagcli.py:136 msgid "" "When provided 'csv' saves similar works compare info into csv file. When " "provided 'mongo' saves similar works compare info and works metadata into" " MongoDB." msgstr "" -#: src/codeplag/codeplagcli.py:149 +#: src/codeplag/codeplagcli.py:146 msgid "Show progress of searching plagiarism." msgstr "" -#: src/codeplag/codeplagcli.py:156 +#: src/codeplag/codeplagcli.py:154 msgid "" "When provided '0' show all check works results in the stdout. When " "provided '1' show only new found check works results in the stdout. When " "provided '2' do not show check works result in the stdout." msgstr "" -#: src/codeplag/codeplagcli.py:167 +#: src/codeplag/codeplagcli.py:165 msgid "" "Threshold of analyzer which classifies two work as same. If this number " "is too large, such as 99, then completely matching jobs will be found. " @@ -80,172 +86,176 @@ msgid "" "minimal similarity will be found." msgstr "" -#: src/codeplag/codeplagcli.py:181 +#: src/codeplag/codeplagcli.py:178 msgid "The maximum depth of the AST structure which play role in calculations." msgstr "" -#: src/codeplag/codeplagcli.py:188 +#: src/codeplag/codeplagcli.py:186 msgid "" "The length of N-grams generated to calculate the Jakkar coefficient. A " "long length of N-grams reduces the Jakkar coefficient because there are " "fewer equal sequences of two works." msgstr "" -#: src/codeplag/codeplagcli.py:199 +#: src/codeplag/codeplagcli.py:196 msgid "The language of help messages, generated reports, errors." msgstr "" -#: src/codeplag/codeplagcli.py:205 +#: src/codeplag/codeplagcli.py:203 +#, python-brace-format msgid "" "Sets the threshold for the '{util_name}' util loggers'. Logging messages " "that are less severe than the level will be ignored." msgstr "" -#: src/codeplag/codeplagcli.py:215 +#: src/codeplag/codeplagcli.py:212 msgid "The maximum number of processes that can be used to compare works." msgstr "" -#: src/codeplag/codeplagcli.py:222 +#: src/codeplag/codeplagcli.py:219 msgid "The host address of the MongoDB server." msgstr "" -#: src/codeplag/codeplagcli.py:228 +#: src/codeplag/codeplagcli.py:225 msgid "The port of the MongoDB." msgstr "" -#: src/codeplag/codeplagcli.py:236 +#: src/codeplag/codeplagcli.py:233 msgid "The username for connecting to the MongoDB server." msgstr "" -#: src/codeplag/codeplagcli.py:242 +#: src/codeplag/codeplagcli.py:239 msgid "The password for connecting to the MongoDB server. If empty - hide input." msgstr "" -#: src/codeplag/codeplagcli.py:251 +#: src/codeplag/codeplagcli.py:248 +#, python-brace-format msgid "Show the '{util_name}' util settings." msgstr "" -#: src/codeplag/codeplagcli.py:255 +#: src/codeplag/codeplagcli.py:252 msgid "Start searching similar works." msgstr "" -#: src/codeplag/codeplagcli.py:261 +#: src/codeplag/codeplagcli.py:258 msgid "Absolute or relative path to a local directories with project files." msgstr "" -#: src/codeplag/codeplagcli.py:271 +#: src/codeplag/codeplagcli.py:268 msgid "Absolute or relative path to files on a computer." msgstr "" -#: src/codeplag/codeplagcli.py:278 +#: src/codeplag/codeplagcli.py:276 msgid "" "Choose one of the following modes of searching plagiarism. The " "'many_to_many' mode may require more free memory." msgstr "" -#: src/codeplag/codeplagcli.py:289 +#: src/codeplag/codeplagcli.py:287 msgid "" "A regular expression for filtering checked works by name. Used with " "options 'directories', 'github-user' and 'github-project-folders'." msgstr "" -#: src/codeplag/codeplagcli.py:298 +#: src/codeplag/codeplagcli.py:295 msgid "Ignore the threshold when checking of works." msgstr "" -#: src/codeplag/codeplagcli.py:305 +#: src/codeplag/codeplagcli.py:302 msgid "Extension responsible for the analyzed programming language." msgstr "" -#: src/codeplag/codeplagcli.py:315 +#: src/codeplag/codeplagcli.py:312 msgid "Searching in all branches." msgstr "" -#: src/codeplag/codeplagcli.py:322 +#: src/codeplag/codeplagcli.py:319 msgid "A regular expression to filter searching repositories on GitHub." msgstr "" -#: src/codeplag/codeplagcli.py:329 +#: src/codeplag/codeplagcli.py:326 msgid "URL to file in a GitHub repository." msgstr "" -#: src/codeplag/codeplagcli.py:335 +#: src/codeplag/codeplagcli.py:332 msgid "GitHub organization/user name." msgstr "" -#: src/codeplag/codeplagcli.py:342 +#: src/codeplag/codeplagcli.py:339 msgid "URL to a GitHub project folder." msgstr "" -#: src/codeplag/codeplagcli.py:352 +#: src/codeplag/codeplagcli.py:350 +#, python-brace-format msgid "" "Handling generated by the {util_name} reports as creating html report " "file or show it on console." msgstr "" -#: src/codeplag/codeplagcli.py:360 +#: src/codeplag/codeplagcli.py:357 +#, python-brace-format msgid "Report commands of the '{util_name}' util." msgstr "" -#: src/codeplag/codeplagcli.py:369 +#: src/codeplag/codeplagcli.py:366 msgid "Generate general report from created some time ago report files." msgstr "" -#: src/codeplag/codeplagcli.py:374 +#: src/codeplag/codeplagcli.py:372 msgid "" "Path to save generated report. If it's a directory, then create a file in" " it." msgstr "" -#: src/codeplag/codeplagcli.py:383 +#: src/codeplag/codeplagcli.py:380 msgid "Type of the created report file." msgstr "" -#: src/codeplag/codeplagcli.py:391 +#: src/codeplag/codeplagcli.py:389 msgid "" "Path to first compared works. Can be path to directory or URL to the " "project folder." msgstr "" -#: src/codeplag/codeplagcli.py:401 +#: src/codeplag/codeplagcli.py:399 msgid "" "Path to second compared works. Can be path to directory or URL to the " "project folder." msgstr "" -#: src/codeplag/codeplagcli.py:413 +#: src/codeplag/codeplagcli.py:411 msgid "" "Program help to find similar parts of source codes for the different " "languages." msgstr "" -#: src/codeplag/codeplagcli.py:420 +#: src/codeplag/codeplagcli.py:417 msgid "Print current version number and exit." msgstr "" -#: src/codeplag/codeplagcli.py:426 +#: src/codeplag/codeplagcli.py:423 msgid "Commands help." msgstr "" -#: src/codeplag/codeplagcli.py:441 +#: src/codeplag/codeplagcli.py:438 msgid "No command is provided; please choose one from the available (--help)." msgstr "" -#: src/codeplag/codeplagcli.py:452 +#: src/codeplag/codeplagcli.py:449 msgid "There is nothing to modify; please provide at least one argument." msgstr "" -#: src/codeplag/codeplagcli.py:456 +#: src/codeplag/codeplagcli.py:453 msgid "The'repo-regexp' option requires the provided 'github-user' option." msgstr "" -#: src/codeplag/codeplagcli.py:464 +#: src/codeplag/codeplagcli.py:462 msgid "" "The'path-regexp' option requires the provided 'directories', 'github-" "user', or 'github-project-folder' options." msgstr "" -#: src/codeplag/codeplagcli.py:475 src/codeplag/handlers/report.py:440 +#: src/codeplag/codeplagcli.py:472 src/codeplag/handlers/report.py:440 msgid "All paths must be provided." msgstr "" @@ -338,20 +348,20 @@ msgstr "" msgid "Similar parts of the second program relative to the first" msgstr "" -#: src/templates/general.templ:115 src/templates/general.templ:147 +#: src/templates/general.templ:115 src/templates/general.templ:149 msgid "Part of the first program" msgstr "" -#: src/templates/general.templ:116 src/templates/general.templ:146 +#: src/templates/general.templ:116 src/templates/general.templ:148 msgid "Part of the second program" msgstr "" -#: src/templates/general.templ:117 src/templates/general.templ:148 +#: src/templates/general.templ:117 src/templates/general.templ:150 #: src/templates/sources.templ:88 msgid "Similarity" msgstr "" -#: src/templates/general.templ:144 +#: src/templates/general.templ:146 msgid "Similar parts of the first program relative to the second" msgstr "" diff --git a/locales/translations/en/LC_MESSAGES/codeplag.po b/locales/translations/en/LC_MESSAGES/codeplag.po index f2343509..142ecd70 100644 --- a/locales/translations/en/LC_MESSAGES/codeplag.po +++ b/locales/translations/en/LC_MESSAGES/codeplag.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: codeplag 0.5.23\n" +"Project-Id-Version: codeplag 0.6.0\n" "POT-Creation-Date: 2024-05-21 09:28+0300\n" "PO-Revision-Date: 2025-03-28 12:05+0300\n" "Last-Translator: Artyom Semidolin\n" @@ -14,41 +14,47 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.15.0\n" +"Generated-By: Babel 2.17.0\n" -#: src/codeplag/codeplagcli.py:48 +#: src/codeplag/codeplagcli.py:46 +#, python-brace-format msgid "You cannot specify the same value multiple times. You provided '{values}'." msgstr "You cannot specify the same value multiple times. You provided '{values}'." -#: src/codeplag/codeplagcli.py:66 +#: src/codeplag/codeplagcli.py:63 msgid "Enter MongoDB password: " msgstr "Enter MongoDB password: " -#: src/codeplag/codeplagcli.py:76 +#: src/codeplag/codeplagcli.py:73 +#, python-brace-format msgid "Directory '{path}' not found or not a directory." msgstr "Directory '{path}' not found or not a directory." -#: src/codeplag/codeplagcli.py:89 +#: src/codeplag/codeplagcli.py:86 +#, python-brace-format msgid "File '{path}' not found or not a file." msgstr "File '{path}' not found or not a file." -#: src/codeplag/codeplagcli.py:101 +#: src/codeplag/codeplagcli.py:98 +#, python-brace-format msgid "Modifies and shows static settings of the '{util_name}' util." msgstr "Modifies and shows static settings of the '{util_name}' util." -#: src/codeplag/codeplagcli.py:107 +#: src/codeplag/codeplagcli.py:104 +#, python-brace-format msgid "Settings commands of the '{util_name}' util." msgstr "Settings commands of the '{util_name}' util." -#: src/codeplag/codeplagcli.py:116 +#: src/codeplag/codeplagcli.py:113 +#, python-brace-format msgid "Manage the '{util_name}' util settings." msgstr "Manage the '{util_name}' util settings." -#: src/codeplag/codeplagcli.py:121 +#: src/codeplag/codeplagcli.py:118 msgid "Path to the environment file with GitHub access token." msgstr "Path to the environment file with GitHub access token." -#: src/codeplag/codeplagcli.py:127 +#: src/codeplag/codeplagcli.py:125 msgid "" "If defined, then saves reports about suspect works into provided file or " "directory. If directory by provided path doesn't exists than saves " @@ -58,7 +64,7 @@ msgstr "" "directory. If directory by provided path doesn't exists than saves " "reports as a file." -#: src/codeplag/codeplagcli.py:138 +#: src/codeplag/codeplagcli.py:136 msgid "" "When provided 'csv' saves similar works compare info into csv file. When " "provided 'mongo' saves similar works compare info and works metadata into" @@ -68,11 +74,11 @@ msgstr "" "provided 'mongo' saves similar works compare info and works metadata into" " MongoDB." -#: src/codeplag/codeplagcli.py:149 +#: src/codeplag/codeplagcli.py:146 msgid "Show progress of searching plagiarism." msgstr "Show progress of searching plagiarism." -#: src/codeplag/codeplagcli.py:156 +#: src/codeplag/codeplagcli.py:154 msgid "" "When provided '0' show all check works results in the stdout. When " "provided '1' show only new found check works results in the stdout. When " @@ -82,7 +88,7 @@ msgstr "" "provided '1' show only new found check works results in the stdout. When " "provided '2' do not show check works result in the stdout." -#: src/codeplag/codeplagcli.py:167 +#: src/codeplag/codeplagcli.py:165 msgid "" "Threshold of analyzer which classifies two work as same. If this number " "is too large, such as 99, then completely matching jobs will be found. " @@ -94,11 +100,11 @@ msgstr "" "Otherwise, if this number is small, such as 50, then all work with " "minimal similarity will be found." -#: src/codeplag/codeplagcli.py:181 +#: src/codeplag/codeplagcli.py:178 msgid "The maximum depth of the AST structure which play role in calculations." msgstr "The maximum depth of the AST structure which play role in calculations." -#: src/codeplag/codeplagcli.py:188 +#: src/codeplag/codeplagcli.py:186 msgid "" "The length of N-grams generated to calculate the Jakkar coefficient. A " "long length of N-grams reduces the Jakkar coefficient because there are " @@ -108,11 +114,12 @@ msgstr "" "long length of N-grams reduces the Jakkar coefficient because there are " "fewer equal sequences of two works." -#: src/codeplag/codeplagcli.py:199 +#: src/codeplag/codeplagcli.py:196 msgid "The language of help messages, generated reports, errors." msgstr "The language of help messages, generated reports, errors." -#: src/codeplag/codeplagcli.py:205 +#: src/codeplag/codeplagcli.py:203 +#, python-brace-format msgid "" "Sets the threshold for the '{util_name}' util loggers'. Logging messages " "that are less severe than the level will be ignored." @@ -120,43 +127,44 @@ msgstr "" "Sets the threshold for the '{util_name}' util loggers'. Logging messages " "that are less severe than the level will be ignored." -#: src/codeplag/codeplagcli.py:215 +#: src/codeplag/codeplagcli.py:212 msgid "The maximum number of processes that can be used to compare works." msgstr "The maximum number of processes that can be used to compare works." -#: src/codeplag/codeplagcli.py:222 +#: src/codeplag/codeplagcli.py:219 msgid "The host address of the MongoDB server." msgstr "The host address of the MongoDB server." -#: src/codeplag/codeplagcli.py:228 +#: src/codeplag/codeplagcli.py:225 msgid "The port of the MongoDB." msgstr "The port of the MongoDB." -#: src/codeplag/codeplagcli.py:236 +#: src/codeplag/codeplagcli.py:233 msgid "The username for connecting to the MongoDB server." msgstr "The username for connecting to the MongoDB server." -#: src/codeplag/codeplagcli.py:242 +#: src/codeplag/codeplagcli.py:239 msgid "The password for connecting to the MongoDB server. If empty - hide input." msgstr "The password for connecting to the MongoDB server. If empty - hide input." -#: src/codeplag/codeplagcli.py:251 +#: src/codeplag/codeplagcli.py:248 +#, python-brace-format msgid "Show the '{util_name}' util settings." msgstr "Show the '{util_name}' util settings." -#: src/codeplag/codeplagcli.py:255 +#: src/codeplag/codeplagcli.py:252 msgid "Start searching similar works." msgstr "Start searching similar works." -#: src/codeplag/codeplagcli.py:261 +#: src/codeplag/codeplagcli.py:258 msgid "Absolute or relative path to a local directories with project files." msgstr "Absolute or relative path to a local directories with project files." -#: src/codeplag/codeplagcli.py:271 +#: src/codeplag/codeplagcli.py:268 msgid "Absolute or relative path to files on a computer." msgstr "Absolute or relative path to files on a computer." -#: src/codeplag/codeplagcli.py:278 +#: src/codeplag/codeplagcli.py:276 msgid "" "Choose one of the following modes of searching plagiarism. The " "'many_to_many' mode may require more free memory." @@ -164,7 +172,7 @@ msgstr "" "Choose one of the following modes of searching plagiarism. The " "'many_to_many' mode may require more free memory." -#: src/codeplag/codeplagcli.py:289 +#: src/codeplag/codeplagcli.py:287 msgid "" "A regular expression for filtering checked works by name. Used with " "options 'directories', 'github-user' and 'github-project-folders'." @@ -172,35 +180,36 @@ msgstr "" "A regular expression for filtering checked works by name. Used with " "options 'directories', 'github-user' and 'github-project-folders'." -#: src/codeplag/codeplagcli.py:298 +#: src/codeplag/codeplagcli.py:295 msgid "Ignore the threshold when checking of works." msgstr "Ignore the threshold when checking of works." -#: src/codeplag/codeplagcli.py:305 +#: src/codeplag/codeplagcli.py:302 msgid "Extension responsible for the analyzed programming language." msgstr "Extension responsible for the analyzed programming language." -#: src/codeplag/codeplagcli.py:315 +#: src/codeplag/codeplagcli.py:312 msgid "Searching in all branches." msgstr "Searching in all branches." -#: src/codeplag/codeplagcli.py:322 +#: src/codeplag/codeplagcli.py:319 msgid "A regular expression to filter searching repositories on GitHub." msgstr "A regular expression to filter searching repositories on GitHub." -#: src/codeplag/codeplagcli.py:329 +#: src/codeplag/codeplagcli.py:326 msgid "URL to file in a GitHub repository." msgstr "URL to file in a GitHub repository." -#: src/codeplag/codeplagcli.py:335 +#: src/codeplag/codeplagcli.py:332 msgid "GitHub organization/user name." msgstr "GitHub organization/user name." -#: src/codeplag/codeplagcli.py:342 +#: src/codeplag/codeplagcli.py:339 msgid "URL to a GitHub project folder." msgstr "URL to a GitHub project folder." -#: src/codeplag/codeplagcli.py:352 +#: src/codeplag/codeplagcli.py:350 +#, python-brace-format msgid "" "Handling generated by the {util_name} reports as creating html report " "file or show it on console." @@ -208,15 +217,16 @@ msgstr "" "Handling generated by the {util_name} reports as creating html report " "file or show it on console." -#: src/codeplag/codeplagcli.py:360 +#: src/codeplag/codeplagcli.py:357 +#, python-brace-format msgid "Report commands of the '{util_name}' util." msgstr "Report commands of the '{util_name}' util." -#: src/codeplag/codeplagcli.py:369 +#: src/codeplag/codeplagcli.py:366 msgid "Generate general report from created some time ago report files." msgstr "Generate general report from created some time ago report files." -#: src/codeplag/codeplagcli.py:374 +#: src/codeplag/codeplagcli.py:372 msgid "" "Path to save generated report. If it's a directory, then create a file in" " it." @@ -224,11 +234,11 @@ msgstr "" "Path to save generated report. If it's a directory, then create a file in" " it." -#: src/codeplag/codeplagcli.py:383 +#: src/codeplag/codeplagcli.py:380 msgid "Type of the created report file." msgstr "Type of the created report file." -#: src/codeplag/codeplagcli.py:391 +#: src/codeplag/codeplagcli.py:389 msgid "" "Path to first compared works. Can be path to directory or URL to the " "project folder." @@ -236,7 +246,7 @@ msgstr "" "Path to first compared works. Can be path to directory or URL to the " "project folder." -#: src/codeplag/codeplagcli.py:401 +#: src/codeplag/codeplagcli.py:399 msgid "" "Path to second compared works. Can be path to directory or URL to the " "project folder." @@ -244,7 +254,7 @@ msgstr "" "Path to second compared works. Can be path to directory or URL to the " "project folder." -#: src/codeplag/codeplagcli.py:413 +#: src/codeplag/codeplagcli.py:411 msgid "" "Program help to find similar parts of source codes for the different " "languages." @@ -252,27 +262,27 @@ msgstr "" "Program help to find similar parts of source codes for the different " "languages." -#: src/codeplag/codeplagcli.py:420 +#: src/codeplag/codeplagcli.py:417 msgid "Print current version number and exit." msgstr "Print current version number and exit." -#: src/codeplag/codeplagcli.py:426 +#: src/codeplag/codeplagcli.py:423 msgid "Commands help." msgstr "Commands help." -#: src/codeplag/codeplagcli.py:441 +#: src/codeplag/codeplagcli.py:438 msgid "No command is provided; please choose one from the available (--help)." msgstr "No command is provided; please choose one from the available (--help)." -#: src/codeplag/codeplagcli.py:452 +#: src/codeplag/codeplagcli.py:449 msgid "There is nothing to modify; please provide at least one argument." msgstr "There is nothing to modify; please provide at least one argument." -#: src/codeplag/codeplagcli.py:456 +#: src/codeplag/codeplagcli.py:453 msgid "The'repo-regexp' option requires the provided 'github-user' option." msgstr "The'repo-regexp' option requires the provided 'github-user' option." -#: src/codeplag/codeplagcli.py:464 +#: src/codeplag/codeplagcli.py:462 msgid "" "The'path-regexp' option requires the provided 'directories', 'github-" "user', or 'github-project-folder' options." @@ -280,7 +290,7 @@ msgstr "" "The'path-regexp' option requires the provided 'directories', 'github-" "user', or 'github-project-folder' options." -#: src/codeplag/codeplagcli.py:475 src/codeplag/handlers/report.py:440 +#: src/codeplag/codeplagcli.py:472 src/codeplag/handlers/report.py:440 msgid "All paths must be provided." msgstr "All or none of the root paths must be specified." @@ -373,20 +383,20 @@ msgstr "Similarity of structures" msgid "Similar parts of the second program relative to the first" msgstr "Similar parts of the second program relative to the first" -#: src/templates/general.templ:115 src/templates/general.templ:147 +#: src/templates/general.templ:115 src/templates/general.templ:149 msgid "Part of the first program" msgstr "Part of the first program" -#: src/templates/general.templ:116 src/templates/general.templ:146 +#: src/templates/general.templ:116 src/templates/general.templ:148 msgid "Part of the second program" msgstr "Part of the second program" -#: src/templates/general.templ:117 src/templates/general.templ:148 +#: src/templates/general.templ:117 src/templates/general.templ:150 #: src/templates/sources.templ:88 msgid "Similarity" msgstr "Similarity" -#: src/templates/general.templ:144 +#: src/templates/general.templ:146 msgid "Similar parts of the first program relative to the second" msgstr "Similar parts of the first program relative to the second" diff --git a/locales/translations/ru/LC_MESSAGES/codeplag.po b/locales/translations/ru/LC_MESSAGES/codeplag.po index 39a99795..6e8e3709 100644 --- a/locales/translations/ru/LC_MESSAGES/codeplag.po +++ b/locales/translations/ru/LC_MESSAGES/codeplag.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: codeplag 0.5.23\n" +"Project-Id-Version: codeplag 0.6.0\n" "POT-Creation-Date: 2024-05-21 09:28+0300\n" "PO-Revision-Date: 2025-03-28 12:05+0300\n" "Last-Translator: Artyom Semidolin\n" @@ -15,43 +15,49 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.15.0\n" +"Generated-By: Babel 2.17.0\n" -#: src/codeplag/codeplagcli.py:48 +#: src/codeplag/codeplagcli.py:46 +#, python-brace-format msgid "You cannot specify the same value multiple times. You provided '{values}'." msgstr "" "Нельзя указать одно и тоже значение несколько раз. Было указано " "'{values}'." -#: src/codeplag/codeplagcli.py:66 +#: src/codeplag/codeplagcli.py:63 msgid "Enter MongoDB password: " msgstr "Введите пароль от MongoDB: " -#: src/codeplag/codeplagcli.py:76 +#: src/codeplag/codeplagcli.py:73 +#, python-brace-format msgid "Directory '{path}' not found or not a directory." msgstr "Каталог '{path}' не найден или он не является каталогом." -#: src/codeplag/codeplagcli.py:89 +#: src/codeplag/codeplagcli.py:86 +#, python-brace-format msgid "File '{path}' not found or not a file." msgstr "Файл '{path}' не найден или он не является файлом." -#: src/codeplag/codeplagcli.py:101 +#: src/codeplag/codeplagcli.py:98 +#, python-brace-format msgid "Modifies and shows static settings of the '{util_name}' util." msgstr "Изменение и отображение статических настроек утилиты '{util_name}'." -#: src/codeplag/codeplagcli.py:107 +#: src/codeplag/codeplagcli.py:104 +#, python-brace-format msgid "Settings commands of the '{util_name}' util." msgstr "Команды настройки утилиты '{util_name}'." -#: src/codeplag/codeplagcli.py:116 +#: src/codeplag/codeplagcli.py:113 +#, python-brace-format msgid "Manage the '{util_name}' util settings." msgstr "Модификация настроек утилиты '{util_name}'." -#: src/codeplag/codeplagcli.py:121 +#: src/codeplag/codeplagcli.py:118 msgid "Path to the environment file with GitHub access token." msgstr "Путь к файлу окружения с токеном доступа к GitHub." -#: src/codeplag/codeplagcli.py:127 +#: src/codeplag/codeplagcli.py:125 msgid "" "If defined, then saves reports about suspect works into provided file or " "directory. If directory by provided path doesn't exists than saves " @@ -61,7 +67,7 @@ msgstr "" "указанный файл или папку. Если каталог по указанному пути не существует, " "то сохраняет отчеты в файл." -#: src/codeplag/codeplagcli.py:138 +#: src/codeplag/codeplagcli.py:136 msgid "" "When provided 'csv' saves similar works compare info into csv file. When " "provided 'mongo' saves similar works compare info and works metadata into" @@ -71,11 +77,11 @@ msgstr "" " csv файл. При заданном значении 'mongo' сохраняет результаты сравнения " "схожих работ и метаданные работ в MongoDB." -#: src/codeplag/codeplagcli.py:149 +#: src/codeplag/codeplagcli.py:146 msgid "Show progress of searching plagiarism." msgstr "Показывать прогресс выполнения поиска схожих работ." -#: src/codeplag/codeplagcli.py:156 +#: src/codeplag/codeplagcli.py:154 msgid "" "When provided '0' show all check works results in the stdout. When " "provided '1' show only new found check works results in the stdout. When " @@ -86,7 +92,7 @@ msgstr "" "результаты проверок. При заданном значении '2' не показывать результаты " "проверок в stdout." -#: src/codeplag/codeplagcli.py:167 +#: src/codeplag/codeplagcli.py:165 msgid "" "Threshold of analyzer which classifies two work as same. If this number " "is too large, such as 99, then completely matching jobs will be found. " @@ -99,11 +105,11 @@ msgstr "" "будет невелико, например, 50, то будут найдены все работы с минимальным " "сходством." -#: src/codeplag/codeplagcli.py:181 +#: src/codeplag/codeplagcli.py:178 msgid "The maximum depth of the AST structure which play role in calculations." msgstr "Максимальная глубина структуры AST, учитываемая при структурном сравнении." -#: src/codeplag/codeplagcli.py:188 +#: src/codeplag/codeplagcli.py:186 msgid "" "The length of N-grams generated to calculate the Jakkar coefficient. A " "long length of N-grams reduces the Jakkar coefficient because there are " @@ -113,11 +119,12 @@ msgstr "" "Большая длина N-грамм уменьшает коэффициент Жаккара, поскольку количество" " одинаковых последовательностей из двух работ становится меньше." -#: src/codeplag/codeplagcli.py:199 +#: src/codeplag/codeplagcli.py:196 msgid "The language of help messages, generated reports, errors." msgstr "Язык справочных сообщений, сгенерированных отчетов, ошибок." -#: src/codeplag/codeplagcli.py:205 +#: src/codeplag/codeplagcli.py:203 +#, python-brace-format msgid "" "Sets the threshold for the '{util_name}' util loggers'. Logging messages " "that are less severe than the level will be ignored." @@ -126,45 +133,46 @@ msgstr "" "Сообщения, которые менее серьезны, чем это значение, будут " "игнорироваться." -#: src/codeplag/codeplagcli.py:215 +#: src/codeplag/codeplagcli.py:212 msgid "The maximum number of processes that can be used to compare works." msgstr "" "Максимальное количество процессов, которые можно задействовать для " "сравнения работ." -#: src/codeplag/codeplagcli.py:222 +#: src/codeplag/codeplagcli.py:219 msgid "The host address of the MongoDB server." msgstr "Адрес хоста сервера MongoDB." -#: src/codeplag/codeplagcli.py:228 +#: src/codeplag/codeplagcli.py:225 msgid "The port of the MongoDB." msgstr "Порт MongoDB." -#: src/codeplag/codeplagcli.py:236 +#: src/codeplag/codeplagcli.py:233 msgid "The username for connecting to the MongoDB server." msgstr "Имя пользователя для подключения к серверу MongoDB." -#: src/codeplag/codeplagcli.py:242 +#: src/codeplag/codeplagcli.py:239 msgid "The password for connecting to the MongoDB server. If empty - hide input." msgstr "Пароль для подключения к серверу MongoDB. Если пуст - скрытый ввод." -#: src/codeplag/codeplagcli.py:251 +#: src/codeplag/codeplagcli.py:248 +#, python-brace-format msgid "Show the '{util_name}' util settings." msgstr "Показать настройки утилиты '{util_name}'." -#: src/codeplag/codeplagcli.py:255 +#: src/codeplag/codeplagcli.py:252 msgid "Start searching similar works." msgstr "Начать поиск схожих работ." -#: src/codeplag/codeplagcli.py:261 +#: src/codeplag/codeplagcli.py:258 msgid "Absolute or relative path to a local directories with project files." msgstr "Абсолютный или относительный путь к локальным папкам с файлами проекта." -#: src/codeplag/codeplagcli.py:271 +#: src/codeplag/codeplagcli.py:268 msgid "Absolute or relative path to files on a computer." msgstr "Абсолютный или относительный путь к файлам на компьютере." -#: src/codeplag/codeplagcli.py:278 +#: src/codeplag/codeplagcli.py:276 msgid "" "Choose one of the following modes of searching plagiarism. The " "'many_to_many' mode may require more free memory." @@ -172,7 +180,7 @@ msgstr "" "Выберите один из следующих режимов поиска схожих работ. Режим " "'many_to_many' может требовать больше свободной памяти." -#: src/codeplag/codeplagcli.py:289 +#: src/codeplag/codeplagcli.py:287 msgid "" "A regular expression for filtering checked works by name. Used with " "options 'directories', 'github-user' and 'github-project-folders'." @@ -181,35 +189,36 @@ msgstr "" "Используется с аргументами 'directories', 'github-user' или 'github-" "project-folders'." -#: src/codeplag/codeplagcli.py:298 +#: src/codeplag/codeplagcli.py:295 msgid "Ignore the threshold when checking of works." msgstr "Игнорировать пороговое значение при проверке работ." -#: src/codeplag/codeplagcli.py:305 +#: src/codeplag/codeplagcli.py:302 msgid "Extension responsible for the analyzed programming language." msgstr "Расширение проверяемых работ." -#: src/codeplag/codeplagcli.py:315 +#: src/codeplag/codeplagcli.py:312 msgid "Searching in all branches." msgstr "Поиск по всем веткам." -#: src/codeplag/codeplagcli.py:322 +#: src/codeplag/codeplagcli.py:319 msgid "A regular expression to filter searching repositories on GitHub." msgstr "Регулярное выражение для фильтрации искомых репозиториев на GitHub." -#: src/codeplag/codeplagcli.py:329 +#: src/codeplag/codeplagcli.py:326 msgid "URL to file in a GitHub repository." msgstr "URL до файла в репозитории на GitHub." -#: src/codeplag/codeplagcli.py:335 +#: src/codeplag/codeplagcli.py:332 msgid "GitHub organization/user name." msgstr "Название организации или имя пользователя на GitHub." -#: src/codeplag/codeplagcli.py:342 +#: src/codeplag/codeplagcli.py:339 msgid "URL to a GitHub project folder." msgstr "URL до какой-либо папки проекта на GitHub." -#: src/codeplag/codeplagcli.py:352 +#: src/codeplag/codeplagcli.py:350 +#, python-brace-format msgid "" "Handling generated by the {util_name} reports as creating html report " "file or show it on console." @@ -217,15 +226,16 @@ msgstr "" "Обработка отчетов, сгенерированных с помощью {util_name}, в виде создания" " файла отчета в формате html или отображения его на консоли." -#: src/codeplag/codeplagcli.py:360 +#: src/codeplag/codeplagcli.py:357 +#, python-brace-format msgid "Report commands of the '{util_name}' util." msgstr "Команды для работы с отчётами утилиты '{util_name}'." -#: src/codeplag/codeplagcli.py:369 +#: src/codeplag/codeplagcli.py:366 msgid "Generate general report from created some time ago report files." msgstr "Создание общего отчёта из созданных ранее файлов отчётов." -#: src/codeplag/codeplagcli.py:374 +#: src/codeplag/codeplagcli.py:372 msgid "" "Path to save generated report. If it's a directory, then create a file in" " it." @@ -233,11 +243,11 @@ msgstr "" "Путь для сохранения созданного отчёта. Если передан путь до папки, то " "создаёт отчёт в ней." -#: src/codeplag/codeplagcli.py:383 +#: src/codeplag/codeplagcli.py:380 msgid "Type of the created report file." msgstr "Тип создаваемого файла отчёта." -#: src/codeplag/codeplagcli.py:391 +#: src/codeplag/codeplagcli.py:389 msgid "" "Path to first compared works. Can be path to directory or URL to the " "project folder." @@ -245,7 +255,7 @@ msgstr "" "Путь к первым сравниваемым файлам. Это может быть путь к директории или " "URL к папке проекта." -#: src/codeplag/codeplagcli.py:401 +#: src/codeplag/codeplagcli.py:399 msgid "" "Path to second compared works. Can be path to directory or URL to the " "project folder." @@ -253,7 +263,7 @@ msgstr "" "Путь ко вторым сравниваемым файлам. Это может быть путь к директории или " "URL к папке проекта." -#: src/codeplag/codeplagcli.py:413 +#: src/codeplag/codeplagcli.py:411 msgid "" "Program help to find similar parts of source codes for the different " "languages." @@ -261,31 +271,31 @@ msgstr "" "Программа помогает находить схожие части исходных кодов для разных языков" " программирования." -#: src/codeplag/codeplagcli.py:420 +#: src/codeplag/codeplagcli.py:417 msgid "Print current version number and exit." msgstr "Выводит текущую версию программы." -#: src/codeplag/codeplagcli.py:426 +#: src/codeplag/codeplagcli.py:423 msgid "Commands help." msgstr "Справка по командам." -#: src/codeplag/codeplagcli.py:441 +#: src/codeplag/codeplagcli.py:438 msgid "No command is provided; please choose one from the available (--help)." msgstr "" "Ни одна из команд не выбрана, пожалуйста, выбери одну из доступных команд" " (--help)." -#: src/codeplag/codeplagcli.py:452 +#: src/codeplag/codeplagcli.py:449 msgid "There is nothing to modify; please provide at least one argument." msgstr "" "Нечего модифицировать, пожалуйста, выберите один из параметров для " "модификации." -#: src/codeplag/codeplagcli.py:456 +#: src/codeplag/codeplagcli.py:453 msgid "The'repo-regexp' option requires the provided 'github-user' option." msgstr "Аргумент 'repo-regexp' требует заданного параметра 'github-user'." -#: src/codeplag/codeplagcli.py:464 +#: src/codeplag/codeplagcli.py:462 msgid "" "The'path-regexp' option requires the provided 'directories', 'github-" "user', or 'github-project-folder' options." @@ -293,7 +303,7 @@ msgstr "" "Аргумент 'path-regexp' требует заданного параметра 'directories', " "'github-user' или 'github-project-folder'." -#: src/codeplag/codeplagcli.py:475 src/codeplag/handlers/report.py:440 +#: src/codeplag/codeplagcli.py:472 src/codeplag/handlers/report.py:440 msgid "All paths must be provided." msgstr "Необходимо указать все корневые пути или не указывать ни одного." @@ -386,20 +396,20 @@ msgstr "Схожесть структур" msgid "Similar parts of the second program relative to the first" msgstr "Схожие части второй программы относительно первой" -#: src/templates/general.templ:115 src/templates/general.templ:147 +#: src/templates/general.templ:115 src/templates/general.templ:149 msgid "Part of the first program" msgstr "Часть первой программ" -#: src/templates/general.templ:116 src/templates/general.templ:146 +#: src/templates/general.templ:116 src/templates/general.templ:148 msgid "Part of the second program" msgstr "Часть второй программы" -#: src/templates/general.templ:117 src/templates/general.templ:148 +#: src/templates/general.templ:117 src/templates/general.templ:150 #: src/templates/sources.templ:88 msgid "Similarity" msgstr "Схожесть" -#: src/templates/general.templ:144 +#: src/templates/general.templ:146 msgid "Similar parts of the first program relative to the second" msgstr "Схожие части первой программы относительно второй" diff --git a/pyproject.toml b/pyproject.toml index cb26497a..6241ce3d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,9 @@ [project] +name = "codeplag" +version = "0.6.0" description = "Code plagiarism searching package." readme = "README.md" -requires-python = "~=3.10" +requires-python = "~=3.12" [tool.ruff] builtins = ["_"] @@ -45,7 +47,7 @@ max-complexity = 12 exclude = ["*.ipynb"] [tool.pyright] -pythonVersion = "3.10" +pythonVersion = "3.12" include = [ "src", diff --git a/setup.py b/setup.py index 6f70b0f4..b15e6e12 100644 --- a/setup.py +++ b/setup.py @@ -9,6 +9,11 @@ "setuptools~=75.8.1", "Jinja2~=3.1.5", ) +# fmt: off +LINT_REQUIREMENTS: tuple[str, ...] = ( + "pre-commit~=4.3.0", +) +# fmt: on TEST_REQUIREMENTS: tuple[str, ...] = ( "pytest~=8.4.2", "pytest-mock~=3.15.1", @@ -19,9 +24,9 @@ "numpy~=1.26.4", "pandas~=2.2.3", "ccsyspath~=1.1.0", - "clang~=14.0.6", - "llvmlite~=0.42.0", - "libclang~=14.0.6", + "clang~=18.1.8", + "llvmlite~=0.45.1", + "libclang~=18.1.1", "python-decouple~=3.8", "requests~=2.32.3", "typing-extensions~=4.12.2", @@ -38,13 +43,16 @@ if "--build-requirements" in sys.argv: print(" ".join(BUILD_REQUIREMENTS)) sys.exit(0) +if "--lint-requirements" in sys.argv: + print(" ".join(LINT_REQUIREMENTS)) + sys.exit(0) if "--test-requirements" in sys.argv: print(" ".join(TEST_REQUIREMENTS)) sys.exit(0) -elif "--install-requirements" in sys.argv: +if "--install-requirements" in sys.argv: print(" ".join(INSTALL_REQUIREMENTS)) sys.exit(0) -elif UTIL_NAME is None or UTIL_VERSION is None: +if UTIL_NAME is None or UTIL_VERSION is None: print("Please provide UTIL_NAME and UTIL_VERSION environment variables.") sys.exit(1) try: @@ -74,7 +82,7 @@ "Intended Audience :: Education", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.12", "Topic :: Software Development :: Plagiarism Detection", ], package_dir={"": "src"}, @@ -85,7 +93,7 @@ ], language_level=3, ), - python_requires=">=3.10", + python_requires=">=3.12", install_requires=INSTALL_REQUIREMENTS, entry_points={ "console_scripts": [ diff --git a/src/codeplag/codeplagcli.py b/src/codeplag/codeplagcli.py index 85e77265..dcf39c80 100644 --- a/src/codeplag/codeplagcli.py +++ b/src/codeplag/codeplagcli.py @@ -1,14 +1,10 @@ """This module consist the CLI of the codeplag util and necessary internal classes for it.""" -from __future__ import annotations - import argparse import builtins import getpass from pathlib import Path -from typing import Sequence - -from typing_extensions import Self +from typing import Sequence, Self from codeplag.consts import ( DEFAULT_MODE, @@ -32,7 +28,7 @@ builtins.__dict__["_"] = builtins.__dict__.get("_", str) -class CheckUniqueStore(argparse.Action): +class CheckUniqueStoreAction(argparse.Action): """Checks that the list of arguments contains no duplicates, then stores.""" def __call__( # pyright: ignore[reportIncompatibleMethodOverride] @@ -60,7 +56,7 @@ def __call__( # pyright: ignore[reportIncompatibleMethodOverride] namespace: argparse.Namespace, values: str | None = None, _option_string: str | None = None, - ): + ) -> None: if values: setattr(namespace, self.dest, values) else: @@ -77,7 +73,7 @@ def __new__(cls: type["DirPath"], *args: str, **kwargs) -> Path: _("Directory '{path}' not found or not a directory.").format(path=path) ) - return Path.__new__(Path, *args, **kwargs).resolve() + return path.resolve() class FilePath(Path): @@ -90,7 +86,7 @@ def __new__(cls: type["FilePath"], *args: str, **kwargs) -> Path: _("File '{path}' not found or not a file.").format(path=path) ) - return Path.__new__(Path, *args, **kwargs).resolve() + return path.resolve() class CodeplagCLI(argparse.ArgumentParser): @@ -261,7 +257,7 @@ def __add_check_path(self: Self, subparsers: argparse._SubParsersAction) -> None type=DirPath, help=_("Absolute or relative path to a local directories with project files."), nargs="+", - action=CheckUniqueStore, + action=CheckUniqueStoreAction, default=[], ) check.add_argument( @@ -271,7 +267,7 @@ def __add_check_path(self: Self, subparsers: argparse._SubParsersAction) -> None type=FilePath, help=_("Absolute or relative path to files on a computer."), nargs="+", - action=CheckUniqueStore, + action=CheckUniqueStoreAction, default=[], ) check.add_argument( @@ -329,7 +325,7 @@ def __add_check_path(self: Self, subparsers: argparse._SubParsersAction) -> None type=GitHubContentUrl, help=_("URL to file in a GitHub repository."), nargs="+", - action=CheckUniqueStore, + action=CheckUniqueStoreAction, default=[], ) check_github.add_argument( @@ -342,7 +338,7 @@ def __add_check_path(self: Self, subparsers: argparse._SubParsersAction) -> None type=GitHubContentUrl, help=_("URL to a GitHub project folder."), nargs="+", - action=CheckUniqueStore, + action=CheckUniqueStoreAction, default=[], ) diff --git a/src/codeplag/cplag/utils.py b/src/codeplag/cplag/utils.py index a66cfa62..63ee5266 100644 --- a/src/codeplag/cplag/utils.py +++ b/src/codeplag/cplag/utils.py @@ -1,4 +1,5 @@ import logging +import sys from pathlib import Path from tempfile import NamedTemporaryFile from typing import Final @@ -11,12 +12,16 @@ from codeplag.cplag.tree import get_features from codeplag.featurescache import AbstractFeaturesCache from codeplag.getfeatures import AbstractGetter, get_files_path_from_directory -from codeplag.logger import log_err -from codeplag.types import ASTFeatures +from codeplag.logger import codeplag_logger, log_err +from codeplag.types import ASTFeatures, ExitCode from webparsers.types import WorkInfo # FIXME: Dirty hook for finding libclang so file -LIBCLANG_SO_FILE_PATH: Final[Path] = Path("/usr/lib/llvm-14/lib/libclang-14.so.1") +try: + LIBCLANG_SO_FILE_PATH: Final[Path] = next(Path("/usr/lib/").glob("llvm-*/lib/libclang-*.so.1")) +except StopIteration: + codeplag_logger.error("Failed to find libclang so file.") + sys.exit(ExitCode.EXIT_UNKNOWN) Config.set_library_file(LIBCLANG_SO_FILE_PATH) From 2c3f80e6147fd62c09be715af459a6f26cecf13d Mon Sep 17 00:00:00 2001 From: Artanias <43622365+Artanias@users.noreply.github.com> Date: Tue, 4 Nov 2025 15:54:22 +0300 Subject: [PATCH 2/9] fix: pre-commit issues. --- src/codeplag/codeplagcli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/codeplag/codeplagcli.py b/src/codeplag/codeplagcli.py index dcf39c80..c5cc210d 100644 --- a/src/codeplag/codeplagcli.py +++ b/src/codeplag/codeplagcli.py @@ -4,7 +4,7 @@ import builtins import getpass from pathlib import Path -from typing import Sequence, Self +from typing import Self, Sequence from codeplag.consts import ( DEFAULT_MODE, From 703cb9cf4e2708d95e952ab80ae18fbfb21688a3 Mon Sep 17 00:00:00 2001 From: Artanias <43622365+Artanias@users.noreply.github.com> Date: Tue, 4 Nov 2025 19:46:54 +0300 Subject: [PATCH 3/9] refactor: extract fields from pyproject.toml with diffrerent regex. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 1518f0d2..258b692f 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -UTIL_VERSION := $(shell grep -Po 'version\s*=\s*"\K[\w.]+' pyproject.toml) -UTIL_NAME := $(shell grep -Po 'name\s*=\s*"\K(\w.)+' pyproject.toml) +UTIL_VERSION := $(shell grep -Po 'version\s*=\s*"\K[\d.]+' pyproject.toml) +UTIL_NAME := $(shell grep -Po 'name\s*=\s*"\K\w+' pyproject.toml) PWD := $(shell pwd) USER_UID ?= $(shell id --user) From 3e38bf148bcd622cd0985d71122ed4d5cedf63fc Mon Sep 17 00:00:00 2001 From: Artanias <43622365+Artanias@users.noreply.github.com> Date: Wed, 5 Nov 2025 00:44:15 +0300 Subject: [PATCH 4/9] build: moves most sections from setup.py to the pyproject.toml. --- Makefile | 4 ++-- pyproject.toml | 46 ++++++++++++++++++++++++++++++++++++++++++---- setup.py | 30 +----------------------------- 3 files changed, 45 insertions(+), 35 deletions(-) diff --git a/Makefile b/Makefile index 258b692f..2e5bfc14 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -UTIL_VERSION := $(shell grep -Po 'version\s*=\s*"\K[\d.]+' pyproject.toml) -UTIL_NAME := $(shell grep -Po 'name\s*=\s*"\K\w+' pyproject.toml) +UTIL_VERSION := $(shell grep -Po '^version\s*=\s*"\K[\d.]+' pyproject.toml) +UTIL_NAME := $(shell grep -Po '^name\s*=\s*"\K\w+' pyproject.toml) PWD := $(shell pwd) USER_UID ?= $(shell id --user) diff --git a/pyproject.toml b/pyproject.toml index 6241ce3d..9ff3a057 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,8 +2,49 @@ name = "codeplag" version = "0.6.0" description = "Code plagiarism searching package." -readme = "README.md" +authors = [ + { name = "Artyom Semidolin, Dmitry Nikolaev, Alexander Evsikov" } +] +readme = {file = "README.md", content-type = "text/markdown"} +license = "MIT" +license-files = ["LICENSE"] requires-python = "~=3.12" +classifiers = [ + "Development Status :: 4 - Beta", + "Environment :: Console", + "Intended Audience :: Education", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.12", + "Topic :: Software Development :: Plagiarism Detection", +] +dependencies = [ + "argcomplete~=3.5.3", + "numpy~=1.26.4", + "pandas~=2.2.3", + "ccsyspath~=1.1.0", + "clang~=18.1.8", + "llvmlite~=0.45.1", + "libclang~=18.1.1", + "python-decouple~=3.8", + "requests~=2.32.3", + "typing-extensions~=4.12.2", + "aiohttp~=3.9.3", + "Jinja2~=3.1.5", + "cachetools==5.5.2", + "gidgethub~=5.3.0", + "pymongo~=4.12.1", +] + +[project.urls] +Repository = "https://github.com/OSLL/code-plagiarism" +Issues = "https://github.com/OSLL/code-plagiarism/issues" + +[project.scripts] +codeplag = "codeplag:main" + +[build-system] +requires = ["setuptools~=80.9.0", "Cython~=3.1.6"] +build-backend = "setuptools.build_meta" [tool.ruff] builtins = ["_"] @@ -61,9 +102,6 @@ executionEnvironments = [ typeCheckingMode = "standard" -[build-system] -requires = ["setuptools", "Cython"] - [tool.coverage.run] branch = true diff --git a/setup.py b/setup.py index b15e6e12..3a6b8cd2 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,3 @@ -import os import sys from pathlib import Path @@ -36,8 +35,6 @@ "gidgethub~=5.3.0", "pymongo~=4.12.1", ) -UTIL_NAME = os.getenv("UTIL_NAME") -UTIL_VERSION = os.getenv("UTIL_VERSION") if "--build-requirements" in sys.argv: @@ -52,9 +49,6 @@ if "--install-requirements" in sys.argv: print(" ".join(INSTALL_REQUIREMENTS)) sys.exit(0) -if UTIL_NAME is None or UTIL_VERSION is None: - print("Please provide UTIL_NAME and UTIL_VERSION environment variables.") - sys.exit(1) try: from Cython.Build import cythonize from setuptools import Extension, find_packages, setup @@ -67,37 +61,15 @@ setup( - name=f"{UTIL_NAME}", - version=f"{UTIL_VERSION}", - description="Code plagiarism searching package.", - author="Artyom Semidolin, Dmitry Nikolaev, Alexander Evsikov", - url="https://github.com/OSLL/code-plagiarism", long_description=Path("README.md").read_text(encoding="utf-8"), long_description_content_type="text/markdown", - license="MIT License", platforms=["linux"], - classifiers=[ - "Development Status :: 4 - Beta", - "Environment :: Console", - "Intended Audience :: Education", - "License :: OSI Approved :: MIT License", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.12", - "Topic :: Software Development :: Plagiarism Detection", - ], package_dir={"": "src"}, packages=find_packages("src"), ext_modules=cythonize( [ - Extension("*", [f"src/{UTIL_NAME}/**/*.py"]), + Extension("*", [f"src/codeplag/**/*.py"]), ], language_level=3, ), - python_requires=">=3.12", - install_requires=INSTALL_REQUIREMENTS, - entry_points={ - "console_scripts": [ - f"{UTIL_NAME} = {UTIL_NAME}:main", - ] - }, ) From 0ac32ab07c1faff08537fc174396bf9eed188205 Mon Sep 17 00:00:00 2001 From: Artanias <43622365+Artanias@users.noreply.github.com> Date: Wed, 5 Nov 2025 21:57:19 +0300 Subject: [PATCH 5/9] refactor: moves packages finding to the pyproject.toml and removes uneccesary *.c and pycache files. --- Makefile | 2 ++ pyproject.toml | 3 +++ setup.py | 6 +----- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 2e5bfc14..02580f5c 100644 --- a/Makefile +++ b/Makefile @@ -85,7 +85,9 @@ install: substitute-sources man translate-compile @echo "Cleaning unnecessary files after Cython compilation in $(PY_INSTALL_PATH)" find "$(DESTDIR)/$(PY_INSTALL_PATH)/$(UTIL_NAME)/" -type f -name '*.py' -exec rm --force '{}' + + find "$(DESTDIR)/$(PY_INSTALL_PATH)/$(UTIL_NAME)/" -type f -name '*.c' -exec rm --force '{}' + find "$(DESTDIR)/$(PY_INSTALL_PATH)/$(UTIL_NAME)" -type d -iname "__pycache__" -exec rm --recursive --force '{}' + + find "$(DESTDIR)/$(PY_INSTALL_PATH)/webparsers" -type d -iname "__pycache__" -exec rm --recursive --force '{}' + @echo "Cleaning unnecessary temporary Python files after installation in $(PY_INSTALL_PATH)" find "$(DESTDIR)/$(PY_INSTALL_PATH)/$(UTIL_NAME)/" -type f -name '*.tmp.py' -exec rm --force '{}' + diff --git a/pyproject.toml b/pyproject.toml index 9ff3a057..3cc4a2b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,6 +46,9 @@ codeplag = "codeplag:main" requires = ["setuptools~=80.9.0", "Cython~=3.1.6"] build-backend = "setuptools.build_meta" +[tool.setuptools.packages.find] +where = ["src"] + [tool.ruff] builtins = ["_"] line-length = 99 diff --git a/setup.py b/setup.py index 3a6b8cd2..f000cd4c 100644 --- a/setup.py +++ b/setup.py @@ -51,7 +51,7 @@ sys.exit(0) try: from Cython.Build import cythonize - from setuptools import Extension, find_packages, setup + from setuptools import Extension, setup except ModuleNotFoundError: print( "For the correct build install required build dependencies: " @@ -61,11 +61,7 @@ setup( - long_description=Path("README.md").read_text(encoding="utf-8"), - long_description_content_type="text/markdown", platforms=["linux"], - package_dir={"": "src"}, - packages=find_packages("src"), ext_modules=cythonize( [ Extension("*", [f"src/codeplag/**/*.py"]), From c6fdc7f517c2a4c35b5eefceb31b9f3c8974294e Mon Sep 17 00:00:00 2001 From: Artanias <43622365+Artanias@users.noreply.github.com> Date: Wed, 5 Nov 2025 21:57:49 +0300 Subject: [PATCH 6/9] fix: pre-commit issues. --- setup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.py b/setup.py index f000cd4c..5ccbf2f3 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,4 @@ import sys -from pathlib import Path BUILD_REQUIREMENTS: tuple[str, ...] = ( "argparse-manpage==4.6", @@ -64,7 +63,7 @@ platforms=["linux"], ext_modules=cythonize( [ - Extension("*", [f"src/codeplag/**/*.py"]), + Extension("*", ["src/codeplag/**/*.py"]), ], language_level=3, ), From 31f96769b3448fe743f50b73a4a680ff1d955503 Mon Sep 17 00:00:00 2001 From: Artanias <43622365+Artanias@users.noreply.github.com> Date: Sat, 8 Nov 2025 00:30:43 +0300 Subject: [PATCH 7/9] fix: correctly get version from pyproject.toml in the CI. --- .github/workflows/check_n_push_image.yml | 2 +- Makefile | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/check_n_push_image.yml b/.github/workflows/check_n_push_image.yml index 9a9d8e4b..d873d29c 100644 --- a/.github/workflows/check_n_push_image.yml +++ b/.github/workflows/check_n_push_image.yml @@ -56,7 +56,7 @@ jobs: - name: Get current util version id: get_version run: | - echo "::set-output name=version::$(grep --max-count 1 UTIL_VERSION Makefile | grep -Eo "[0-9]+[.][0-9]+[.][0-9]+")" + echo "::set-output name=version::$(grep -Po '^version\s*=\s*"\K[\d.]+' pyproject.toml)" - name: Create main docker image, run tests and save image for the next job run: | diff --git a/Makefile b/Makefile index 02580f5c..213fbb19 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,14 @@ UTIL_VERSION := $(shell grep -Po '^version\s*=\s*"\K[\d.]+' pyproject.toml) UTIL_NAME := $(shell grep -Po '^name\s*=\s*"\K\w+' pyproject.toml) -PWD := $(shell pwd) USER_UID ?= $(shell id --user) USER_GID ?= $(shell id --group) BASE_DOCKER_VERSION := 1.0 DIST := ubuntu24.04 -BASE_DOCKER_TAG := $(shell echo $(UTIL_NAME)-base-${DIST}:$(BASE_DOCKER_VERSION)) -TEST_DOCKER_TAG := $(shell echo $(UTIL_NAME)-test-${DIST}:$(UTIL_VERSION)) -DOCKER_TAG ?= $(shell echo $(UTIL_NAME)-${DIST}:$(UTIL_VERSION)) +BASE_DOCKER_TAG := "$(UTIL_NAME)-base-${DIST}:$(BASE_DOCKER_VERSION)" +TEST_DOCKER_TAG := "$(UTIL_NAME)-test-${DIST}:$(UTIL_VERSION)" +DOCKER_TAG ?= "$(UTIL_NAME)-${DIST}:$(UTIL_VERSION)" PYTHONDONTWRITEBYTECODE := "1" PYTHONPATH := $(PWD)/src/:$(PWD)/test/auto From 6382843e13e47f2337e5f5b411b1a072c23a58f8 Mon Sep 17 00:00:00 2001 From: Artanias <43622365+Artanias@users.noreply.github.com> Date: Sat, 8 Nov 2025 00:47:02 +0300 Subject: [PATCH 8/9] refactor: removes repeated dependencies from setup.py and use from pyproject.toml. --- setup.py | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/setup.py b/setup.py index 5ccbf2f3..0982ac53 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,8 @@ import sys +import tomllib + +with open("pyproject.toml", "rb") as f: + pyproject_content = tomllib.load(f) BUILD_REQUIREMENTS: tuple[str, ...] = ( "argparse-manpage==4.6", @@ -17,23 +21,6 @@ "pytest-mock~=3.15.1", "pytest-cov~=7.0.0", ) -INSTALL_REQUIREMENTS: tuple[str, ...] = ( - "argcomplete~=3.5.3", - "numpy~=1.26.4", - "pandas~=2.2.3", - "ccsyspath~=1.1.0", - "clang~=18.1.8", - "llvmlite~=0.45.1", - "libclang~=18.1.1", - "python-decouple~=3.8", - "requests~=2.32.3", - "typing-extensions~=4.12.2", - "aiohttp~=3.9.3", - "Jinja2~=3.1.5", - "cachetools==5.5.2", - "gidgethub~=5.3.0", - "pymongo~=4.12.1", -) if "--build-requirements" in sys.argv: @@ -46,7 +33,7 @@ print(" ".join(TEST_REQUIREMENTS)) sys.exit(0) if "--install-requirements" in sys.argv: - print(" ".join(INSTALL_REQUIREMENTS)) + print(" ".join(pyproject_content["project"]["dependencies"])) sys.exit(0) try: from Cython.Build import cythonize From 4ef5bc29b8377630c57995992d031c83daae6c9a Mon Sep 17 00:00:00 2001 From: Artanias <43622365+Artanias@users.noreply.github.com> Date: Sat, 8 Nov 2025 11:33:14 +0300 Subject: [PATCH 9/9] refactor: moves dependencies into pyproject.toml. --- pyproject.toml | 8 +++++++- setup.py | 26 +++++++++----------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3cc4a2b4..094d8224 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,12 +29,18 @@ dependencies = [ "requests~=2.32.3", "typing-extensions~=4.12.2", "aiohttp~=3.9.3", - "Jinja2~=3.1.5", + "Jinja2~=3.1.6", "cachetools==5.5.2", "gidgethub~=5.3.0", "pymongo~=4.12.1", ] +[dependency-groups] +test = ["pytest~=8.4.2", "pytest-mock~=3.15.1", "pytest-cov~=7.0.0"] +lint = ["pre-commit~=4.3.0"] +translate = ["Babel==2.17.0", "Jinja2~=3.1.6"] +man = ["argparse-manpage==4.7"] + [project.urls] Repository = "https://github.com/OSLL/code-plagiarism" Issues = "https://github.com/OSLL/code-plagiarism/issues" diff --git a/setup.py b/setup.py index 0982ac53..19560644 100644 --- a/setup.py +++ b/setup.py @@ -1,26 +1,18 @@ import sys import tomllib +from typing import Final with open("pyproject.toml", "rb") as f: pyproject_content = tomllib.load(f) -BUILD_REQUIREMENTS: tuple[str, ...] = ( - "argparse-manpage==4.6", - "Babel==2.17.0", - "Cython~=3.0.12", - "setuptools~=75.8.1", - "Jinja2~=3.1.5", -) -# fmt: off -LINT_REQUIREMENTS: tuple[str, ...] = ( - "pre-commit~=4.3.0", -) -# fmt: on -TEST_REQUIREMENTS: tuple[str, ...] = ( - "pytest~=8.4.2", - "pytest-mock~=3.15.1", - "pytest-cov~=7.0.0", +BUILD_REQUIREMENTS: Final = ( + pyproject_content["build-system"]["requires"] + + pyproject_content["dependency-groups"]["translate"] + + pyproject_content["dependency-groups"]["man"] ) +LINT_REQUIREMENTS: Final = pyproject_content["dependency-groups"]["lint"] +TEST_REQUIREMENTS: Final = pyproject_content["dependency-groups"]["test"] +INSTALL_REQUIREMENTS: Final = pyproject_content["project"]["dependencies"] if "--build-requirements" in sys.argv: @@ -33,7 +25,7 @@ print(" ".join(TEST_REQUIREMENTS)) sys.exit(0) if "--install-requirements" in sys.argv: - print(" ".join(pyproject_content["project"]["dependencies"])) + print(" ".join(INSTALL_REQUIREMENTS)) sys.exit(0) try: from Cython.Build import cythonize