{"id":18405736,"url":"https://github.com/pybites-open-source/pybites-tools","last_synced_at":"2025-04-07T08:32:11.654Z","repository":{"id":37934778,"uuid":"402820242","full_name":"PyBites-Open-Source/pybites-tools","owner":"PyBites-Open-Source","description":"A repo to commit common Python utility scripts and snippets","archived":false,"fork":false,"pushed_at":"2025-02-03T20:04:15.000Z","size":127,"stargazers_count":18,"open_issues_count":7,"forks_count":8,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-03-17T18:17:38.677Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PyBites-Open-Source.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-03T15:43:06.000Z","updated_at":"2024-10-03T14:25:46.000Z","dependencies_parsed_at":"2024-01-29T19:42:57.113Z","dependency_job_id":"b024a9ed-6eaf-4c08-a4ae-158de9d2bb6b","html_url":"https://github.com/PyBites-Open-Source/pybites-tools","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyBites-Open-Source%2Fpybites-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyBites-Open-Source%2Fpybites-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyBites-Open-Source%2Fpybites-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyBites-Open-Source%2Fpybites-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PyBites-Open-Source","download_url":"https://codeload.github.com/PyBites-Open-Source/pybites-tools/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247620263,"owners_count":20968172,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest"],"created_at":"2024-11-06T03:04:31.503Z","updated_at":"2025-04-07T08:32:11.301Z","avatar_url":"https://github.com/PyBites-Open-Source.png","language":"Python","readme":"[![forthebadge made-with-python](http://ForTheBadge.com/images/badges/made-with-python.svg)](https://www.python.org/)\n\n# build\n\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/Pybites-Open-Source/pybites-tools/main.svg)](https://results.pre-commit.ci/latest/github/Pybites-Open-Source/pybites-tools/main)\n[![CI test](https://github.com/Pybites-Open-Source/pybites-tools/actions/workflows/test.yml/badge.svg)](https://github.com/Pybites-Open-Source/pybites-tools/actions/workflows/test.yml)\n[![codecov](https://codecov.io/gh/Pybites-Open-Source/pybites-tools/branch/main/graph/badge.svg)](https://codecov.io/gh/Pybites-Open-Source/pybites-tools)\n\n# Can be added to correct path after\n\n[![PyPI version](https://badge.fury.io/py/build.svg)](https://pypi.org/project/pybites-tools/)\n\n# PyBites Tools\n\nWelcome to PyBites Tools repo!\n\nThis is a collection repo for all things python that we have found helpful to get your modern Python project up and going.\n\n## Get started\n\n### Using this repo in your project\n\n```\npip install pybites-tools\n```\n\nTo use the command-line scripts (some scripts you need to set environment variables), for example:\n\n```\n(venv) $ zen\nThe Zen of Python has been copied to your clipboard\n\n(venv) $ s3\nusage: s3 [-h] -f FILE [-b BUCKET] [-a ACL]\ns3: error: the following arguments are required: -f/--file\n\n(venv) $ email\nusage: email [-h] -s SUBJECT -m MESSAGE [-e EMAIL]\nemail: error: the following arguments are required: -s/--subject, -m/--message\n```\n\nOr use tools by importing them in your scripts, for example:\n\n```\n\u003e\u003e\u003e from pybites_tools.license import generate_license_key\n\u003e\u003e\u003e generate_license_key()\n'35HN2KIW-K3ON4F94-IGJ1UN32-EAXSRZLF'\n```\n\n## Developer setup\n\nIf you want to contribute or modify the repo, make a fork and clone it, for example:\n\n```\ngit clone git@github.com:bbelderbos/pybites-tools.git\ncd pybites-tools\n```\n\nTo get started run: \\\n`make setup` \\\nThis will create a virtual environment and install the dependencies.\n\nBefore committing any code, you should install and run pre-commit. [Why pre-commit?](https://talkpython.fm/episodes/show/282/pre-commit-framework)\n\nJust run `pre-commit install`.\n\nFor some tools, you will need environment variables. You can set them by copying over the `.env-template` file to `.env`.\n\n## Useful tools\n\n### Send email\n\nConfigure the `EMAIL_*` environment variables; then you can run it like this:\n\n```\n$ python -m pybites_tools.sendemail -s \"test subject\" -m \"test message\" --email recipient@example.com\n```\n\nIf you set `EMAIL_DEFAULT_TO_EMAIL`, you can leave off the `--email` switch. This is useful if you want to send yourself a reminder often.\n\nFor example, you could add something like this in your `.zshrc`:\n\n```\nfunction remind {\n    (cd $HOME/code/pybites-tools \u0026\u0026 source venv/bin/activate \u0026\u0026 python -m pybites_tools.sendemail -s \"$1\" -m \"$2\")\n}\n```\n\nThen you can send yourself a quick email like this:\n\n```\n$ remind \"blog post\" \"git stats\"\n```\n\n### Uploading files to an S3 bucket\n\nFor this, you need to set the `AWS_*` configuration variables in `.env`.\n\nThen you can upload a file using:\n\n```\n$ python -m pybites_tools.aws -f file-path (-b bucket) (-a acl)\n```\n\n[AWS ACL overview](https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html)\n\n### WorldClock from the command line\n\nAdd the timezones that you would like displayed to the TIMEZONE_LIST configuration variable in `.env`. (List of all timezones [here](https://gist.github.com/heyalexej/8bf688fd67d7199be4a1682b3eec7568)). And uncomment/set the TIME_FORMAT in case you want a different output format (see [strftime() and strptime() Format Codes](https://docs.python.org/3.10/library/datetime.html#strftime-and-strptime-format-codes) for options).\nWhen working with others in multiple timezones you usually refer to your local timezone for reference. That said you can uncomment/set the TIMEZONE to your local one to avoid using the `-tz` command line parameter every time (if omitted UTC is used).\n\nLike this:\n\n```\nTIMEZONE_LIST=[\"America/Los_Angeles\",\"CET\",\"Australia/Sydney\"]\nTIME_FORMAT=\"%H:%M %z\" # 24-hour clock with UTC offset\nTIMEZONE=\"Europe/Berlin\"\n```\n\nThen:\n\n```\n$ python -m pybites_tools.worldclock\nAmerica/Los_Angeles       08:35PM\nCET                       05:35AM\nAustralia/Sydney          02:35PM\n```\n\nOr specify a time in some other timezone to be converted\n(e.g. to convert 10:55PM in London):\n\n```\n$ python -m pybites_tools.worldclock -hr 22 -min 55 -tz Europe/London\nAmerica/Los_Angeles       02:55PM\nCET                       11:55PM\nAustralia/Sydney          08:55AM\n```\n\nAround the dates where daylight saving times (DST) are changed finding the right timeslot for a meeting/call in the next week can be off due to the DST changed. That's why you can use the `--year`, `--month` and `--day` to find the correct time.\n\n```\n$ python -m pybites_tools.worldclock -hr 15 -min 0 -y 2022 -m 3 -d 10\nAmerica/Los_Angeles       07:00AM\nCET                       04:00PM\nAustralia/Sydney          02:00AM\n$ python -m pybites_tools.worldclock -hr 15 -min 0 -y 2022 -m 3 -d 15\nAmerica/Los_Angeles       08:00AM\nCET                       04:00PM\nAustralia/Sydney          02:00AM\n```\n\n### Copy Zen of Python to clipboard\n\nWhy not send it to a coder friend from time to time?\n\n```\n$ python -m pybites_tools.zen\nThe Zen of Python has been copied to your clipboard\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpybites-open-source%2Fpybites-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpybites-open-source%2Fpybites-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpybites-open-source%2Fpybites-tools/lists"}