Merge branch 'master' into mysql-python

This commit is contained in:
Alan Barzilay 2021-03-23 21:50:03 -03:00 committed by GitHub
commit 0449fa8341
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 133 additions and 665 deletions

View File

@ -49,6 +49,7 @@ Usage
--force Overwrite existing requirements.txt --force Overwrite existing requirements.txt
--diff <file> Compare modules in requirements.txt to project imports. --diff <file> Compare modules in requirements.txt to project imports.
--clean <file> Clean up requirements.txt by removing modules that are not imported in project. --clean <file> Clean up requirements.txt by removing modules that are not imported in project.
--no-pin Omit version of output packages.
Example Example
------- -------
@ -69,5 +70,5 @@ Why not pip freeze?
------------------- -------------------
- ``pip freeze`` only saves the packages that are installed with ``pip install`` in your environment. - ``pip freeze`` only saves the packages that are installed with ``pip install`` in your environment.
- ``pip freeze`` saves all packages in the environment including those that you don't use in your current project. (if you don't have virtualenv) - ``pip freeze`` saves all packages in the environment including those that you don't use in your current project (if you don't have ``virtualenv``).
- and sometimes you just need to create requirements.txt for a new project without installing modules. - and sometimes you just need to create ``requirements.txt`` for a new project without installing modules.

View File

