mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-11-04 09:57:26 +03:00 
			
		
		
		
	Modernize and simplify CI steps (#11738)
* 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)
			
			
This commit is contained in:
		
							parent
							
								
									e965f9d40a
								
							
						
					
					
						commit
						d4883e79c1
					
				
							
								
								
									
										87
									
								
								.github/azure-steps.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										87
									
								
								.github/azure-steps.yml
									
									
									
									
										vendored
									
									
								
							| 
						 | 
					@ -1,9 +1,6 @@
 | 
				
			||||||
parameters:
 | 
					parameters:
 | 
				
			||||||
  python_version: ''
 | 
					  python_version: ''
 | 
				
			||||||
  architecture: ''
 | 
					  architecture: 'x64'
 | 
				
			||||||
  prefix: ''
 | 
					 | 
				
			||||||
  gpu: false
 | 
					 | 
				
			||||||
  num_build_jobs: 1
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
steps:
 | 
					steps:
 | 
				
			||||||
  - task: UsePythonVersion@0
 | 
					  - task: UsePythonVersion@0
 | 
				
			||||||
| 
						 | 
					@ -16,52 +13,76 @@ steps:
 | 
				
			||||||
    displayName: 'Set variables'
 | 
					    displayName: 'Set variables'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  - script: |
 | 
					  - script: |
 | 
				
			||||||
      ${{ parameters.prefix }} python -m pip install -U pip setuptools
 | 
					      python -m pip install -U build pip setuptools
 | 
				
			||||||
      ${{ parameters.prefix }} python -m pip install -U -r requirements.txt
 | 
					      python -m pip install -U -r requirements.txt
 | 
				
			||||||
    displayName: "Install dependencies"
 | 
					    displayName: "Install dependencies"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  - script: |
 | 
					  - script: |
 | 
				
			||||||
      ${{ parameters.prefix }} python setup.py build_ext --inplace -j ${{ parameters.num_build_jobs }}
 | 
					      python -m build --sdist
 | 
				
			||||||
      ${{ parameters.prefix }} python setup.py sdist --formats=gztar
 | 
					    displayName: "Build sdist"
 | 
				
			||||||
    displayName: "Compile and build sdist"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  - task: DeleteFiles@1
 | 
					  - task: DeleteFiles@1
 | 
				
			||||||
    inputs:
 | 
					    inputs:
 | 
				
			||||||
      contents: "spacy"
 | 
					      contents: "spacy"
 | 
				
			||||||
    displayName: "Delete source directory"
 | 
					    displayName: "Delete source directory"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  - task: DeleteFiles@1
 | 
				
			||||||
 | 
					    inputs:
 | 
				
			||||||
 | 
					      contents: "*.egg-info"
 | 
				
			||||||
 | 
					    displayName: "Delete egg-info directory"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  - script: |
 | 
					  - script: |
 | 
				
			||||||
      ${{ parameters.prefix }} python -m pip freeze --exclude torch --exclude cupy-cuda110 > installed.txt
 | 
					      python -m pip freeze > installed.txt
 | 
				
			||||||
      ${{ parameters.prefix }} python -m pip uninstall -y -r installed.txt
 | 
					      python -m pip uninstall -y -r installed.txt
 | 
				
			||||||
    displayName: "Uninstall all packages"
 | 
					    displayName: "Uninstall all packages"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  - bash: |
 | 
					  - bash: |
 | 
				
			||||||
      ${{ parameters.prefix }} SDIST=$(python -c "import os;print(os.listdir('./dist')[-1])" 2>&1)
 | 
					      SDIST=$(python -c "import os;print(os.listdir('./dist')[-1])" 2>&1)
 | 
				
			||||||
      ${{ parameters.prefix }} python -m pip install dist/$SDIST
 | 
					      python -m pip install dist/$SDIST
 | 
				
			||||||
    displayName: "Install from sdist"
 | 
					    displayName: "Install from sdist"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  - script: |
 | 
					  - script: |
 | 
				
			||||||
      ${{ parameters.prefix }} python -m pip install -U -r requirements.txt
 | 
					      python -W error -c "import spacy"
 | 
				
			||||||
 | 
					    displayName: "Test import"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  - script: |
 | 
				
			||||||
 | 
					      python -m spacy download es_core_news_sm
 | 
				
			||||||
 | 
					      python -c "import spacy; nlp=spacy.load('es_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 es 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': 'es_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 -m pip install -U -r requirements.txt
 | 
				
			||||||
    displayName: "Install test requirements"
 | 
					    displayName: "Install test requirements"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  - script: |
 | 
					  - script: |
 | 
				
			||||||
      ${{ parameters.prefix }} python -m pip install -U cupy-cuda110 -f https://github.com/cupy/cupy/releases/v9.0.0
 | 
					      python -m pytest --pyargs spacy -W error
 | 
				
			||||||
      ${{ parameters.prefix }} python -m pip install "torch==1.7.1+cu110" -f https://download.pytorch.org/whl/torch_stable.html
 | 
					 | 
				
			||||||
    displayName: "Install GPU requirements"
 | 
					 | 
				
			||||||
    condition: eq(${{ parameters.gpu }}, true)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  - script: |
 | 
					 | 
				
			||||||
      ${{ parameters.prefix }} python -m pytest --pyargs spacy
 | 
					 | 
				
			||||||
    displayName: "Run CPU tests"
 | 
					    displayName: "Run CPU tests"
 | 
				
			||||||
    condition: eq(${{ parameters.gpu }}, false)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  - script: |
 | 
					 | 
				
			||||||
      ${{ parameters.prefix }} python -m pytest --pyargs spacy -p spacy.tests.enable_gpu
 | 
					 | 
				
			||||||
    displayName: "Run GPU tests"
 | 
					 | 
				
			||||||
    condition: eq(${{ parameters.gpu }}, true)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  - script: |
 | 
					 | 
				
			||||||
      python -m spacy download en_core_web_sm
 | 
					 | 
				
			||||||
      python -c "import spacy; nlp=spacy.load('en_core_web_sm'); doc=nlp('test')"
 | 
					 | 
				
			||||||
    displayName: 'Test download CLI'
 | 
					 | 
				
			||||||
    condition: eq(variables['python_version'], '3.8')
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -89,20 +89,3 @@ jobs:
 | 
				
			||||||
      - template: .github/azure-steps.yml
 | 
					      - template: .github/azure-steps.yml
 | 
				
			||||||
        parameters:
 | 
					        parameters:
 | 
				
			||||||
          python_version: '$(python.version)'
 | 
					          python_version: '$(python.version)'
 | 
				
			||||||
          architecture: 'x64'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#  - job: "TestGPU"
 | 
					 | 
				
			||||||
#    dependsOn: "Validate"
 | 
					 | 
				
			||||||
#    strategy:
 | 
					 | 
				
			||||||
#      matrix:
 | 
					 | 
				
			||||||
#        Python38LinuxX64_GPU:
 | 
					 | 
				
			||||||
#          python.version: '3.8'
 | 
					 | 
				
			||||||
#    pool:
 | 
					 | 
				
			||||||
#      name: "LinuxX64_GPU"
 | 
					 | 
				
			||||||
#    steps:
 | 
					 | 
				
			||||||
#      - template: .github/azure-steps.yml
 | 
					 | 
				
			||||||
#        parameters:
 | 
					 | 
				
			||||||
#          python_version: '$(python.version)'
 | 
					 | 
				
			||||||
#          architecture: 'x64'
 | 
					 | 
				
			||||||
#          gpu: true
 | 
					 | 
				
			||||||
#          num_build_jobs: 24
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user