Answers for "create your own python package"

7

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
Posted by: Guest on December-04-2020
2

pypi release

python3 setup.py sdist bdist_wheel
twine upload dist/*
Posted by: Guest on August-22-2020
2

create python package

python3 setup.py sdist bdist_wheel
Posted by: Guest on February-13-2020
0

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
Posted by: Guest on August-31-2021

Code answers related to "create your own python package"

Python Answers by Framework

Browse Popular Code Answers by Language