mirror of
https://github.com/explosion/spaCy.git
synced 2025-03-13 07:55:49 +03:00
* Use `build` instead of `python setup.py sdist` * Remove in-place build with `setup.py` * Remove `gpu` parameter and GPU tests * Keep `architecture` and `num_build_jobs` in azure steps with CI defaults * Fix use of `num_build_jobs` parameters * Remove now-unused `prefix` parameter * Test imports and CLI before installing test requirements * Remove `*.egg-info` directory in addition to source directory for an warning-free `import spacy` * Switch `thinc-apple-ops` test to python 3.11 (as most recent python that is tested across platforms)
112 lines
4.1 KiB
YAML
112 lines
4.1 KiB
YAML
parameters:
|
|
python_version: ''
|
|
architecture: 'x64'
|
|
|
|
steps:
|
|
- task: UsePythonVersion@0
|
|
inputs:
|
|
versionSpec: ${{ parameters.python_version }}
|
|
architecture: ${{ parameters.architecture }}
|
|
|
|
- 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.10')
|
|
|
|
- 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)
|
|
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 -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 --pre thinc-apple-ops
|
|
python -m pytest --pyargs spacy
|
|
displayName: "Run CPU tests with thinc-apple-ops"
|
|
condition: and(startsWith(variables['imageName'], 'macos'), eq(variables['python.version'], '3.10'))
|
|
|
|
- script: |
|
|
python .github/validate_universe_json.py website/meta/universe.json
|
|
displayName: 'Test website/meta/universe.json'
|
|
condition: eq(variables['python_version'], '3.8')
|