I am working on a python project.
I have already created my setup.py file.
Is there a way to make use of setup.py file install_requires section so as to create my virtualenv, or do I have to explicitly create a requirements.txt file and proceed with
virtualenv -p python3 venvpip install -r requirements.txt setup.py installs the package in whichever environment is active. If you want to install it in a virtualenv, then you need to activate it first. Otherwise it will install globally.
You can continue using requirements.txt but let setup.py handle the installation. You can then read the file and set the list of dependencies for install_requires section.
from setuptools import setup, find_packages
with open('requirements.txt') as f:
requirements = f.readlines()
setup(
name='myawesomepackage',
version='0.1',
packages=find_packages(),
url='https://example.com',
author='abdusco',
description='',
install_requires=requirements,
entry_points=dict(console_scripts=[
'myawesomeapp=app:main'
])
)
Here's requirements.txt
certifi==2019.3.9
chardet==3.0.4
Click==7.0
idna==2.8
requests==2.22.0
urllib3==1.25.3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With