@ -1,3 +1,4 @@
AFQ:pyAFQ
AG_fft_tools:agpy AG_fft_tools:agpy
ANSI:pexpect ANSI:pexpect
Adafruit:Adafruit_Libraries Adafruit:Adafruit_Libraries
@ -13,6 +14,7 @@ Crypto:pycryptodome
Cryptodome:pycryptodomex Cryptodome:pycryptodomex
FSM:pexpect FSM:pexpect
FiftyOneDegrees:51degrees_mobile_detector_v3_wrapper FiftyOneDegrees:51degrees_mobile_detector_v3_wrapper
functional:pyfunctional
GeoBaseMain:GeoBasesDev GeoBaseMain:GeoBasesDev
GeoBases:GeoBasesDev GeoBases:GeoBasesDev
Globals:Zope2 Globals:Zope2
@ -22,6 +24,7 @@ Kittens:astro_kittens
Levenshtein:python_Levenshtein Levenshtein:python_Levenshtein
Lifetime:Zope2 Lifetime:Zope2
MethodObject:ExtensionClass MethodObject:ExtensionClass
MySQLdb:MySQL-python
OFS:Zope2 OFS:Zope2
OpenGL:PyOpenGL OpenGL:PyOpenGL
OpenSSL:pyOpenSSL OpenSSL:pyOpenSSL
@ -536,6 +539,7 @@ cassandra:cassandra_driver
cassandralauncher:CassandraLauncher cassandralauncher:CassandraLauncher
cc42:42qucc cc42:42qucc
cerberus:Cerberus cerberus:Cerberus
cfnlint:cfn-lint
chameleon:Chameleon chameleon:Chameleon
charmtools:charm_tools charmtools:charm_tools
chef:PyChef chef:PyChef
@ -580,16 +584,18 @@ daemon:python_daemon
dare:DARE dare:DARE
dateutil:python_dateutil dateutil:python_dateutil
dawg:DAWG dawg:DAWG
decouple:python-decouple
deb822:python_debian deb822:python_debian
debian:python_debian debian:python_debian
decouple:python-decouple
demo:webunit demo:webunit
demosongs:PySynth
deployer:juju_deployer deployer:juju_deployer
depot:filedepot depot:filedepot
devtools:tg.devtools devtools:tg.devtools
dgis:2gis dgis:2gis
dhtmlparser:pyDHTMLParser dhtmlparser:pyDHTMLParser
digitalocean:python_digitalocean digitalocean:python_digitalocean
discord:discord.py
distribute_setup:ez_setup distribute_setup:ez_setup
distutils2:Distutils2 distutils2:Distutils2
django:Django django:Django
@ -699,7 +705,6 @@ html:pies2overrides
htmloutput:nosehtmloutput htmloutput:nosehtmloutput
http:pies2overrides http:pies2overrides
hvad:django_hvad hvad:django_hvad
krbv:krbV
i99fix:199Fix i99fix:199Fix
igraph:python_igraph igraph:python_igraph
imdb:IMDbPY imdb:IMDbPY
@ -725,6 +730,7 @@ keyczar:python_keyczar
keyedcache:django_keyedcache keyedcache:django_keyedcache
keystoneclient:python_keystoneclient keystoneclient:python_keystoneclient
kickstarter:kickstart kickstarter:kickstart
krbv:krbV
kss:kss.core kss:kss.core
kuyruk:Kuyruk kuyruk:Kuyruk
langconv:AdvancedLangConv langconv:AdvancedLangConv
@ -773,6 +779,8 @@ mimeparse:python_mimeparse
minitage:minitage.paste minitage:minitage.paste
minitage:minitage.recipe.common minitage:minitage.recipe.common
missingdrawables:android_missingdrawables missingdrawables:android_missingdrawables
mixfiles:PySynth
mkfreq:PySynth
mkrst_themes:2lazy2rest mkrst_themes:2lazy2rest
mockredis:mockredispy mockredis:mockredispy
modargs:python_modargs modargs:python_modargs
@ -788,12 +796,12 @@ monthdelta:MonthDelta
mopidy:Mopidy mopidy:Mopidy
mopytools:MoPyTools mopytools:MoPyTools
mptt:django_mptt mptt:django_mptt
mpv:python-mpv
mrbob:mr.bob mrbob:mr.bob
msgpack:msgpack_python msgpack:msgpack_python
mutations:aino_mutations mutations:aino_mutations
mws:amazon_mws mws:amazon_mws
mysql:mysql_connector_repackaged mysql:mysql_connector_repackaged
MySQLdb:MySQL-python
native_tags:django_native_tags native_tags:django_native_tags
ndg:ndg_httpsclient ndg:ndg_httpsclient
nereid:trytond_nereid nereid:trytond_nereid
@ -824,12 +832,14 @@ past:future
paste:PasteScript paste:PasteScript
path:forked_path path:forked_path
path:path.py path:path.py
patricia:patricia-trie
paver:Paver paver:Paver
peak:ProxyTypes peak:ProxyTypes
picasso:anderson.picasso picasso:anderson.picasso
picklefield:django-picklefield picklefield:django-picklefield
pilot:BigJob pilot:BigJob
pivotal:pivotal_py pivotal:pivotal_py
play_wav:PySynth
playhouse:peewee playhouse:peewee
plivoxml:plivo plivoxml:plivo
plone:plone.alterego plone:plone.alterego
@ -913,7 +923,6 @@ plone:plone.z3cform
plonetheme:plonetheme.barceloneta plonetheme:plonetheme.barceloneta
png:pypng png:pypng
polymorphic:django_polymorphic polymorphic:django_polymorphic
portalocker:ConcurrentLogHandler
postmark:python_postmark postmark:python_postmark
powerprompt:bash_powerprompt powerprompt:bash_powerprompt
prefetch:django-prefetch prefetch:django-prefetch
@ -951,6 +960,14 @@ pyrimaa:AEI
pysideuic:PySide pysideuic:PySide
pysqlite2:adhocracy_pysqlite pysqlite2:adhocracy_pysqlite
pysqlite2:pysqlite pysqlite2:pysqlite
pysynth_b:PySynth
pysynth_beeper:PySynth
pysynth_c:PySynth
pysynth_d:PySynth
pysynth_e:PySynth
pysynth_p:PySynth
pysynth_s:PySynth
pysynth_samp:PySynth
pythongettext:python_gettext pythongettext:python_gettext
pythonjsonlogger:python_json_logger pythonjsonlogger:python_json_logger
pyutilib:PyUtilib pyutilib:PyUtilib
@ -985,6 +1002,7 @@ ruamel:ruamel.base
s2repoze:pysaml2 s2repoze:pysaml2
saga:saga_python saga:saga_python
saml2:pysaml2 saml2:pysaml2
samtranslator:aws-sam-translator
sass:libsass sass:libsass
sassc:libsass sassc:libsass
sasstests:libsass sasstests:libsass
@ -1008,6 +1026,7 @@ singleton:pysingleton
sittercommon:cerebrod sittercommon:cerebrod
skbio:scikit_bio skbio:scikit_bio
sklearn:scikit_learn sklearn:scikit_learn
slack:slackclient
slugify:unicode_slugify slugify:unicode_slugify
smarkets:smk_python_sdk smarkets:smk_python_sdk
snappy:ctypes_snappy snappy:ctypes_snappy

