mirror of https://github.com/explosion/spaCy.git
120 lines
4.4 KiB
YAML
120 lines
4.4 KiB
YAML
parameters:
|
|
python_version: ''
|
|
architecture: 'x64'
|
|
num_build_jobs: 2
|
|
|
|
steps:
|
|
- task: UsePythonVersion@0
|
|
inputs:
|
|
versionSpec: ${{ parameters.python_version }}
|
|
architecture: ${{ parameters.architecture }}
|
|
allowUnstable: true
|
|
|
|
- bash: |
|
|
echo "##vso[task.setvariable variable=python_version]${{ parameters.python_version }}"
|
|
displayName: 'Set variables'
|
|
|
|
- script: |
|
|
python -m pip install -U build pip setuptools
|
|
python -m pip install -U -r requirements.txt
|
|
displayName: "Install dependencies"
|
|
|
|
- script: |
|
|
python -m build --sdist
|
|
displayName: "Build sdist"
|
|
|
|
- script: |
|
|
python -m mypy spacy
|
|
displayName: 'Run mypy'
|
|
condition: ne(variables['python_version'], '3.6')
|
|
|
|
- task: DeleteFiles@1
|
|
inputs:
|
|
contents: "spacy"
|
|
displayName: "Delete source directory"
|
|
|
|
- task: DeleteFiles@1
|
|
inputs:
|
|
contents: "*.egg-info"
|
|
displayName: "Delete egg-info directory"
|
|
|
|
- script: |
|
|
python -m pip freeze > installed.txt
|
|
python -m pip uninstall -y -r installed.txt
|
|
displayName: "Uninstall all packages"
|
|
|
|
- bash: |
|
|
SDIST=$(python -c "import os;print(os.listdir('./dist')[-1])" 2>&1)
|
|
SPACY_NUM_BUILD_JOBS=${{ parameters.num_build_jobs }} python -m pip install dist/$SDIST
|
|
displayName: "Install from sdist"
|
|
|
|
- script: |
|
|
python -W error -c "import spacy"
|
|
displayName: "Test import"
|
|
|
|
- script: |
|
|
python -m spacy download ca_core_news_sm
|
|
python -m spacy download ca_core_news_md
|
|
python -c "import spacy; nlp=spacy.load('ca_core_news_sm'); doc=nlp('test')"
|
|
displayName: 'Test download CLI'
|
|
condition: eq(variables['python_version'], '3.8')
|
|
|
|
- script: |
|
|
python -W error -c "import ca_core_news_sm; nlp = ca_core_news_sm.load(); doc=nlp('test')"
|
|
displayName: 'Test no warnings on load (#11713)'
|
|
condition: eq(variables['python_version'], '3.8')
|
|
|
|
- script: |
|
|
python -m spacy convert extra/example_data/ner_example_data/ner-token-per-line-conll2003.json .
|
|
displayName: 'Test convert CLI'
|
|
condition: eq(variables['python_version'], '3.8')
|
|
|
|
- script: |
|
|
python -m spacy init config -p ner -l ca ner.cfg
|
|
python -m spacy debug config ner.cfg --paths.train ner-token-per-line-conll2003.spacy --paths.dev ner-token-per-line-conll2003.spacy
|
|
displayName: 'Test debug config CLI'
|
|
condition: eq(variables['python_version'], '3.8')
|
|
|
|
- script: |
|
|
# will have errors due to sparse data, check for summary in output
|
|
python -m spacy debug data ner.cfg --paths.train ner-token-per-line-conll2003.spacy --paths.dev ner-token-per-line-conll2003.spacy | grep -q Summary
|
|
displayName: 'Test debug data CLI'
|
|
condition: eq(variables['python_version'], '3.8')
|
|
|
|
- script: |
|
|
python -m spacy train ner.cfg --paths.train ner-token-per-line-conll2003.spacy --paths.dev ner-token-per-line-conll2003.spacy --training.max_steps 10 --gpu-id -1
|
|
displayName: 'Test train CLI'
|
|
condition: eq(variables['python_version'], '3.8')
|
|
|
|
- script: |
|
|
python -c "import spacy; config = spacy.util.load_config('ner.cfg'); config['components']['ner'] = {'source': 'ca_core_news_sm'}; config.to_disk('ner_source_sm.cfg')"
|
|
PYTHONWARNINGS="error,ignore::DeprecationWarning" python -m spacy assemble ner_source_sm.cfg output_dir
|
|
displayName: 'Test assemble CLI'
|
|
condition: eq(variables['python_version'], '3.8')
|
|
|
|
- script: |
|
|
python -c "import spacy; config = spacy.util.load_config('ner.cfg'); config['components']['ner'] = {'source': 'ca_core_news_md'}; config.to_disk('ner_source_md.cfg')"
|
|
python -m spacy assemble ner_source_md.cfg output_dir 2>&1 | grep -q W113
|
|
displayName: 'Test assemble CLI vectors warning'
|
|
condition: eq(variables['python_version'], '3.8')
|
|
|
|
- script: |
|
|
python -m pip install -U -r requirements.txt
|
|
displayName: "Install test requirements"
|
|
|
|
- script: |
|
|
python -m pytest --pyargs spacy -W error
|
|
displayName: "Run CPU tests"
|
|
|
|
- script: |
|
|
python -m pip install 'spacy[apple]'
|
|
python -m pytest --pyargs spacy
|
|
displayName: "Run CPU tests with thinc-apple-ops"
|
|
condition: and(startsWith(variables['imageName'], 'macos'), eq(variables['python.version'], '3.11'))
|
|
|
|
- script: |
|
|
python .github/validate_universe_json.py website/meta/universe.json
|
|
displayName: 'Test website/meta/universe.json'
|
|
condition: eq(variables['python_version'], '3.8')
|
|
|