Create, upload, and use Python project templates.
Project description
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 replacingpylib.run()
withpylib.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! 🎵
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pybooklib-1.2.tar.gz
.
File metadata
- Download URL: pybooklib-1.2.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b983d793ac504a174556bdb99f26f0e7cc6f4b7c15c4875abf5647dfbc232f7a |
|
MD5 | 2e8b6879558c218a63c738ab28ff6358 |
|
BLAKE2b-256 | cd476d18f1ba5ea46b9872cd29e7dabbc53a1b01e4c6ffbc523677b6062352f3 |
File details
Details for the file pybooklib-1.2-py3-none-any.whl
.
File metadata
- Download URL: pybooklib-1.2-py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94aba5b13cb25cbe91cfed11c8a182148ddcc29c465392bfd64febfc7620f677 |
|
MD5 | a73fb890ed25fd37a6542e72e9b4de8f |
|
BLAKE2b-256 | a1693c05bc345af052c4f06a4158458ccf181736f576408d3a00fe11df7aef84 |