From 1617392f7d07203d2d1d4cf65e00ca7c061ac03f Mon Sep 17 00:00:00 2001 From: baterflyrity Date: Mon, 27 Nov 2023 18:42:36 +0300 Subject: [PATCH 1/6] feat(Requirements formatting): Add comparison specifier `-` to completely hide versions. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add --comparison-specifier choice value `-` to completely hide packages versions in generated requirements file, e.g. `tornado~=6.3.3` → `tornado`. Closes #183 Signed-off-by: baterflyrity --- pigar/__main__.py | 4 ++-- pigar/dist.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pigar/__main__.py b/pigar/__main__.py index d5f8560..5cc28cc 100644 --- a/pigar/__main__.py +++ b/pigar/__main__.py @@ -120,8 +120,8 @@ def gohome(): 'comparison_specifier', default='==', show_default=True, - type=click.Choice(['==', '~=', '>=', '>']), - help='Part of version specifier, e.g. `abc==1.0`(see PEP 440 for details).', + type=click.Choice(['==', '~=', '>=', '>', '-']), + help='Part of version specifier, e.g. `abc==1.0`(see PEP 440 for details). Can be `-` to completely remove version.', ) @click.option( '--show-differences/--dont-show-differences', diff --git a/pigar/dist.py b/pigar/dist.py index 4d78e2c..a48b66d 100644 --- a/pigar/dist.py +++ b/pigar/dist.py @@ -183,11 +183,12 @@ def contains_file(self, file): def as_requirement( self, operator: str = '==', spaces_around_operator: str = '' ) -> str: - req = "" if self.editable and self.url: req = f"-e {self.url}" else: - req = f"{self.name}{spaces_around_operator}{operator}{spaces_around_operator}{self.version}" + req = self.name + if operator != '-': + req += f"{spaces_around_operator}{operator}{spaces_around_operator}{self.version}" return "\n".join(list(self.comments) + [str(req)]) def __str__(self) -> str: From 5cb865562c76fe79325502c83956e36588822218 Mon Sep 17 00:00:00 2001 From: baterflyrity Date: Mon, 27 Nov 2023 18:48:56 +0300 Subject: [PATCH 2/6] feat(CI): Enable button in GitHub UI to manually run workflow. Enable button in GitHub UI actions to manually run workflow `ci` on default branch. For more information see https://docs.github.com/ru/actions/using-workflows/manually-running-a-workflow?tool=webui. Signed-off-by: baterflyrity --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d8b77af..4e05a0b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,7 @@ on: branches: - 'main' - 'release-**' + workflow_dispatch: jobs: build: runs-on: ubuntu-latest From bed30d0ce17ccd38a545cbd4b87bf86795c88559 Mon Sep 17 00:00:00 2001 From: baterflyrity Date: Mon, 27 Nov 2023 18:51:32 +0300 Subject: [PATCH 3/6] feat(CI): Add Python 3.12 to CI. Add Python version 3.12 to CI tests matrix. Signed-off-by: baterflyrity --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4e05a0b..489dba6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,7 @@ jobs: - "3.9" - "3.10" - "3.11" + - "3.12" name: Python ${{ matrix.python-version }} steps: - uses: actions/checkout@v3 From e1871c297413ac38bbb20cc201bf048ed8d190f4 Mon Sep 17 00:00:00 2001 From: baterflyrity Date: Mon, 27 Nov 2023 18:53:27 +0300 Subject: [PATCH 4/6] feat(CI): Add Python 3.12 reqirements to CI. Add Python version 3.12 reqirements to CI tests matrix. Signed-off-by: baterflyrity --- requirements/py3.12.txt | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 requirements/py3.12.txt diff --git a/requirements/py3.12.txt b/requirements/py3.12.txt new file mode 100644 index 0000000..35cf0c2 --- /dev/null +++ b/requirements/py3.12.txt @@ -0,0 +1,9 @@ +# Automatically generated by https://github.com/damnever/pigar. + +# pigar/dist.py: 28 +aiohttp==3.8.4 +# pigar/__main__.py: 24 +# pigar/tests/test_cli.py: 9 +click==8.1.3 +# pigar/parser.py: 15 +nbformat==5.7.3 From ab15364eb27a2b45abf3aab8127a5563f70737ee Mon Sep 17 00:00:00 2001 From: baterflyrity Date: Mon, 27 Nov 2023 18:58:49 +0300 Subject: [PATCH 5/6] feat(CI): Fix Python 3.12 reqirements to CI. Fix Python version 3.12 reqirements to CI tests matrix. Signed-off-by: baterflyrity --- requirements/py3.12.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/py3.12.txt b/requirements/py3.12.txt index 35cf0c2..35ebc2c 100644 --- a/requirements/py3.12.txt +++ b/requirements/py3.12.txt @@ -1,7 +1,7 @@ # Automatically generated by https://github.com/damnever/pigar. # pigar/dist.py: 28 -aiohttp==3.8.4 +aiohttp==3.9.0 # pigar/__main__.py: 24 # pigar/tests/test_cli.py: 9 click==8.1.3 From 808e4cdca9f80efa3eb13e6a9c9df2996d9c5a2c Mon Sep 17 00:00:00 2001 From: baterflyrity Date: Mon, 27 Nov 2023 19:13:22 +0300 Subject: [PATCH 6/6] style(Codestyle): Fix too long lines especially for @pep8speaks. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix PEP 8 ABSURD and USELESS requirements: ► In the file pigar/__main__.py: Line 124:80: E501 line too long (121 > 79 characters) ►In the file pigar/dist.py: Line 191:80: E501 line too long (98 > 79 characters) Signed-off-by: baterflyrity --- pigar/__main__.py | 3 ++- pigar/dist.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pigar/__main__.py b/pigar/__main__.py index 5cc28cc..8ae3c27 100644 --- a/pigar/__main__.py +++ b/pigar/__main__.py @@ -121,7 +121,8 @@ def gohome(): default='==', show_default=True, type=click.Choice(['==', '~=', '>=', '>', '-']), - help='Part of version specifier, e.g. `abc==1.0`(see PEP 440 for details). Can be `-` to completely remove version.', + help='Part of version specifier, e.g. `abc==1.0`(see PEP 440 for details).' + ' Can be `-` to completely remove version.', ) @click.option( '--show-differences/--dont-show-differences', diff --git a/pigar/dist.py b/pigar/dist.py index a48b66d..5f3f3be 100644 --- a/pigar/dist.py +++ b/pigar/dist.py @@ -188,7 +188,8 @@ def as_requirement( else: req = self.name if operator != '-': - req += f"{spaces_around_operator}{operator}{spaces_around_operator}{self.version}" + req += f"{spaces_around_operator}{operator}"\ + f"{spaces_around_operator}{self.version}" return "\n".join(list(self.comments) + [str(req)]) def __str__(self) -> str: