Created Package But Cannot Use It From Pypi
This started from here, but has changed so much I felt I had to start another question. I created a package (thompcoUtils) with python 3: setup.py: import setuptools with open('RE
Solution 1:
OK, after many trials and tribulations to get everything just right, it turns out it isn't very hard.
created a folder with the following files and single sub-folder (thompcoutils - the name should be the name of your package):
./LICENSE
./install.sh
./thompcoutils
./thompcoutils/logging.py
./thompcoutils/os.py
./thompcoutils/__init__.py
./README.md
./setup.py
install.sh is a helper script to build and install the package into pypi.org:
#!/bin/bash
build=1
clean=1
if [[ $# -gt 0 ]]
thenif [[ $1=="clean" ]]
then
build=0
fifiif [[ $clean -eq 1 ]]
thenrm -rf dist
rm -rf build
rm -f *.whl
rm -rf *.egg-info
fiif [[ $build -eq 1 ]]
then
python3 setup.py sdist bdist_wheel
twine upload --repository pypi dist/*
fi
The package name is thompcoutils as defined by the sub-folder name and the setup.py file.
Here is the setup.py:
import setuptools
withopen("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="thompcoutils",
version="0.0.16",
author="Jordan Thompson",
author_email="Jordan@ThompCo.com",
description="Another collection of utilities",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/pypa/sampleproject",
packages=setuptools.find_packages(),
install_requires=[
'psutil', 'netifaces'
],
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
)
exclude_package_data = {'': ['install.sh']},
Note that you have to increment the version every time you push to the cloud. I hope this will help someone in the future (and serve as a reminder to me ;-)
Post a Comment for "Created Package But Cannot Use It From Pypi"