Package: pybites-tools
buildCan be added to correct path afterPyBites ToolsWelcome to PyBites Tools repo!This is a collection repo for all things python that we have found helpful to get your modern Python project up and going.Get startedUsing this repo in your projectpip install pybites-toolsTo use the command-line scripts (some scripts you need to set environment variables), for example:(venv) $ zen
The Zen of Python has been copied to your clipboard

(venv) $ s3
usage: s3 [-h] -f FILE [-b BUCKET] [-a ACL]
s3: error: the following arguments are required: -f/--file

(venv) $ email
usage: email [-h] -s SUBJECT -m MESSAGE [-e EMAIL]
email: error: the following arguments are required: -s/--subject, -m/--messageOr use tools by importing them in your scripts, for example:>>> from pybites_tools.license import generate_license_key
>>> generate_license_key()
'35HN2KIW-K3ON4F94-IGJ1UN32-EAXSRZLF'Developer setupIf you want to contribute or modify the repo, make a fork and clone it, for example:git clone git@github.com:bbelderbos/pybites-tools.git
cd pybites-toolsTo get started run:make setupThis will create a virtual environment and install the dependencies.Before committing any code, you should install and run pre-commit.Why pre-commit?Just runpre-commit install.For some tools, you will need environment variables. You can set them by copying over the.env-templatefile to.env.Useful toolsSend emailConfigure theEMAIL_*environment variables; then you can run it like this:$ python -m pybites_tools.sendemail -s "test subject" -m "test message" --email recipient@example.comIf you setEMAIL_DEFAULT_TO_EMAIL, you can leave off the--emailswitch. This is useful if you want to send yourself a reminder often.For example, you could add something like this in your.zshrc:function remind {
    (cd $HOME/code/pybites-tools && source venv/bin/activate && python -m pybites_tools.sendemail -s "$1" -m "$2")
}Then you can send yourself a quick email like this:$ remind "blog post" "git stats"Uploading files to an S3 bucketFor this, you need to set theAWS_*configuration variables in.env.Then you can upload a file using:$ python -m pybites_tools.aws -f file-path (-b bucket) (-a acl)AWS ACL overviewWorldClock from the command lineAdd the timezones that you would like displayed to the TIMEZONE_LIST configuration variable in.env. (List of all timezoneshere). And uncomment/set the TIME_FORMAT in case you want a different output format (seestrftime() and strptime() Format Codesfor options).
When 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-tzcommand line parameter every time (if omitted UTC is used).Like this:TIMEZONE_LIST=["America/Los_Angeles","CET","Australia/Sydney"]
TIME_FORMAT="%H:%M %z" # 24-hour clock with UTC offset
TIMEZONE="Europe/Berlin"Then:$ python -m pybites_tools.worldclock
America/Los_Angeles       08:35PM
CET                       05:35AM
Australia/Sydney          02:35PMOr specify a time in some other timezone to be converted
(e.g. to convert 10:55PM in London):$ python -m pybites_tools.worldclock -hr 22 -min 55 -tz Europe/London
America/Los_Angeles       02:55PM
CET                       11:55PM
Australia/Sydney          08:55AMAround 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,--monthand--dayto find the correct time.$ python -m pybites_tools.worldclock -hr 15 -min 0 -y 2022 -m 3 -d 10
America/Los_Angeles       07:00AM
CET                       04:00PM
Australia/Sydney          02:00AM
$ python -m pybites_tools.worldclock -hr 15 -min 0 -y 2022 -m 3 -d 15
America/Los_Angeles       08:00AM
CET                       04:00PM
Australia/Sydney          02:00AMCopy Zen of Python to clipboardWhy not send it to a coder friend from time to time?$ python -m pybites_tools.zen
The Zen of Python has been copied to your clipboard