Compare commits

...

3 Commits

Author SHA1 Message Date
Ines Montani 6ba07bfe8a Merge pull request #2110 from mdcclv/backport_pip_independence (closes #2112)
[v1.x] Backport 2.x's avoidance of 'import pip'
2018-03-23 14:59:10 +01:00
Orion Montoya c510be9c0e Backport 2.x's avoidance of 'import pip' 2018-03-17 23:39:15 -07:00
ines 91594fe671 Update legacy docs 2017-11-07 12:56:36 +01:00
11 changed files with 34 additions and 23 deletions
-1
View File
@@ -14,4 +14,3 @@ requests>=2.11.0,<3.0.0
regex>=2017.4.1,<2017.12.1
ftfy>=4.4.2,<5.0.0
pytest>=3.0.6,<4.0.0
pip>=9.0.0,<10.0.0
+9 -5
View File
@@ -1,7 +1,7 @@
# coding: utf8
from __future__ import unicode_literals
import pip
import pkg_resources
from pathlib import Path
import importlib
from ..compat import unicode_, symlink_to
@@ -69,10 +69,14 @@ def get_meta(package_path, package):
meta = util.parse_package_meta(package_path, package)
return meta
def is_package(origin):
packages = pip.get_installed_distributions()
def is_package(name):
"""Check if string maps to a package installed via pip.
name (unicode): Name of package.
RETURNS (bool): True if installed package, False if not.
"""
name = name.lower() # compare package name against lowercase name
packages = pkg_resources.working_set.by_key.keys()
for package in packages:
if package.project_name.replace('-', '_') == origin:
if package.lower().replace('-', '_') == name:
return True
return False
+7
View File
@@ -2,6 +2,7 @@
from __future__ import unicode_literals
from ..cli.download import download, get_compatibility, get_version, check_error_depr
from ..cli.link import is_package
import pytest
@@ -24,3 +25,9 @@ def test_cli_download_get_matching_version_fails(model):
def test_cli_download_no_model_depr_error(model):
with pytest.raises(SystemExit):
check_error_depr(model)
@pytest.mark.parametrize('package', ['numpy'])
def test_cli_link_is_package(package):
"""Test that an installed package via pip is recognised by link.is_package."""
assert is_package(package)
-4
View File
@@ -25,10 +25,6 @@
]
},
"robots.txt": {
"layout": false
},
"404": {
"title": "404 Error",
"landing": true
+3 -3
View File
@@ -12,10 +12,10 @@
"COMPANY_URL": "https://explosion.ai",
"DEMOS_URL": "https://demos.explosion.ai",
"SPACY_VERSION": "1.9",
"SPACY_VERSION": "2.0",
"LATEST_NEWS": {
"url": "/docs/usage/models",
"title": "The first official Spanish model is here!"
"url": "https://alpha.spacy.io",
"title": "Try spaCy v2.0!"
},
"SOCIAL": {
+1
View File
@@ -19,5 +19,6 @@
//- Generate GitHub links
- function gh(repo, filepath, branch) {
- if (repo == "spacy") branch = 'v1.x';
- return 'https://github.com/' + SOCIAL.github + '/' + repo + (filepath ? '/blob/' + (branch || 'master') + '/' + filepath : '' );
- }
+1 -2
View File
@@ -5,8 +5,7 @@ include _mixins
nav.c-nav.u-text.js-nav(class=landing ? "c-nav--theme" : null)
a(href='/') #[+logo]
if SUBSECTION != "index"
.u-text-label.u-padding-small.u-hidden-xs=SUBSECTION
.u-text-label.u-padding-small.u-hidden-xs Legacy
ul.c-nav__menu
each url, item in NAVIGATION
+11 -1
View File
@@ -10,6 +10,16 @@ main.o-main.o-main--sidebar.o-main--aside
if tag
+tag=tag
+infobox("⚠️ Important note")
| You are viewing the #[strong v1.x legacy documentation].
| #[+a("https://spacy.io", true) Go here] for the latest
| documentation of the new version. spaCy v2.0 comes with a lot
| of improvements around training, serialization and processing
| pipeline management, as well as new convolutional neural network
| models for several languages. See
| #[+a("https://spacy.io/usage/v2") this page] for more details and
| a migration guide.
!=yield
+grid.o-content.u-text
@@ -21,7 +31,7 @@ main.o-main.o-main--sidebar.o-main--aside
span #[strong.u-text-label Read next:] #[+a(next).u-link=data.title]
+grid-col("half").u-text-right
.o-inline-list
//-.o-inline-list
+button(gh("spacy", "website/" + current.path.join('/') + ".jade"), false, "secondary").u-text-tag Suggest edits #[+icon("code", 14)]
+gitter("spaCy chat")
-2
View File
@@ -11,8 +11,6 @@ include _includes/_mixins
h2.c-landing__title.o-block.u-heading-1
| in Python
+landing-badge(gh("spaCy") + "/releases/tag/v2.0.0-alpha", "v2alpha", "Try spaCy v2.0.0 alpha!")
+grid.o-content
+grid-col("third").o-card
+h(2) Fastest in the world
+2
View File
@@ -0,0 +1,2 @@
User-agent: *
Disallow: /
-5
View File
@@ -1,5 +0,0 @@
//- 💫 ROBOTS.TXT
if environment != "deploy"
| User-agent: *
| Disallow: /