Skip to content

Commit

Permalink
Merge pull request #184 from baterflyrity/main
Browse files Browse the repository at this point in the history
Add --comparison-specifier choice value `-` to completely hide packages versions
  • Loading branch information
damnever authored Nov 28, 2023
2 parents 6b51600 + 808e4cd commit aea6764
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- 'main'
- 'release-**'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -16,6 +17,7 @@ jobs:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
name: Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
Expand Down
5 changes: 3 additions & 2 deletions pigar/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@ 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',
Expand Down
6 changes: 4 additions & 2 deletions pigar/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,13 @@ 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}"\
f"{spaces_around_operator}{self.version}"
return "\n".join(list(self.comments) + [str(req)])

def __str__(self) -> str:
Expand Down
9 changes: 9 additions & 0 deletions requirements/py3.12.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Automatically generated by https://github.com/damnever/pigar.

# pigar/dist.py: 28
aiohttp==3.9.0
# pigar/__main__.py: 24
# pigar/tests/test_cli.py: 9
click==8.1.3
# pigar/parser.py: 15
nbformat==5.7.3

0 comments on commit aea6764

Please sign in to comment.