how to make python package
# This is too much for a grepper answer, so here is a link to the tutorial:
# https://towardsdatascience.com/how-to-build-your-first-python-package-6a00b02635c9
how to make python package
# This is too much for a grepper answer, so here is a link to the tutorial:
# https://towardsdatascience.com/how-to-build-your-first-python-package-6a00b02635c9
create python package
python3 setup.py sdist bdist_wheel
how to i make my own python package
# So first, create a file structure following
# this template:
"""
package_name
|-- __init__.py
|-- sayHello.py
"""
# This will be a dummy package
# (Some python code to automatically create this dummy file structure)
import os
os.mkdir("package_name")
open("package_name/__init__.py", "w")
open("package_name/sayHello.py", "w")
# Now we have our file structure
# Im gonna explain what the shit this means
"""
1. __init__.py
The __init__.py file is the file that will be run when importing the package,
normally people write in it the imports to import the rest
2. sayHello.py
Will be imported from __init__.py and will contain an init function,
which will, obviously, print "Hello, World!"
"""
# So now we write the following content in the following files:
###### __init__.py
from sayHello import init
# you also can add a bunch of shit
__author__ = "YourName"
__version__ = (0)
# etc..
###### sayHello
def init():
print("Hello, World!")
# Now we're done!
# you can make a new file named test.py
"""
The file structure becomes this:
test.py
package_name
|-- __init__.py
|-- sayHello.py
"""
# And write this in test.py
###### test.py
import package_name
package_name.init()
# If your python version is not from the dark web
# it should work
# kthxbye
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us