Skip to content

Commit

Permalink
Revert all commits since last release
Browse files Browse the repository at this point in the history
By reverting all commits done since release v0.4.10 we will have the
master branch synchronized with the latest release available in pipy.

All commits done since the latest release will be moved to another
branch called `next` where we will centralize development. Once we are ready
for a new release of pipreqs, the `next` branch will be merged back on to
master and a new release will be made.

This change will make development more organized and will avoid new
issues from users complaining about features only present in master not working
on their installation of pipreqs.

I would also like to thank @pedroteosousa for his help on reverting and
squashing all commits
  • Loading branch information
alan-barzilay committed May 5, 2021
1 parent 2a299cc commit 90102ac
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 300 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ matrix:
env: TOX_ENV=py34
- python: 2.7
env: TOX_ENV=py27
- python: pypy3
env: TOX_ENV=pypy3
- python: pypy
env: TOX_ENV=pypy
- python: 3.6
env: TOX_ENV=flake8

# Use tox to run tests on Travis-CI to keep one unified method of running tests in any environment
install:
install:
- pip install coverage coveralls tox

# Command to run tests, e.g. python setup.py test
Expand Down
3 changes: 1 addition & 2 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ Development Lead
Contributors
------------

* Jake Teo <mapattacker@gmail.com>
* Jerome Chan <cjerome94@gmail.com>
None yet. Why not be the first?
5 changes: 0 additions & 5 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
History
-------

0.4.11 (2020-03-29)
--------------------

* Implement '--mode' (Jake Teo, Jerome Chan)

0.4.8 (2017-06-30)
--------------------

Expand Down
9 changes: 3 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@ Usage
--force Overwrite existing requirements.txt
--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.
--mode <scheme> Enables dynamic versioning with <compat>, <gt> or <non-pin> schemes.
<compat> | e.g. Flask~=1.1.2
<gt> | e.g. Flask>=1.1.2
<no-pin> | e.g. Flask
--no-pin Omit version of output packages.
Example
-------

Expand All @@ -73,5 +70,5 @@ Why not pip freeze?
-------------------

- ``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``).
- and sometimes you just need to create ``requirements.txt`` for a new project without installing modules.
- ``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.
10 changes: 2 additions & 8 deletions pipreqs/mapping
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
AFQ:pyAFQ
AG_fft_tools:agpy
ANSI:pexpect
Adafruit:Adafruit_Libraries
Expand All @@ -14,7 +13,6 @@ Crypto:pycryptodome
Cryptodome:pycryptodomex
FSM:pexpect
FiftyOneDegrees:51degrees_mobile_detector_v3_wrapper
functional:pyfunctional
GeoBaseMain:GeoBasesDev
GeoBases:GeoBasesDev
Globals:Zope2
Expand All @@ -24,7 +22,6 @@ Kittens:astro_kittens
Levenshtein:python_Levenshtein
Lifetime:Zope2
MethodObject:ExtensionClass
MySQLdb:MySQL-python
OFS:Zope2
OpenGL:PyOpenGL
OpenSSL:pyOpenSSL
Expand Down Expand Up @@ -595,7 +592,6 @@ devtools:tg.devtools
dgis:2gis
dhtmlparser:pyDHTMLParser
digitalocean:python_digitalocean
discord:discord.py
distribute_setup:ez_setup
distutils2:Distutils2
django:Django
Expand Down Expand Up @@ -679,7 +675,6 @@ geventwebsocket:gevent_websocket
gflags:python_gflags
git:GitPython
github:PyGithub
github3:github3.py
gitpy:git_py
globusonline:globusonline_transfer_api_client
google:protobuf
Expand All @@ -706,7 +701,7 @@ html:pies2overrides
htmloutput:nosehtmloutput
http:pies2overrides
hvad:django_hvad
hydra:hydra-core
krbV:krbv
i99fix:199Fix
igraph:python_igraph
imdb:IMDbPY
Expand All @@ -732,7 +727,6 @@ keyczar:python_keyczar
keyedcache:django_keyedcache
keystoneclient:python_keystoneclient
kickstarter:kickstart
krbv:krbV
kss:kss.core
kuyruk:Kuyruk
langconv:AdvancedLangConv
Expand Down Expand Up @@ -804,6 +798,7 @@ msgpack:msgpack_python
mutations:aino_mutations
mws:amazon_mws
mysql:mysql_connector_repackaged
MySQL-python:MySQLdb
native_tags:django_native_tags
ndg:ndg_httpsclient
nereid:trytond_nereid
Expand Down Expand Up @@ -1004,7 +999,6 @@ ruamel:ruamel.base
s2repoze:pysaml2
saga:saga_python
saml2:pysaml2
samtranslator:aws-sam-translator
sass:libsass
sassc:libsass
sasstests:libsass
Expand Down
54 changes: 12 additions & 42 deletions pipreqs/pipreqs.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,7 @@
imports.
--clean <file> Clean up requirements.txt by removing modules
that are not imported in project.
--mode <scheme> Enables dynamic versioning with <compat>,
<gt> or <non-pin> schemes.
<compat> | e.g. Flask~=1.1.2
<gt> | e.g. Flask>=1.1.2
<no-pin> | e.g. Flask
--no-pin Omit version of output packages.
"""
from __future__ import print_function, absolute_import
from contextlib import contextmanager
Expand Down Expand Up @@ -161,25 +157,25 @@ def get_all_imports(
return list(packages - data)


def filter_line(line):
return len(line) > 0 and line[0] != "#"
def filter_line(l):
return len(l) > 0 and l[0] != "#"


def generate_requirements_file(path, imports, symbol):
def generate_requirements_file(path, imports):
with _open(path, "w") as out_file:
logging.debug('Writing {num} requirements: {imports} to {file}'.format(
num=len(imports),
file=path,
imports=", ".join([x['name'] for x in imports])
))
fmt = '{name}' + symbol + '{version}'
fmt = '{name}=={version}'
out_file.write('\n'.join(
fmt.format(**item) if item['version'] else '{name}'.format(**item)
for item in imports) + '\n')


def output_requirements(imports, symbol):
generate_requirements_file('-', imports, symbol)
def output_requirements(imports):
generate_requirements_file('-', imports)


def get_imports_info(
Expand Down Expand Up @@ -372,11 +368,6 @@ def diff(file_, imports):
def clean(file_, imports):
"""Remove modules that aren't imported in project from file."""
modules_not_imported = compare_modules(file_, imports)

