vyapp / vy

A vim-like in python made from scratch.
MIT License
1.15k stars 54 forks source link

Add install_requires in setup.py #27

Closed yetone closed 6 years ago

yetone commented 7 years ago

Instead of manual install

iogf commented 7 years ago

It seems install_requires is a setuptools thing, i would need to switch to setuptools instead of remaining with disutils.

http://stackoverflow.com/questions/9810603/adding-install-requires-to-setup-py-when-making-a-python-package

did you test that code?

[root@sigma vy-code]# python2 setup.py  install
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
  warnings.warn(msg)
running install
running build
running build_py
running build_scripts
running install_lib
copying build/lib/vyapp/plugins/mc.py -> /usr/lib/python2.7/site-packages/vyapp/plugins
byte-compiling /usr/lib/python2.7/site-packages/vyapp/plugins/mc.py to mc.pyc
running install_scripts
copying build/scripts-2.7/askpass -> /usr/bin
copying build/scripts-2.7/vy -> /usr/bin
changing mode of /usr/bin/askpass to 755
changing mode of /usr/bin/vy to 755
running install_egg_info
Removing /usr/lib/python2.7/site-packages/vy-2.2.0-py2.7.egg-info
Writing /usr/lib/python2.7/site-packages/vy-2.2.0-py2.7.egg-info
[root@sigma vy-code]    
yetone commented 7 years ago

I am very sorry, it's my fault. Yes, you should use setuptools to support this feature.

iogf commented 7 years ago

Hey, sorry for the delay. i'm considering to switch to setuptools. i'm sort of a biased to remain with disutils. Which are your cons and pros about disutils though?

yetone commented 7 years ago

Sorry for the delay again 😅

I think distutils has it's historic limitations. It is useful for simple Python distributions, but lacks features.

Setuptools was developed to overcome Distutils' limitations.

iogf commented 7 years ago

Hey, have you checked this thread?

https://stackoverflow.com/questions/14399534/reference-requirements-txt-for-the-install-requires-kwarg-in-setuptools-setup-py

Check this too: https://packaging.python.org/requirements/

It seems it may lead to some problems if we use install_requires the same as requirements.txt.

I'm okay with switching to setuptools however, we need to better analyze this scenary. I have plans to get vy and untwisted to py3 soon, it seems that despite of requirements.txt having the same data that install_requires demands to get vy working straight it may have discrepancies in the future due to the addition of plugins etc.

It seems the best approach now it is listing minimal versions for which vy dependencies work then listing them in install_requires but not reading from requirements.txt. It is necessary to update requirements.txt too.

There is something else to notice too, some of vy plugins, the golang_completion(which i have implemented today, ruby_completion and javascript_completion, fsniff, ) would need some sort of manual installation. In this regard it doesnt seem much plausible worrying too much of automatic installation of dependencies by setuptools.

It seems i haven't included requirements.txt in MANIFEST.in so one couldnt do:

pip2 download vy
tar -zxvf vy-2.2.0.tar.gz
cd vy-2.2.0
pip2 install -r requirements.txt
python2 setup.py install

Hear you soon.