Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion winpython/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
OTHER DEALINGS IN THE SOFTWARE.
"""

__version__ = '2.3.20200408'
__version__ = '2.3.20200410'
__license__ = __doc__
__project_url__ = 'http://winpython.github.io/'
51 changes: 48 additions & 3 deletions winpython/data/packages.ini
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ description = Fiona reads and writes spatial data files
description = the modular source code checker: pep8, pyflakes and co

[flask]
description = A microframework based on Werkzeug, Jinja2 and good intentions
description = A simple framework for building complex web applications.

[flaskerize]
description = Python CLI build/dev tool for templated code generation and project modification. Think Angular schematics for Python.
Expand Down Expand Up @@ -842,7 +842,7 @@ description = Differentiate, compile, and transform Numpy code.
description = An autocompletion tool for Python that can be used for text editors.

[jinja2]
description = A very fast and expressive template engine.
description = A small but fast and easy to use stand-alone template engine written in pure python.

[jmespath]
description = JSON Matching Expressions
Expand Down Expand Up @@ -2155,7 +2155,7 @@ description = Plugin for the Spyder IDE that integrates the Python memory profil
description = A plugin to run the autopep8 python linter from within the spyder editor

[sqlalchemy]
description = SQL Toolkit and Object Relational Mapper
description = Database Abstraction Library

[sqlite-bro]
description = a graphic SQLite Client in 1 Python file
Expand Down Expand Up @@ -2509,3 +2509,48 @@ description = What-If Tool TensorBoard plugin.
[tbb]
description = Intel(R) Threading Building Blocks

[geemap]
description = A Python package for interactive mapping using Google Earth Engine and ipyleaflet

[earthengine-api]
description = Earth Engine Python API

[ipynb-py-convert]
description = Convert .py files runnable in VSCode/Python or Atom/Hydrogen to jupyter .ipynb notebooks and vice versa

[google-cloud-storage]
description = Google Cloud Storage API client library

[google-auth-httplib2]
description = Google Authentication Library: httplib2 transport

[httplib2shim]
description = A wrapper over urllib3 that matches httplib2's interface

[google-cloud-core]
description = Google Cloud API client core library

[google-resumable-media]
description = Utilities for Google Media Downloads and Resumable Uploads

[google-api-core]
description = Google API client core library

[googleapis-common-protos]
description = Common protobufs used in Google APIs

[pipenv]
description = Python Development Workflow for Humans.

[virtualenv-clone]
description = script to clone virtualenvs.

[virtualenv]
description = Virtual Python Environment builder

[distlib]
description = Distribution utilities

[flask-sqlalchemy]
description = Adds SQLAlchemy support to your Flask application.

56 changes: 28 additions & 28 deletions winpython/wppm.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,26 @@

# pep503 defines normalized package names: www.python.org/dev/peps/pep-0503
def normalize(name):
""" return normalized (unique) name of a package"""
return re.sub(r"[-_.]+", "-", name).lower()

def get_official_description(name):
from winpython import utils
dir_path = os.path.dirname(sys.executable)
this = normalize(name)
this_len = len(this)
pip_ask = ['pip', 'search', this, '--retries', '0']
if len(this)<2: # don't ask stupid things
return ''
try:
# .run work when .popen fails when no internet
pip_res = (utils.exec_run_cmd(pip_ask)+'\n').splitlines()
pip_filter = [l for l in pip_res if this + " (" ==
normalize(l[:this_len])+l[this_len:this_len+2]]
pip_desc = (pip_filter[0][len(this)+1:]).split(" - ", 1)[1]
return pip_desc.replace("://", " ")
except:
return ''
"""Extract package Summary description from pypi.org"""
from winpython import utils
this = normalize(name)
this_len = len(this)
pip_ask = ['pip', 'search', this, '--retries', '0']
if len(this)<2: # don't ask stupid things
return ''
try:
# .run work when .popen fails when no internet
pip_res = (utils.exec_run_cmd(pip_ask)+'\n').splitlines()
pip_filter = [l for l in pip_res if this + " (" ==
normalize(l[:this_len])+l[this_len:this_len+2]]
pip_desc = (pip_filter[0][len(this)+1:]).split(" - ", 1)[1]
return pip_desc.replace("://", " ")
except:
return ''

def get_package_metadata(database, name, gotoWWW=False, update=False):
"""Extract infos (description, url) from the local database"""
Expand All @@ -76,34 +77,33 @@ def get_package_metadata(database, name, gotoWWW=False, update=False):
url='https://pypi.org/project/' + name,
)
for key in my_metadata:
name1 = name.lower()
# wheel replace '-' per '_' in key
for name2 in (
name1,
name1.split('-')[0],
name1.replace('-', '_'),
'-'.join(name1.split('_')),
normalize(name),
):
for name2 in (name, normalize(name)):
try:
my_metadata[key] = db.get(name2, key)
break
except (cp.NoSectionError, cp.NoOptionError):
pass
database_desc = my_metadata.get('description')
if my_metadata.get('description') == '' and metadata: # nothing in package.ini
db_desc = my_metadata.get('description')

if my_metadata.get('description') == '' and metadata:
# nothing in package.ini, we look in our installed packages
try:
my_metadata['description']=(
metadata(name)['Summary']+'\n').splitlines()[0]
except:
pass

if my_metadata['description'] == '' and gotoWWW:
# still nothing, try look on pypi
the_official = get_official_description(name)
if the_official != '':
my_metadata['description'] = the_official
if update == True and database_desc == '' and my_metadata['description'] !='':

if update == True and db_desc == '' and my_metadata['description'] != '':
# we add new findings in our packgages.ini list, if it's required
try:
db[normalize(name)]={}
db[normalize(name)] = {}
db[normalize(name)]['description'] = my_metadata['description']
with open(osp.join(DATA_PATH, database), 'w') as configfile:
db.write(configfile)
Expand Down