View File

@ -31,6 +31,7 @@ Options:
imports. imports.
--clean <file> Clean up requirements.txt by removing modules --clean <file> Clean up requirements.txt by removing modules
that are not imported in project. that are not imported in project.
--no-pin Omit version of output packages.
""" """
from __future__ import print_function, absolute_import from __future__ import print_function, absolute_import
from contextlib import contextmanager from contextlib import contextmanager
@ -156,8 +157,8 @@ def get_all_imports(
return list(packages - data) return list(packages - data)
def filter_line(l): def filter_line(line):
return len(l) > 0 and l[0] != "#" return len(line) > 0 and line[0] != "#"
def generate_requirements_file(path, imports): def generate_requirements_file(path, imports):
@ -309,9 +310,10 @@ def parse_requirements(file_):
logging.error("Failed on file: {}".format(file_)) logging.error("Failed on file: {}".format(file_))
raise raise
else: else:
data = [x.strip() for x in f.readlines() if x != "\n"] try:
finally: data = [x.strip() for x in f.readlines() if x != "\n"]
f.close() finally:
f.close()
data = [x for x in data if x[0].isalpha()] data = [x for x in data if x[0].isalpha()]
@ -375,16 +377,17 @@ def clean(file_, imports):
logging.error("Failed on file: {}".format(file_)) logging.error("Failed on file: {}".format(file_))
raise raise
else: else:
for i in f.readlines(): try:
if re_remove.match(i) is None: for i in f.readlines():
to_write.append(i) if re_remove.match(i) is None:
f.seek(0) to_write.append(i)
f.truncate() f.seek(0)
f.truncate()
for i in to_write: for i in to_write:
f.write(i) f.write(i)
finally: finally:
f.close() f.close()
logging.info("Successfully cleaned up requirements in " + file_) logging.info("Successfully cleaned up requirements in " + file_)
@ -427,6 +430,8 @@ def init(args):
imports = local + get_imports_info(difference, imports = local + get_imports_info(difference,
proxy=proxy, proxy=proxy,
pypi_server=pypi_server) pypi_server=pypi_server)
# sort imports based on lowercase name of package, similar to `pip freeze`.
imports = sorted(imports, key=lambda x: x['name'].lower())
path = (args["--savepath"] if args["--savepath"] else path = (args["--savepath"] if args["--savepath"] else
os.path.join(input_path, "requirements.txt")) os.path.join(input_path, "requirements.txt"))
@ -447,6 +452,9 @@ def init(args):
"use --force to overwrite it") "use --force to overwrite it")
return return
if args.get('--no-pin'):
imports = [{'name': item["name"], 'version': ''} for item in imports]
if args["--print"]: if args["--print"]:
output_requirements(imports) output_requirements(imports)
logging.info("Successfully output requirements") logging.info("Successfully output requirements")

View File

