Create and publish your own packages within Python!
Project description
packagelib
Create and publish your modules to PyPI all in python!
Importing packagelib:
How to import packagelib with no issues:
import packagelib.main
Naming your module:
Give your module a name using the packagelib.name() function:
import packagelib.main as pack
pack.name("MyExamplePackage")
Setup files and directories:
Setup all files and directories with the packagelib.setup() function:
import packagelib.main as pack
pack.name("MyExamplePackage")
pack.setup()
Give your package a PyPI description:
This will be the description that shows up on PyPI:
import packagelib.main as pack
pack.name("MyExamplePackage")
pack.setup()
pack.description("This is my example package with packagelib!!")
Upload a script to your module:
This will be the script that will contain your code. Make sure you have the right content.
import packagelib.main as pack
pack.name("MyExamplePackage")
pack.setup()
pack.description("This is my example package with packagelib!!")
pack.uploadScript("myCode.py") # Enter a file name with your code
OR
Enter the script directly:
import packagelib.main as pack
pack.name("MyExamplePackage")
pack.setup()
pack.description("This is my example package with packagelib!!")
pack.uploadScript("""
def add_one(number):
return number + 1
""")
ALSO
You can write the __init__.py file:
import packagelib.main as pack
pack.name("MyExamplePackage")
pack.setup()
pack.description("This is my example package with packagelib!!")
pack.uploadScript("myCode.py", init="import requests")
AND
Your module will automatically be a package. For example, my module I am using as an example (MyExamplePackage) would be imported as 'MyExamplePackage.main'. You can change the name of the package from 'main', by changing the optional argument [name] to your choice. You can also allow you module to not be imported as a package by adding the text 'import main' to the __init__.py file.
import packagelib.main as pack
pack.name("MyExamplePackage")
pack.setup()
pack.description("This is my example package with packagelib!!")
pack.uploadScript("myCode.py", name="code")
The example above would make the module "MyExamplePackage" be imported as "MyExamplePackage.code"
Giving you module a license:
Currently, this version only allows MIT and AGPLv3, but more should be coming
import packagelib.main as pack
pack.name("MyExamplePackage")
pack.setup()
pack.description("This is my example package with packagelib!!")
pack.uploadScript("myCode.py")
pack.license().mit() # if you would like an AGPLv3 license, just replace 'mit()' with 'agplv3()'
Adding required data to your module
Use the packaglib.noteInfo(version, author, email, python-version, description) function to add required info to your module. In the 'version' argument, put the version of your module In the 'author' argument, please put your name or username In the 'email' argument, put the email address associated with your module.
If you have posted your code on GitHub, also fill out the 2 arguments 'homepage' and 'bugs': The 'homepage' argument is the homepage of your module on GitHub. The 'bugs' argument is the bug tracker associated with your module on GitHub.
Example:
import packagelib.main as pack
pack.name("MyExamplePackage")
pack.setup()
pack.description("This is my example package with packagelib!!")
pack.uploadScript("myCode.py")
pack.license().mit()
pack.noteInfo(
'0.0.1',
'My Name',
'MyEmail@example.net',
'3.7',
'This is a test package!!!'
home='https://github.com/MyUsername/MyExamplePackage'
bugs='https://github.com/MyUsername/MyExamplePackage/issues'
)
Compile your module:
Compile your module files into a complex binary format to be published:
import packagelib.main as pack
pack.name("MyExamplePackage")
pack.setup()
pack.description("This is my example package with packagelib!!")
pack.uploadScript("myCode.py")
pack.license().mit()
pack.noteInfo(
'0.0.1',
'My Name',
'MyEmail@example.net',
'3.7',
'This is a test package!!!'
home='https://github.com/MyUsername/MyExamplePackage'
bugs='https://github.com/MyUsername/MyExamplePackage/issues'
)
pack.buildDist()
Finally, publish your module:
When you run this command, keep in mind it will also put it on TestPyPI by default, so you must set the optional argument 'test' to False.
import packagelib.main as pack
pack.name("MyExamplePackage")
pack.setup()
pack.description("This is my example package with packagelib!!")
pack.uploadScript("myCode.py")
pack.license().mit()
pack.noteInfo(
'0.0.1',
'My Name',
'MyEmail@example.net',
'3.7',
'This is a test package!!!'
home='https://github.com/MyUsername/MyExamplePackage'
bugs='https://github.com/MyUsername/MyExamplePackage/issues'
)
pack.buildDist()
pack.publish('MyUsername', test=False)
I hope you enjoyed creating your module!
Thanks!
Please visit my GitHub account here!
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 packagelib-0.1.8.tar.gz
.
File metadata
- Download URL: packagelib-0.1.8.tar.gz
- Upload date:
- Size: 29.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 367faa0e3e7517b84e35af224a814cc6657d07cd21caa87d03bfc593cd17e86e |
|
MD5 | 406429505066545115ec51fe10150a0d |
|
BLAKE2b-256 | ae213a9ce43f7d673108a224b56473eb64c6f17739e0ebdaa7a8ffbd2f756788 |
File details
Details for the file packagelib-0.1.8-py3-none-any.whl
.
File metadata
- Download URL: packagelib-0.1.8-py3-none-any.whl
- Upload date:
- Size: 29.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bae8953293501c900cd6a0fd389b3825e62c21eed5fea7afd785a559a344f02 |
|
MD5 | 41fd5a7ab1fe75069c914f3fa59a3795 |
|
BLAKE2b-256 | 30b42b0c6a0d531c251cdd2a372b7c82b30e20a9f809673fe2524e43a4f7aee3 |