From 1c9fac28ae5c254e9e95055e632d8195e873ccbe Mon Sep 17 00:00:00 2001 From: Rahul Sharma <53327705+DrakeEntity@users.noreply.github.com> Date: Fri, 4 Nov 2022 23:16:08 +0530 Subject: [PATCH 1/3] updating main branch with dev (#47) * better cli output * updating documentation * updating documentation * updating badge * updating changelog Co-authored-by: Deepak Raj <54245038+codePerfectPlus@users.noreply.github.com> --- CHANGELOG.md | 6 +++-- docs/command_line_usage.rst | 23 ++++++++++------ docs/import_as_module.rst | 2 +- docs/index.rst | 27 ++++++++----------- docs/installation.rst | 9 ++++--- docs/introduction.rst | 8 +----- docs/roadmap.rst | 2 +- docs/run_test_cases.rst | 11 ++++++-- log/__init__.py | 0 random_profile/{__main__.py => cli.py} | 15 ++++++----- random_profile/utils.py | 2 +- .../update_package.sh | 0 setup.py | 2 +- 13 files changed, 57 insertions(+), 50 deletions(-) create mode 100644 log/__init__.py rename random_profile/{__main__.py => cli.py} (79%) rename update_package.sh => scripts/update_package.sh (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75774de..db31a11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,13 @@ All notable changes to this project will be documented in this file. The format ## Changelog -## [Unreleased] +## [0.2.4] +- Beautiful command line output - Moved test files to random_profile to avoid flake8:402 error - Following proper changelog format, added changelog file -- Added config for readthedocs +- Docs: Added documentation for the project +- Bug fixed: Fixed a bug with random_profile import ## [v0.2.3] - 13-10-2022 diff --git a/docs/command_line_usage.rst b/docs/command_line_usage.rst index d089a1d..1cd5fd9 100644 --- a/docs/command_line_usage.rst +++ b/docs/command_line_usage.rst @@ -1,5 +1,5 @@ Command line usages -========= +=================== `Random Profile Generator` can be used as a command line tool. It can be used to generate a random profile and save it to a file. @@ -25,7 +25,7 @@ Usages: -j, --jobtitle Get job title Get Random Profile: ------------- +------------------- .. code-block:: bash @@ -33,7 +33,7 @@ Get Random Profile: random_profile -n 10 -p Get First Name: ------------- +--------------- .. code-block:: bash @@ -41,7 +41,7 @@ Get First Name: random_profile -n 10 -f Get Last Name: ------------- +-------------- .. code-block:: bash @@ -49,7 +49,7 @@ Get Last Name: random_profile -n 10 -l Get Job Title: ------------- +-------------- .. code-block:: bash @@ -57,7 +57,7 @@ Get Job Title: random_profile -n 10 -j Get IPv4 Address: ------------- +----------------- .. code-block:: bash @@ -65,15 +65,22 @@ Get IPv4 Address: random_profile -n 10 -ip Get Random Profile and Save to File: ------------- +------------------------------------ .. code-block:: bash # n = number of random profiles, p = profile random_profile -n 10 -p > random_profiles.txt +.. code-block:: bash + + # save to a file + # n = number of random profiles, p = profile + random_profile -n 10 -p >> random_profiles.txt + + Get Random Profile version: ------------- +--------------------------- .. code-block:: bash diff --git a/docs/import_as_module.rst b/docs/import_as_module.rst index 551ed66..e28cd1d 100644 --- a/docs/import_as_module.rst +++ b/docs/import_as_module.rst @@ -1,5 +1,5 @@ Import as module ------------- +---------------- You can import the module and use it in your own scripts. diff --git a/docs/index.rst b/docs/index.rst index ccd6cdc..8a0a0c7 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -6,11 +6,11 @@ .. rst-class:: hide-header Welcome to RandomProfileGenerator's documentation! -===================================== +================================================= -|PyPI download month| +|Total download| -.. |PyPI download month| image:: https://img.shields.io/pypi/dm/random_profile.svg +.. |Total download| image:: http://pepy.tech/badge/random_profile :target: https://pypi.python.org/pypi/random_profile/ |PyPI version fury.io| @@ -41,21 +41,11 @@ If you love open source contributions. * Join the community on `Discord `_. * join the community on `Github `_. -Other Projects by Py-Contributors: --------------- - -* `AudioBook `_ -* `Cybel - The Discord Bot `_ -* `Twitterify - Tweet-retweet bot `_ - -|forthebadge made-with-python| - -.. |forthebadge made-with-python| image:: http://ForTheBadge.com/images/badges/made-with-python.svg - :target: https://www.python.org/ - +Contents: +--------- .. toctree:: - :hidden: + :maxdepth: 2 introduction.rst installation.rst @@ -65,4 +55,9 @@ Other Projects by Py-Contributors: roadmap.rst run_test_cases.rst +Other Projects by Py-Contributors: +--------------------------------- +* `AudioBook `_ +* `Cybel - The Discord Bot `_ +* `Twitterify - Tweet-retweet bot `_ diff --git a/docs/installation.rst b/docs/installation.rst index 95a1a53..00585e8 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -1,8 +1,8 @@ Installation -========= +============ Install Via Pip(recommended): ------------- +---------------------------- .. code-block:: bash @@ -11,16 +11,17 @@ Install Via Pip(recommended): Install from Source(Unreleased): ------------- +-------------------------------- .. code-block:: bash git clone https://github.com/Py-Contributors/RandomProfileGenerator + git checkout main cd RandomProfileGenerator python setup.py install Test Installation: ------------- +----------------- .. code-block:: bash diff --git a/docs/introduction.rst b/docs/introduction.rst index f4862dc..fec9f99 100644 --- a/docs/introduction.rst +++ b/docs/introduction.rst @@ -1,5 +1,5 @@ Introduction -========= +============ `RandomProfileGenerator` is a powerful and simple tool to generate fake data. You can use it to mock classes, populate databases and much more. @@ -18,9 +18,3 @@ Use cases - Generating fake data for your demo - Generating fake data for your blog post -Upcoming features ------------- - -- Support for more languages (Javascript) - - diff --git a/docs/roadmap.rst b/docs/roadmap.rst index 734a5e7..e59b274 100644 --- a/docs/roadmap.rst +++ b/docs/roadmap.rst @@ -1,5 +1,5 @@ Roadmap and future plans -========= +======================== * `more test coverage` * `more supported file formats` diff --git a/docs/run_test_cases.rst b/docs/run_test_cases.rst index 2bcd239..2ffa37b 100644 --- a/docs/run_test_cases.rst +++ b/docs/run_test_cases.rst @@ -1,12 +1,19 @@ Run test cases -========= +============== For the test cases, we are using `pytest`. The test cases are located in the `tests` directory. To run the test cases, you can use the following command: .. code-block:: bash - $ pytest tests + pytest tests + + +.. code-block:: bash + + flake8 . --ignore=E501 + + You can also run the test cases with coverage: diff --git a/log/__init__.py b/log/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/random_profile/__main__.py b/random_profile/cli.py similarity index 79% rename from random_profile/__main__.py rename to random_profile/cli.py index 3e935c6..09d1ae1 100644 --- a/random_profile/__main__.py +++ b/random_profile/cli.py @@ -1,5 +1,6 @@ -from audiobook.main import RandomProfile +from random_profile.main import RandomProfile import argparse +from pprint import pprint def main(): @@ -42,17 +43,17 @@ def main(): rp = RandomProfile(args.n) if args.fullname: - print(*rp.full_name(), sep="\n") + pprint(rp.full_name()) elif args.profile: - print(*rp.full_profile(), sep="\n") + pprint(rp.full_profile()) elif args.lastname: - print(*rp.last_name(), sep="\n") + pprint(rp.last_name()) elif args.jobtitle: - print(*rp.job_title(), sep="\n") + pprint(rp.job_title()) elif args.ipv4: - print(*rp.ipv4(), sep="\n") + pprint(rp.ipv4()) else: - print('Type `random_profile -h` for help') + pprint('Type `random_profile -h` for help') if __name__ == "__main__": diff --git a/random_profile/utils.py b/random_profile/utils.py index 4615c83..873827b 100644 --- a/random_profile/utils.py +++ b/random_profile/utils.py @@ -5,7 +5,7 @@ ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) ASSETS_DIR = os.path.join(ROOT_DIR, "random_profile", "assets") -logging.basicConfig(filename='log/example.log', encoding='utf-8', level=logging.DEBUG) +logging.basicConfig(filename='log/example.log', level=logging.DEBUG) def load_txt_file(file_name: str) -> list: diff --git a/update_package.sh b/scripts/update_package.sh similarity index 100% rename from update_package.sh rename to scripts/update_package.sh diff --git a/setup.py b/setup.py index df214c2..6077df2 100644 --- a/setup.py +++ b/setup.py @@ -25,6 +25,6 @@ "Topic :: Utilities", "Environment :: Plugins"], entry_points={ - "console_scripts": ["random_profile = random_profile.__main__:main"], + "console_scripts": ["random_profile = random_profile.cli:main"], }, ) From 205333dd7fa1016b42fa1f52a8365f0d9d69977b Mon Sep 17 00:00:00 2001 From: Deepak Raj <54245038+codePerfectPlus@users.noreply.github.com> Date: Fri, 4 Nov 2022 10:55:19 -0700 Subject: [PATCH 2/3] Update publish.yml --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ec7a124..0545c39 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -15,7 +15,7 @@ jobs: run: >- python setup.py sdist - name: Publish distribution to PyPI - uses: pypa/gh-action-pypi-publish@master + uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ password: ${{ secrets.pypi_password }} From 6b24c18225aeb8d6f661459305aedbba91298728 Mon Sep 17 00:00:00 2001 From: Deepak Raj <54245038+codePerfectPlus@users.noreply.github.com> Date: Fri, 4 Nov 2022 11:39:02 -0700 Subject: [PATCH 3/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b74f10b..e285fcc 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Random Profile Generator - V0.2.3 + V0.2.4

Python Module To Generate Random Profile Data