@ -1,6 +1,8 @@
__builtin__ __builtin__
__future__ __future__
__main__ __main__
_dummy_thread
_thread
_winreg _winreg
abc abc
aepack aepack
@ -15,6 +17,7 @@ argparse
array array
ast ast
asynchat asynchat
asyncio
asyncore asyncore
atexit atexit
audioop audioop
@ -28,6 +31,7 @@ binhex
bisect bisect
bsddb bsddb
buildtools buildtools
builtins
bz2 bz2
calendar calendar
Carbon Carbon
@ -101,6 +105,7 @@ code
codecs codecs
codeop codeop
collections collections
collections.abc
ColorPicker ColorPicker
colorsys colorsys
commands commands
@ -108,12 +113,16 @@ compileall
compiler compiler
compiler.ast compiler.ast
compiler.visitor compiler.visitor
concurrent
concurrent.futures
ConfigParser ConfigParser
configparser
contextlib contextlib
Cookie Cookie
cookielib cookielib
copy copy
copy_reg copy_reg
copyreg
cPickle cPickle
cProfile cProfile
crypt crypt
@ -127,6 +136,9 @@ curses.textpad
datetime datetime
dbhash dbhash
dbm dbm
dbm.dumb
dbm.gnu
dbm.ndbm
decimal decimal
DEVICE DEVICE
difflib difflib
@ -188,21 +200,27 @@ dummy_threading
EasyDialogs EasyDialogs
email email
email.charset email.charset
email.contentmanager
email.encoders email.encoders
email.errors email.errors
email.generator email.generator
email.header email.header
email.headerregistry
email.iterators email.iterators
email.message email.message
email.mime email.mime
email.parser email.parser
email.policy
email.utils email.utils
encodings encodings
encodings.idna encodings.idna
encodings.mbcs
encodings.utf_8_sig encodings.utf_8_sig
ensurepip ensurepip
enum
errno errno
exceptions exceptions
faulthandler
fcntl fcntl
filecmp filecmp
fileinput fileinput
@ -226,8 +244,8 @@ gensuitemodule
getopt getopt
getpass getpass
gettext gettext
gl
GL GL
gl
glob glob
grp grp
gzip gzip
@ -236,9 +254,17 @@ heapq
hmac hmac
hotshot hotshot
hotshot.stats hotshot.stats
html
html.entities
html.parser
htmlentitydefs htmlentitydefs
htmllib htmllib
HTMLParser HTMLParser
http
http.client
http.cookiejar
http.cookies
http.server
httplib httplib
ic ic
icopen icopen
@ -248,12 +274,17 @@ imgfile
imghdr imghdr
imp imp
importlib importlib
importlib.abc
importlib.machinery
importlib.util
imputil imputil
inspect inspect
io io
ipaddress
itertools itertools
jpeg jpeg
json json
json.tool
keyword keyword
lib2to3 lib2to3
linecache linecache
@ -261,6 +292,7 @@ locale
logging logging
logging.config logging.config
logging.handlers logging.handlers
lzma
macerrors macerrors
MacOS MacOS
macostools macostools
@ -301,11 +333,13 @@ os
os.path os.path
ossaudiodev ossaudiodev
parser parser
pathlib
pdb pdb
pickle pickle
pickletools pickletools
pipes pipes
PixMapWrapper PixMapWrapper
pkg_resources
pkgutil pkgutil
platform platform
plistlib plistlib
@ -322,10 +356,12 @@ py_compile
pyclbr pyclbr
pydoc pydoc
Queue Queue
queue
quopri quopri
random random
re re
readline readline
reprlib
resource resource
rexec rexec
rfc822 rfc822
@ -335,7 +371,9 @@ runpy
sched sched
ScrolledText ScrolledText
select select
selectors
sets sets
setuptools
sgmllib sgmllib
sha sha
shelve shelve
@ -350,10 +388,12 @@ smtplib
sndhdr sndhdr
socket socket
SocketServer SocketServer
socketserver
spwd spwd
sqlite3 sqlite3
ssl ssl
stat stat
statistics
statvfs statvfs
string string
StringIO StringIO
@ -361,8 +401,8 @@ stringprep
struct struct
subprocess subprocess
sunau sunau
sunaudiodev
SUNAUDIODEV SUNAUDIODEV
sunaudiodev
symbol symbol
symtable symtable
sys sys
@ -374,6 +414,7 @@ telnetlib
tempfile tempfile
termios termios
test test
test.support
test.test_support test.test_support
textwrap textwrap
thread thread
@ -382,17 +423,30 @@ time
timeit timeit
Tix Tix
Tkinter Tkinter
tkinter
tkinter.scrolledtext
tkinter.tix
tkinter.ttk
token token
tokenize tokenize
trace trace
traceback traceback
tracemalloc
ttk ttk
tty tty
turtle turtle
turtledemo
types types
typing
unicodedata unicodedata
unittest unittest
unittest.mock
urllib urllib
urllib.error
urllib.parse
urllib.request
urllib.response
urllib.robotparser
urllib2 urllib2
urlparse urlparse
user user
@ -401,6 +455,7 @@ UserList
UserString UserString
uu uu
uuid uuid
venv
videoreader videoreader
W W
warnings warnings
@ -408,6 +463,7 @@ wave
weakref weakref
webbrowser webbrowser
whichdb whichdb
winreg
winsound winsound
wsgiref wsgiref
wsgiref.handlers wsgiref.handlers
@ -422,654 +478,17 @@ xml.dom.minidom
xml.dom.pulldom xml.dom.pulldom
xml.etree.ElementTree xml.etree.ElementTree
xml.parsers.expat xml.parsers.expat
xml.parsers.expat.errors
xml.parsers.expat.model
xml.sax xml.sax
xml.sax.handler xml.sax.handler
xml.sax.saxutils xml.sax.saxutils
xml.sax.xmlreader xml.sax.xmlreader
xmlrpc
xmlrpc.client
xmlrpc.server
xmlrpclib xmlrpclib
zipfile yp
zipimport
zlib
__future__
__main__
_dummy_thread
_thread
abc
aifc
argparse
array
ast
asynchat
asyncio
asyncore
atexit
audioop
base64
bdb
binascii
binhex
bisect
builtins
bz2
calendar
cgi
cgitb
chunk
cmath
cmd
code
codecs
codeop
collections
collections.abc
colorsys
compileall
concurrent
concurrent.futures
configparser
contextlib
copy
copyreg
cProfile
crypt
csv
ctypes
curses
curses.ascii
curses.panel
curses.textpad
datetime
dbm
dbm.dumb
dbm.gnu
dbm.ndbm
decimal
difflib
dis
distutils
distutils.archive_util
distutils.bcppcompiler
distutils.ccompiler
distutils.cmd
distutils.command
distutils.command.bdist
distutils.command.bdist_dumb
distutils.command.bdist_msi
distutils.command.bdist_packager
distutils.command.bdist_rpm
distutils.command.bdist_wininst
distutils.command.build
distutils.command.build_clib
distutils.command.build_ext
distutils.command.build_py
distutils.command.build_scripts
distutils.command.check
distutils.command.clean
distutils.command.config
distutils.command.install
distutils.command.install_data
distutils.command.install_headers
distutils.command.install_lib
distutils.command.install_scripts
distutils.command.register
distutils.command.sdist
distutils.core
distutils.cygwinccompiler
distutils.debug
distutils.dep_util
distutils.dir_util
distutils.dist
distutils.errors
distutils.extension
distutils.fancy_getopt
distutils.file_util
distutils.filelist
distutils.log
distutils.msvccompiler
distutils.spawn
distutils.sysconfig
distutils.text_file
distutils.unixccompiler
distutils.util
distutils.version
doctest
dummy_threading
email
email.charset
email.contentmanager
email.encoders
email.errors
email.generator
email.header
email.headerregistry
email.iterators
email.message
email.mime
email.parser
email.policy
email.utils
encodings
encodings.idna
encodings.mbcs
encodings.utf_8_sig
ensurepip
enum
errno
faulthandler
fcntl
filecmp
fileinput
fnmatch
formatter
fpectl
fractions
ftplib
functools
gc
getopt
getpass
gettext
glob
grp
gzip
hashlib
heapq
hmac
html
html.entities
html.parser
http
http.client
http.cookiejar
http.cookies
http.server
imaplib
imghdr
imp
importlib
importlib.abc
importlib.machinery
importlib.util
inspect
io
ipaddress
itertools
json
keyword
lib2to3
linecache
locale
logging
logging.config
logging.handlers
lzma
macpath
mailbox
mailcap
marshal
math
mimetypes
mmap
modulefinder
msilib
msvcrt
multiprocessing
multiprocessing.connection
multiprocessing.dummy
multiprocessing.managers
multiprocessing.pool
multiprocessing.sharedctypes
netrc
nis
nntplib
numbers
operator
optparse
os
os.path
ossaudiodev
parser
pathlib
pdb
pickle
pickletools
pipes
pkgutil
platform
plistlib
poplib
posix
pprint
profile
pstats
pty
pwd
py_compile
pyclbr
pydoc
queue
quopri
random
re
readline
reprlib
resource
rlcompleter
runpy
sched
select
selectors
shelve
shlex
shutil
signal
site
smtpd
smtplib
sndhdr
socket
socketserver
spwd
sqlite3
ssl
stat
statistics
string
stringprep
struct
subprocess
sunau
symbol
symtable
sys
sysconfig
syslog
tabnanny
tarfile
telnetlib
tempfile
termios
test
test.support
textwrap
threading
time
timeit
tkinter
tkinter.scrolledtext
tkinter.tix
tkinter.ttk
token
tokenize
trace
traceback
tracemalloc
tty
turtle
turtledemo
types
unicodedata
unittest
unittest.mock
urllib
urllib.error
urllib.parse
urllib.request
urllib.response
urllib.robotparser
uu
uuid
venv
warnings
wave
weakref
webbrowser
winreg
winsound
wsgiref
wsgiref.handlers
wsgiref.headers
wsgiref.simple_server
wsgiref.util
wsgiref.validate
xdrlib
xml
xml.dom
xml.dom.minidom
xml.dom.pulldom
xml.etree.ElementTree
xml.parsers.expat
xml.parsers.expat.errors
xml.parsers.expat.model
xml.sax
xml.sax.handler
xml.sax.saxutils
xml.sax.xmlreader
xmlrpc
xmlrpc.client
xmlrpc.server
zipfile
zipimport
zlib
__future__
__main__
_dummy_thread
_thread
abc
aifc
argparse
array
ast
asynchat
asyncio
asyncore
atexit
audioop
base64
bdb
binascii
binhex
bisect
builtins
bz2
calendar
cgi
cgitb
chunk
cmath
cmd
code
codecs
codeop
collections
collections.abc
colorsys
compileall
concurrent
concurrent.futures
configparser
contextlib
copy
copyreg
cProfile
crypt
csv
ctypes
curses
curses.ascii
curses.panel
curses.textpad
datetime
dbm
dbm.dumb
dbm.gnu
dbm.ndbm
decimal
difflib
dis
distutils
distutils.archive_util
distutils.bcppcompiler
distutils.ccompiler
distutils.cmd
distutils.command
distutils.command.bdist
distutils.command.bdist_dumb
distutils.command.bdist_msi
distutils.command.bdist_packager
distutils.command.bdist_rpm
distutils.command.bdist_wininst
distutils.command.build
distutils.command.build_clib
distutils.command.build_ext
distutils.command.build_py
distutils.command.build_scripts
distutils.command.check
distutils.command.clean
distutils.command.config
distutils.command.install
distutils.command.install_data
distutils.command.install_headers
distutils.command.install_lib
distutils.command.install_scripts
distutils.command.register
distutils.command.sdist
distutils.core
distutils.cygwinccompiler
distutils.debug
distutils.dep_util
distutils.dir_util
distutils.dist
distutils.errors
distutils.extension
distutils.fancy_getopt
distutils.file_util
distutils.filelist
distutils.log
distutils.msvccompiler
distutils.spawn
distutils.sysconfig
distutils.text_file
distutils.unixccompiler
distutils.util
distutils.version
doctest
dummy_threading
email
email.charset
email.contentmanager
email.encoders
email.errors
email.generator
email.header
email.headerregistry
email.iterators
email.message
email.mime
email.parser
email.policy
email.utils
encodings
encodings.idna
encodings.mbcs
encodings.utf_8_sig
ensurepip
enum
errno
faulthandler
fcntl
filecmp
fileinput
fnmatch
formatter
fpectl
fractions
ftplib
functools
gc
getopt
getpass
gettext
glob
grp
gzip
hashlib
heapq
hmac
html
html.entities
html.parser
http
http.client
http.cookiejar
http.cookies
http.server
imaplib
imghdr
imp
importlib
importlib.abc
importlib.machinery
importlib.util
inspect
io
ipaddress
itertools
json
json.tool
keyword
lib2to3
linecache
locale
logging
logging.config
logging.handlers
lzma
macpath
mailbox
mailcap
marshal
math
mimetypes
mmap
modulefinder
msilib
msvcrt
multiprocessing
multiprocessing.connection
multiprocessing.dummy
multiprocessing.managers
multiprocessing.pool
multiprocessing.sharedctypes
netrc
nis
nntplib
numbers
operator
optparse
os
os.path
ossaudiodev
parser
pathlib
pdb
pickle
pickletools
pipes
pkgutil
platform
plistlib
poplib
posix
pprint
profile
pstats
pty
pwd
py_compile
pyclbr
pydoc
queue
quopri
random
re
readline
reprlib
resource
rlcompleter
runpy
sched
select
selectors
shelve
shlex
shutil
signal
site
smtpd
smtplib
sndhdr
socket
socketserver
spwd
sqlite3
ssl
stat
statistics
string
stringprep
struct
subprocess
sunau
symbol
symtable
sys
sysconfig
syslog
tabnanny
tarfile
telnetlib
tempfile
termios
test
test.support
textwrap
threading
time
timeit
tkinter
tkinter.scrolledtext
tkinter.tix
tkinter.ttk
token
tokenize
trace
traceback
tracemalloc
tty
turtle
turtledemo
types
unicodedata
unittest
unittest.mock
urllib
urllib.error
urllib.parse
urllib.request
urllib.response
urllib.robotparser
uu
uuid
venv
warnings
wave
weakref
webbrowser
winreg
winsound
wsgiref
wsgiref.handlers
wsgiref.headers
wsgiref.simple_server
wsgiref.util
wsgiref.validate
xdrlib
xml
xml.dom
xml.dom.minidom
xml.dom.pulldom
xml.etree.ElementTree
xml.parsers.expat
xml.parsers.expat.errors
xml.parsers.expat.model
xml.sax
xml.sax.handler
xml.sax.saxutils
xml.sax.xmlreader
xmlrpc
xmlrpc.client
xmlrpc.server
zipapp zipapp
zipfile zipfile
zipimport zipimport

