I created a pypi package for an api to get the lessons from my school and uploaded it to pypi but when I install it, it doesn't get recognized. It works just fine locally when.
I have tried deleting some lines from the startup.py like modules: []
but it doesn't seem to change anything and still works locally just fine
setup.py
from setuptools import setup
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name="zermelo.py",
version="1.0.0",
license="MIT",
url="https://github.com/wouter173/zermelo.py",
description="Zermelo api wrapper library for python.",
long_description=long_description,
long_description_content_type="text/markdown",
package_dir={"zermelo": "zermelo"},
install_requires=["requests>=2.17.0"],
classifiers=[
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Operating System :: OS Independent",
"License :: OSI Approved :: MIT License",
"Development Status :: 5 - Production/Stable",
]
)
The source code is put into a __init__
file like this:
from .client import Client
and in the .client
file which is client.py
I have a class called Client
with some functions but I don't think this has anything to do with it as it works just fine locally
I try to import the package into a project like this:
from zermelo import Client
Which works locally but not in a pipenv.
These are the commands I use to upload the package to pypi:
python setup.py sdist
python setup.py bdist_wheel sdist
twine upload dist/*
and this is how I use my pipenv:
pipenv --python 3.7
pipenv install zermelo.py
pipenv shell
python
>>> from zermelo import Client
But again that does not work and I have no idea why.
When I import it in pipenv:
from zermelo import Client
It gives returns an Error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'zermelo'
I have tried putting different names and capitalizing zermelo but nothing works to import Client from zermelo but locally
from zermelo import Client
works the way I want to it returns the Client from the init .py file.
Your setup.py
lists nothing to install. You must use packages=<a list of packages>
or py_modules=<a list of .py modules>
.
See https://packaging.python.org/tutorials/packaging-projects/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.