Skip to content

Commit

Permalink
chore(#1): py cli
Browse files Browse the repository at this point in the history
  • Loading branch information
h1alexbel committed Apr 16, 2024
0 parents commit cd1e7a2
Show file tree
Hide file tree
Showing 13 changed files with 240 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .0pdd.yml
@@ -0,0 +1,5 @@
errors:
- aliaksei.bialiauski@hey.com
tags:
- pdd
- bug
8 changes: 8 additions & 0 deletions .gitattributes
@@ -0,0 +1,8 @@
# Check out all text files in UNIX format, with LF as end of line
# Don't change this file. If you have any ideas about it, please
# submit a separate issue about it and we'll discuss.

* text=auto eol=lf
*.py ident
*.xml ident
*.png binary
17 changes: 17 additions & 0 deletions .gitignore
@@ -0,0 +1,17 @@
dist/
build/
lib/
include/
bin/
venv/
pwd/
.vscode/
.idea/
.DS_Store
*.iml
.project
.settings
.classpath
.recommenders
.factorypath
pyvenv.cfg
7 changes: 7 additions & 0 deletions .pdd
@@ -0,0 +1,7 @@
--source=.
--verbose
--exclude target/**
--exclude xargs/**
--rule min-words:20
--rule min-estimate:15
--rule max-estimate:90
15 changes: 15 additions & 0 deletions .rultor.yml
@@ -0,0 +1,15 @@
architect:
- h1alexbel
merge:
script: |
<merge script>
release:
script: |
[[ "${tag}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9_]+)?$ ]] || exit -1
<set version>
git commit -am "${tag}"
<release to PyPI>
deploy:
script: |
echo "There is no such thing as #deploy"
exit -1
21 changes: 21 additions & 0 deletions LICENSE.txt
@@ -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.
44 changes: 44 additions & 0 deletions README.md
@@ -0,0 +1,44 @@
build, pypi, puzzles,
loc, hoc, license

Samples-filter is a command-line filter
for GitHub repositories that contain `samples`,
instead of real project or framework or library.
E.g. [leeowenowen/rxjava-examples](https://github.com/leeowenowen/rxjava-examples),
[streaming-with-flink/examples-java](https://github.com/streaming-with-flink/examples-java),
[redisson/redisson-examples](https://github.com/redisson/redisson-examples).

## How to use

TBD..

## Filtering method

We take the input in the format of `repositories.csv`:

```csv
full_name,default_branch,stars,forks,created_at,size,open_issues_count,description,topics
heysupratim/material-daterange-picker,master,1328,269,2015-09-14T12:00:47Z,868,14,"A material Date Range Picker based on wdullaers MaterialDateTimePicker","["datepicker", "datetimepicker", "material", "picker", "range-selection", "timepicker"]"
Jude95/EasyRecyclerView,master,2029,458,2015-07-18T13:11:48Z,11336,110,"ArrayAdapter,pull to refresh,auto load more,Header/Footer,EmptyView,ProgressView,ErrorView","[]"
hanks-zyh/SmallBang,master,1005,158,2015-12-24T14:48:37Z,6379,6," twitter like animation for any view :heartbeat:","["animation", "heartbeat", "like-button", "twitter"]"
Gavin-ZYX/StickyDecoration,master,1033,165,2017-05-31T07:38:49Z,1018,3,"","[]"
...
```
?: format csv to Markdown

Then, for each repo in the dataset we fetch it's `README.md` file.
Then we extract `full_name`, `description`, `topics` columns' values from
dataset. At this point we TBD..

## How to contribute

Fork repository, make changes, send us a [pull request](https://www.yegor256.com/2014/04/15/github-guidelines.html).
We will review your changes and apply them to the `master` branch shortly,
provided they don't violate our quality standards. To avoid frustration,
before sending us your pull request please run full build:

```bash
$ ..
```

You will need [Python 3.95+]() and [pip+]() installed.
23 changes: 23 additions & 0 deletions objects/__init__.py
@@ -0,0 +1,23 @@
"""Top-level package for RP To-Do."""
# rptodo/__init__.py

__app_name__ = "rptodo"
__version__ = "0.1.0"

(
SUCCESS,
DIR_ERROR,
FILE_ERROR,
DB_READ_ERROR,
DB_WRITE_ERROR,
JSON_ERROR,
ID_ERROR,
) = range(7)

ERRORS = {
DIR_ERROR: "config directory error",
FILE_ERROR: "config file error",
DB_READ_ERROR: "database read error",
DB_WRITE_ERROR: "database write error",
ID_ERROR: "to-do id error",
}
10 changes: 10 additions & 0 deletions objects/__main__.py
@@ -0,0 +1,10 @@
"""RP To-Do entry point script."""
# rptodo/__main__.py

from objects import cli, __app_name__

def main():
cli.app(prog_name=__app_name__)

if __name__ == "__main__":
main()
28 changes: 28 additions & 0 deletions objects/cli.py
@@ -0,0 +1,28 @@
"""This module provides the RP To-Do CLI."""
# rptodo/cli.py

from typing import Optional

import typer

from objects import __app_name__, __version__

app = typer.Typer()

def _version_callback(value: bool) -> None:
if value:
typer.echo(f"{__app_name__} v{__version__}")
raise typer.Exit()

@app.callback()
def main(
version: Optional[bool] = typer.Option(
None,
"--version",
"-v",
help="Show the application's version and exit.",
callback=_version_callback,
is_eager=True,
)
) -> None:
return
6 changes: 6 additions & 0 deletions renovate.json
@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base"
]
}
2 changes: 2 additions & 0 deletions requirements.txt
@@ -0,0 +1,2 @@
typer==0.3.2
pytest==6.2.4
54 changes: 54 additions & 0 deletions setup.py
@@ -0,0 +1,54 @@
# MIT License
#
# 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 NONINFRINGEMENT. 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 setuptools import setup, find_packages

setup(
name='samples-filter',
version='0.0.1',
packages=find_packages(),
install_requires=[
'typer'
],
entry_points={
'console_scripts': [
'samples-filter=mycli.cli:main',
],
},
author='Aliaksei Bialiauski',
author_email='aliaksei.bialiauski@hey.com',
description='Command-line filter for GitHub repositories that contain "samples", instead of real project or framework/library',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
url='https://github.com/h1alexbel/samples-filter',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
],
)

0 comments on commit cd1e7a2

Please sign in to comment.