View File

@ -99,6 +99,9 @@ class TestPipreqs(unittest.TestCase):
data = f.read().lower() data = f.read().lower()
for item in self.modules[:-3]: for item in self.modules[:-3]:
self.assertTrue(item.lower() in data) self.assertTrue(item.lower() in data)
# It should be sorted based on names.
data = data.strip().split('\n')
self.assertEqual(data, sorted(data))
def test_init_local_only(self): def test_init_local_only(self):
""" """
@ -181,6 +184,24 @@ class TestPipreqs(unittest.TestCase):
for item in ['click', 'getpass']: for item in ['click', 'getpass']:
self.assertFalse(item.lower() in data) self.assertFalse(item.lower() in data)
def test_omit_version(self):
"""
Test --no-pin parameter
"""
pipreqs.init(
{'<path>': self.project_with_ignore_directory, '--savepath': None, '--print': False,
'--use-local': None, '--force': True,
'--proxy': None,
'--pypi-server': None,
'--diff': None,
'--clean': None,
'--no-pin': True
}
)
with open(os.path.join(self.project_with_ignore_directory, "requirements.txt"), "r") as f:
data = f.read().lower()
for item in ['beautifulsoup4==4.8.1', 'boto==2.49.0']:
self.assertFalse(item.lower() in data)
def tearDown(self): def tearDown(self):
""" """