Skip to main content

A collection of helpful tools

Project description

aplustools

Active Development Build Status License: GPL-3.0

Description

aplustools is a simple, user-friendly Python library for performing amazing tasks. It simplifies complex processes, allowing you to achieve more with less code. Developed with a focus on ease of use and efficiency, aplustools is the go-to solution for Python developers looking to enhance their projects.

Features

  • Easy to use
  • Highly efficient
  • Supports multiple platforms
  • Regular updates and support
  • Comprehensive documentation

Installation

You can install aplustools via pip:

pip install aplustools

Or clone the repository and install manually:

git clone https://github.com/Adalfarus/aplustools.git
cd aplustools
python setup.py install

Usage

Here are a few quick examples of how to use aplustools:

Search Engine usage

from aplustools import webtools

# Create an instance of Search
search = webtools.Search()

# Call the `google_provider` with a parameter
result = search.google_provider("Cute puppies")

# Print the result
print(result)

Logger

import aplustools.setdirtoex
# Just the import is needed to set the current working directory to the main script or executable
from aplustools import logs

# Create an instance of Logger
logger = logs.Logger("my_logs_file.log", show_time=True, capture_print=False, 
                     overwrite_print=True, print_passthrough=False, print_log_to_stdout=True)
# Shows the time in the logs (Like this [12:33:21]) and overwrites the normal sys.stdout

# Call the `monitor_stdout` method and pass the logger object, this will overwrite sys.stdout from Text I/O to the logger object
logger = logs.monitor_stdout(logger=logger) # Return sys.stdout, so you can make sure it worked

# Log something
logger.log("Hello, world!")

# Print something, it won't get captured or displayed
print("Hello, beautiful world!")

# Close the Logger object (returns sys.stdout to it's normal state)
logger.close()

OnlineImage

from aplustools import imagetools
from aplustools.environment import Path

# Download the image to the current working directory
imagetools.OnlineImage("someImage.url", True)

# Making sure that folder_path exists
folder_path = Path(".\\images")
folder_path.create_directory()

# Converting the image and moving it to a specified path
image = imagetools.OfflineImage("data:image/jpeg;base64,/9j...")
success = image.base64(str(folder_path), "Image", "png") # Make sure this directory exists

# Download the image to a specified path
image2 = imagetools.OnlineImage("someImage.url")
_, img_name, img_path = image.download_image(str(folder_path)) # Make sure this directory exists

Git-Updater

from aplustools import updaters
from aplustools.environment import set_working_dir_to_main_script_location
import os
import threading
from aplustools.environment import Path

set_working_dir_to_main_script_location()

# Initialize an updater
updater = updaters.gitupdater("exe")
current_version = updater.get_latest_version("Adalfarus", "unicode-writer")[1] # Gives back two values, use whichever applicable

# Define the arguments for the updater method
host, port, path = "localhost", 1264, Path(os.path.join(updaters.get_temp(), "update")
gui_toggle, cmd_toggle = False, False
path.create_directory()
update_args = (os.path.join(os.getcwd(), "update"), str(path), 
			current_version, "Adalfarus", "unicode-writer", gui_toggle, cmd_toggle, host, port)

# Start the update in a seperate thread
update_thread = threading.Thread(target=updater.update, args=update_args)
update_thread.start()

# Receive the update status generator and print them
progress_bar = 1
for i in updater.receive_update_status(host, port):
	print(f"{i}%", end=f" PB{progress_bar}\n")
	if i == 100: progress_bar += 1 # Switch to second progress bar, when the downloading is finished

Webtools

... # Continuing the first example

# Print the result
print(result)

from aplustools.webtools import check_url, is_crawlable
import requests

if check_url(result, ''): # Not really nessesary, search does this automatically
	response = requests.get(result)
	...

Environment

... # Continuing the image example

_, img_name, img_path = image.download_image(str(folder_path)) # Make sure this directory exists

from aplustools.environment import absolute_path, remv, copy
from aplustools.childsplay import ImportClass # Could be switched out to adultswork, but the string would need to get converted

importer = ImportClass(hard=True)
importer.import_all() # Destroys your runtime python

a_imgpath = absolute_path(img_path)

try:
	copy(a_imgpath, str(folder_path) + str(img_name).remove(".png") + str(" - Copy.png"))
except ValueError:
	copy(a_imgpath, str(folder_path) + str(img_name.split(".")[-1]) + str(" - Copy.png"))

remv(a_imgpath) # Remove the original image
remv(str(folder_path)) # Remove the base directory

(Correct shortform for aplustools is apt, so use import aplustools as apt)

For more detailed usage and examples, check out our documentation.

Naming convention, dependencies and more

PEP 8 -- Style Guide for Python Code

For modules I use 'lowercase', classes are 'CapitalizedWords' and functions and methods are 'lower_case_with_underscores'.

Dependencies (except standart libraries) are:

  • adultswork - datetime
  • childsplay - datetime
  • database - none
  • environment - none
  • gitupdater-cmd - requests - deprecated
  • gitupdater-gui - requests, pyqt5 - deprecated
  • gitupdater - requests
  • imagetools - Pillow
  • logs - none
  • setdirtoex - none
  • updaters - requests
  • webtools - duckduckgo_search, bs4 - duckduckgo_search is only used for Search.duckduckgo_provider, if you don't want to use it use Search._duckduckgo_provider instead.

Contributing

We welcome contributions! Please see our contributing guidelines for more details on how you can contribute to aplustools.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a pull request

License

aplustools is licensed under the GPL-3.0 License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aplustools-0.1.3.6.tar.gz (59.1 MB view details)

Uploaded Source

Built Distribution

aplustools-0.1.3.6-py3-none-any.whl (59.1 MB view details)

Uploaded Python 3

File details

Details for the file aplustools-0.1.3.6.tar.gz.

File metadata

  • Download URL: aplustools-0.1.3.6.tar.gz
  • Upload date:
  • Size: 59.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for aplustools-0.1.3.6.tar.gz
Algorithm Hash digest
SHA256 afbeae7411952c11deacc292f6805296a756b564ed7a6ad1419254f61d340d4f
MD5 3b1d243ad9a8ee4f0d83a5686c9b7172
BLAKE2b-256 ab5c4da94e61d8bea78b55df0e31737b8631ffda42ddd2e566e3bf193a730367

See more details on using hashes here.

File details

Details for the file aplustools-0.1.3.6-py3-none-any.whl.

File metadata

  • Download URL: aplustools-0.1.3.6-py3-none-any.whl
  • Upload date:
  • Size: 59.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for aplustools-0.1.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 3f6dfc190c775f4b26cfc71fa8d2dbaffdec354729f6eebcedb9713d08b6d9d4
MD5 117e118e3669fe032698ad585f0a89fb
BLAKE2b-256 a9824410147909a5f85c16cb55e29a0945b8cf37415fd545a1eff91c802659e1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page