Skip to main content

Simplifys aspects of python

Project description

                    GitHub issues GitHub forks GitHub stars GitHub license Python Python Hits

███████╗██╗███╗   ███╗██████╗ ██╗     ██╗███████╗██╗   ██╗
██╔════╝██║████╗ ████║██╔══██╗██║     ██║██╔════╝╚██╗ ██╔╝
███████╗██║██╔████╔██║██████╔╝██║     ██║█████╗   ╚████╔╝
╚════██║██║██║╚██╔╝██║██╔═══╝ ██║     ██║██╔══╝    ╚██╔╝
███████║██║██║ ╚═╝ ██║██║     ███████╗██║██║        ██║
╚══════╝╚═╝╚═╝     ╚═╝╚═╝     ╚══════╝╚═╝╚═╝        ╚═╝
                 built by @Necrownyx

Simplify Python

This is a python package designed to reduce the need for code to be over-complex by providing one-line solutions to problems.

Features list

  1. Json: Json is a package widely used for data storage.
  2. print: print is used to print to the terminal.
  3. Flask: Flask is a popular library for starting web servers.
  4. Paste: This module allows users to send data to a hastebin site.

More coming soon.

Documentation

This is a section for the documentation for all of the modules in the package.

Json

First import the Json branch of the package with:

            from SimplifyPython import sjson

Then you can choose to create a file with:

            sjson.new(filename)

where filename is either the name of a json file without the .json or a filename with an extension for example data.app.json.

Or if you already have a file you can read it with:

            data = sjson.open(filename)

where filename is either the name of a file. This will set the data variable to be the contents of the json file.

Then when you are finished editing the data you can run:

            sjson.save(data, filename)

where data is the edited data to be put in the json file and filename is either the name of a file.

Print

First import the print branch with:

            from SimplifyPython import sprint

Then to use the package type:

            `sprint.{color}(message)

Where color is a color from the below list and treat message like a normal print command arguments.

  1. red
  2. pink
  3. purple
  4. blue
  5. lightblue
  6. brightblue
  7. green
  8. lightgreen
  9. yellow
  10. orange

This will print in the color of your choice.

Flask

Import the sflask branch with:

            from SimplifyPython import sflask

Then add this one line to start the server:

            sflask.start()

The start() command has an optional parameter for a message on the web page to be pinged.

How to run on a thread.

If you want to run the server on its own thread you can put this in your code:

            sflask.thread().start()

This module of the package can also take a custom message for example:

            sflask.thread("hello, world!").start()

Will output "hello, world!" on the webpage.

How to serve multiple pages.

If you want to serve multiple different pages first create the page use either:

            sflask.create_page(route, message)

with route being the route of the site for example: '/' and message being the message to be served to users or a html file name for example index.html this file must be in the templates directory of your project.

You can loop through this as many times as you want.

Then when you have defined all of the pages for your site run:

            sflask.launch_pages().start()

To run all the sites on a thread or:

            sflask.launch_pages_nothread()

To run the sites on the main thread.

Paste

Import the spaste branch with:

            from SimplifyPython import spaste

Then to send a string to hastebin type:

            spaste.text(string)

The message variable should be the content of the paste after you run it it will print the link to the terminal. A second argument of URL can be given if you would like to paste it on a different site Likely wont work with some sites

Just define the filename of the desired file and let the package do the rest. A second argument of URL can be given if you would like to paste it on a different site _Likely wont work with some sites

If you want to sent a files contents to hastebin.

            spaste.file(filename)

To read hastebin files use.

            spaste.read(url)

Or

            spaste.save(url, filepath)

These are mostly straightforward URL is the Hastebin URL and for the save function filepath is the path of the file to save the data to.

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

SimplifyPython-0.0.11.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

SimplifyPython-0.0.11-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file SimplifyPython-0.0.11.tar.gz.

File metadata

  • Download URL: SimplifyPython-0.0.11.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for SimplifyPython-0.0.11.tar.gz
Algorithm Hash digest
SHA256 05b47e1281e29122ef45f8ad4ee2a113b18cb5dc514d5e5a175c63b951f1f5c4
MD5 80120f24adcf43c8fa114d50b5a12fa9
BLAKE2b-256 34bcc9bead6dddb90ffe1a2a9a38b862d89ce768617532f7966574faf922635b

See more details on using hashes here.

File details

Details for the file SimplifyPython-0.0.11-py3-none-any.whl.

File metadata

File hashes

Hashes for SimplifyPython-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 5af4e4b382472035293284c41299e6d8a54dc1c690bf827d028791a47c7dc4c7
MD5 41313dbbd67f11f49406b8b1d328e611
BLAKE2b-256 cc501a2ccfad7a62f5f83243648e9d896572026e964a1307fc99e46b38adc3ff

See more details on using hashes here.

Supported by

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