I am trying to create a PIP package for a set of reusable APIs. I have already implemented those API in a project and are working perfectly fine.
I started looking for the way to package these API so that it can be integrated with any other project and that is how I learned about setuptools. To gain a little hands on experience with setuptools I simply created a PIP package for a helloworld() program.
Now, I have started creating the package for the API I have in my DRF app. I created an empty directory and moved all the modules of this DRF app into that directory. The setup.py file is well configured to install the dependencies which are required by these modules.
However, now I want to start this application and see if it is working or not. So when I run python manage.py runserver it didn't work because of an obvious reason - No such file or directory.
Moreover, there are certain configuration which are required for this package to work and in my previous project it is defined in settings.py file.
setup.py
import os
from setuptools import setup, find_packages
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
def get_doc():
with open("README.md", "r") as fh:
return fh.read()
setup(
name="django_restframework_2fa",
version="0.0.1",
description="Some description",
long_description=get_doc(),
long_description_content_type="text/markdown",
url="https://github.com/jeetpatel9/django-restframework-2fa.git",
py_modules=['helloworld'],
package_dir={'': 'some_dir'},
author='Jeet Patel',
author_email='****@gmail.com',
python_requires='>=3.7',
include_package_data=True,
zip_safe=False,
packages=find_packages(
exclude=['tests', 'tests.*', 'licenses', 'requirements']),
classifiers=[
"Environment :: Web Environment",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Framework :: Django",
"Framework :: Django :: 3.1",
"Framework :: Django :: 3.2",
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Topic :: Internet :: WWW/HTTP',
],
install_requires=[
"djangorestframework",
"django",
"djangorestframework-simplejwt",
"pyjwt",
"twilio==6.55.0",
"djangorestframework-simplejwt==4.6.0",
"django-phonenumber-field==5.2.0",
"phonenumbers==8.12.24",
],
extra_requires={
"dev": [
"pytest>=3.7",
"twine 3.4.1",
]
}
)
I have looked everywhere on internet to understand how to -
- define
settings.pyfile while developing a PIP package. - start this package for development and testing.
Any references to the articles or tutorials will also work for me.
This community is my last hope.