if len(modules_not_imported) == 0:
logging.info("Nothing to clean in " + file_)
return

re_remove = re.compile("|".join(modules_not_imported))
to_write = []

Expand All @@ -401,18 +392,6 @@ def clean(file_, imports):
logging.info("Successfully cleaned up requirements in " + file_)


def dynamic_versioning(scheme, imports):
"""Enables dynamic versioning with <compat>, <gt> or <non-pin> schemes."""
if scheme == "no-pin":
imports = [{"name": item["name"], "version": ""} for item in imports]
symbol = ""
elif scheme == "gt":
symbol = ">="
elif scheme == "compat":
symbol = "~="
return imports, symbol


def init(args):
encoding = args.get('--encoding')
extra_ignore_dirs = args.get('--ignore')
Expand Down Expand Up @@ -451,8 +430,6 @@ def init(args):
imports = local + get_imports_info(difference,
proxy=proxy,
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
os.path.join(input_path, "requirements.txt"))
Expand All @@ -469,25 +446,18 @@ def init(args):
and not args["--savepath"]
and not args["--force"]
and os.path.exists(path)):
logging.warning("requirements.txt already exists, "
logging.warning("Requirements.txt already exists, "
"use --force to overwrite it")
return

if args["--mode"]:
scheme = args.get("--mode")
if scheme in ["compat", "gt", "no-pin"]:
imports, symbol = dynamic_versioning(scheme, imports)
else:
raise ValueError("Invalid argument for mode flag, "
"use 'compat', 'gt' or 'no-pin' instead")
else:
symbol = "=="
if args.get('--no-pin'):
imports = [{'name': item["name"], 'version': ''} for item in imports]

if args["--print"]:
output_requirements(imports, symbol)
output_requirements(imports)
logging.info("Successfully output requirements")
else:
generate_requirements_file(path, imports, symbol)
generate_requirements_file(path, imports)
logging.info("Successfully saved requirements file in " + path)


Expand Down
2 changes: 0 additions & 2 deletions pipreqs/stdlib
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ curses
curses.ascii
curses.panel
curses.textpad
dataclasses
datetime
dbhash
dbm
Expand Down Expand Up @@ -371,7 +370,6 @@ robotparser
runpy
sched
ScrolledText
secrets
select
selectors
sets
Expand Down
4 changes: 0 additions & 4 deletions tests/_data/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@
# Nose
from nose.importer import Importer, add_path, remove_path # loader.py

# see issue #88
import analytics
import flask_seasurf

import atexit
from __future__ import print_function
from docopt import docopt
Expand Down
65 changes: 0 additions & 65 deletions tests/_data_clean/test.py

This file was deleted.

Loading

0 comments on commit 90102ac

Please sign in to comment.