Skip to main content

Python libraries for MPZinke.

Project description

Python

Python libraries for MPZinke.

Modules

DownloadIterator

An object that takes a request to download large amounts of data and can run a function for each chunk.

Alternatives & Justification

requests allows for downloading large amounts of data, but when downloading a large amount of data, memory usage can be a factor. As such, writing to a file may be required. The DownloadIterator object wraps the request to allow for iterative download and processing of data.

Additionally, the request timeout specifies the amount of time for the server to respond, not the amount of time spent downloading the response. DownloadIterator provides a way to specify a maximum amount of time downloading a file.

Usage

Usage can be found here Notably, stream must be set to True.

Generic

A class that can be called or inherited to make a function, method or class generic.

Alternatives & Justification

typing.Generic is a built-in class for generics. It however lacks the ability to be inherited from nor to store the generic's type. EG, if MyGenericClass inherits from typing.Generic, there is no way in MyGenericClass[int] to know the type of int once the class is instantiated.

Further more, typing.Generic cannot be applied to functions. As such, the mpzinke.Generic stores the type in a .__args__ attribute like list and Dict.

Usage

Usage can be found here

is_json(string: str) -> bool:

is_json checks when a string is JSON parsable.

Alternatives & Justification

json.loads is the core of the is_json function. However to know if a string can be safely parsed, one must wrap it with a try-catch block. This does that automatically.

Usage

Usage can be found here

Possible Future Enhancements

  1. Add optional function to execute if string is successfully parsed.

Server

Server is a class that wraps a Flask server to provide for easier server setup, error handling, authorization, and route addition. Additionally, it uses the doc strings of functions' passed to routes to document all endpoints.

Alternatives & Justification

Flask servers offer great API's for adding routes, but are limited in that a route only take 1 function for all METHODS.

Usage

Usage can be found here

Possible Future Enhancements

  1. Add optional function to execute if string is successfully parsed.

A Flask server class for simple routing by HTTP method.

Build Commands

FROM: https://packaging.python.org/en/latest/tutorials/packaging-projects/

  • python3 -m pip install --upgrade build
  • python3 -m pip install --upgrade twine
  • python3 -m build
  • python3 -m twine upload --repository testpypi dist/*
    • username: __token__
    • password: <API KEY>

python3 -m pip install --index-url https://test.pypi.org/simple/ --no-deps python_server_MPZinke

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

mpzinke-0.8.4.tar.gz (29.8 kB view details)

Uploaded Source

Built Distribution

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

mpzinke-0.8.4-py3-none-any.whl (35.3 kB view details)

Uploaded Python 3

File details

Details for the file mpzinke-0.8.4.tar.gz.

File metadata

  • Download URL: mpzinke-0.8.4.tar.gz
  • Upload date:
  • Size: 29.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for mpzinke-0.8.4.tar.gz
Algorithm Hash digest
SHA256 490c8f61d790d67f7c745a4404899c72f0b6f5bec0b90d20ee82680c48ce80ce
MD5 213c4eec0c932805c8398ff90e5589ba
BLAKE2b-256 3b82d46d42f6f11e89d3e351ac741cc222a802611e07149a7b0e814c5e013b8a

See more details on using hashes here.

File details

Details for the file mpzinke-0.8.4-py3-none-any.whl.

File metadata

  • Download URL: mpzinke-0.8.4-py3-none-any.whl
  • Upload date:
  • Size: 35.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for mpzinke-0.8.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0c91010912d69962b56886106ae98a5ef7e824d2b1a7ac98e98d01978e8bdcc7
MD5 b83c3a474feee21b2f20e48a53964a93
BLAKE2b-256 9c7e02574ffd4d3fe0ad9242af5c797f45a8fc1b3220108d2f8e719d61c202a1

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