Skip to main content

About PyBookLib

PyBookLib is a two part library designed to host and get template code projects. It is written for mainly Python programs, but it is possible to host other languages as well. PyBookLib has two submodules, each independant of one another: PyBook and PyLib. PyBookLib has no affiliations with the existing PyPI projects PyBook and PyLib. It is a completely separated project, and just happened to be library themed. 😁

Install

You can install the package through the following:

> pip install -U pybooklib

If you want the latest development version, which most definitely has bugs, run the following:

> pip install git+https://github.com/BD103/PyBookLib

Use

To pull up this markdown file in the console, you can run pybooklib in the command line. Running pybook or pylib gives a list of possible commands with each.

PyBookLib

The main PyBookLib module has no current function beyond a code bridge and displaying this markdown file in the command line.

> pybooklib

PyBook

PyBook's main functionality is connecting to a hosted library and receiving books (.zip files). The library that is accessed is defined by an environmental variable. Try running something like this:

from pybooklib import pybook
import os

# Set environmental variable for library. Unecessary but helpful all the same
pybook.set_url("https://library.bd103.repl.co/api")

# Gets a book "sample-library" from the user "BD103" with the version "1.2" and extracts contents to the directory "pylib-library"
pybook.get(user="BD103", book="sample-library", version="1.2", direc="pylib-library")

With this simple script, it connects to library.bd103.repl.co and requests sample-library. This book is a sample script to host your own library. (It was created for Replit, so that's why there is a pyproject.toml.)

You can also run some bash commands:

# Get a list of commands
> pybook --help
> pybook get-book BD103 sample-library --version 1.2 --direc pylib-library
> pybook get-user BD103
# This should automatically be set to library.bd103.repl.co/api
> pybook set-url https://link.to.site/api
# Umbrella get function to specify exact details
> pybook get --user BD103 --direc folder

You do not have to specify all these parameters. Try removing and replacing some of them and see what happens!

PyLib

PyLib is for hosting your own library. It is extremely simple. Install pybooklib, and choose your path:

Note: These paths will automatically set the IP and Port to 0.0.0.0:8000. If on a local machine, you can connect through localhost:8000. If using a server hosting service, it should automatically set the host to your domain. If you are having conflicts with the port, or want a different IP, you can specify it by taking the Python main.py path and replacing pylib.run() with pylib.run(host="1.2.3.4", port=8080).

Python main.py

Create a file called main.py. Inside, paste the following:

from pybooklib import pylib

pylib.run()

Run the script to start hosting your library.

CLI

In the command line, run the following:

pylib run

Watch as your server gets hosted.

Contributing

If you want to contribute to this project, go to github.com/BD103/PyBookLib, create a fork and a pull request. All code should be run through the following commands:

black pybooklib
isort pybooklib --profile black
flake8 pybooklib

PyTest is not yet implemented. Stay tuned! 🎵

Metadata

Release files for pybooklib 1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pybooklib 1.2
File Size Uploaded
pybooklib-1.2.tar.gz 8.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pybooklib 1.2
File Interpreter ABI Platform
pybooklib-1.2-py3-none-any.whl Python 3 none any Details

Total release size: 22.3 kB

Release files / pybooklib-1.2.tar.gz

Download URL pybooklib-1.2.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b983d793ac504a174556bdb99f26f0e7cc6f4b7c15c4875abf5647dfbc232f7a
BLAKE2b-256 checksum
How to use checksums
cd476d18f1ba5ea46b9872cd29e7dabbc53a1b01e4c6ffbc523677b6062352f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.8.0 tqdm/4.54.1 CPython/3.8.7

Release files / pybooklib-1.2-py3-none-any.whl

Download URL pybooklib-1.2-py3-none-any.whl
Size 14.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
94aba5b13cb25cbe91cfed11c8a182148ddcc29c465392bfd64febfc7620f677
BLAKE2b-256 checksum
How to use checksums
a1693c05bc345af052c4f06a4158458ccf181736f576408d3a00fe11df7aef84
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.8.0 tqdm/4.54.1 CPython/3.8.7

Release history Release notifications | RSS feed

This release

1.2 This release

2 release files

1.1

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page