Continuous Integration, and Continuous Deployment for Python¶
Scrutinizer works well for Python code. We automatically infer a default build configuration for you, you can tweak this
default configuration via a
.scrutinizer.yml file that you place in your project's root folder.
virtualenv to create an isolated Python environment. We either use Python
3.5 whatever seems better.
We have many Python versions pre-installed. You can set a specific version in your configuration:
build: environment: python: stackless-3.3.5
If you need a different Python version, let us know.
Scrutinizer automatically installs your dependencies using
distutils. You can also add
custom commands to your configuration:
build: nodes: my-tests: dependencies: before: - pip install abc
We provide several databases and queues including MySQL, PostgreSQL, and RabbitMQ pre-installed, if you like you can also install custom software in your build environment.
Scrutinizer will automatically try to infer your test commands. We support running tests via
manage.py in case you are using Django.
You can override the default test commands in your configuration file:
build: nodes: my-tests: tests: override: - ./run-tests.sh
By default, we will automatically generate code coverage for your tests. If you change the test commands, you can also generate code-coverage manually. Your configuration could look like this:
build: nodes: my-tests-with-coverage: tests: override: - command: './run-tests.sh' coverage: file: '.coverage' config_file: '.coveragerc' format: 'py-cc'
Scrutinizer will automatically process your coverage data and also merge it in case you run your tests in parallel, and also provide graphs that plot its evolution over time. See our code coverage overview page for other languages.
Scrutinizer provides first-class support for deployment. Once all your tests have passed, it will automatically trigger deployment of your code. You can define deploy commands in your configuration file:
build: nodes: deploy: requires: - branch: master # you can use either the full branch name, - branch: /feature_.*/ # or a regular rexpression - node: my-tests # only run if my-tests node has succeeded commands: - cd deploy && fab deploy
Scrutinizer supports a wide-range of automated checks for Python code including code rating, code metrics, duplicate code detection, and many more. A basic configuration which enables code rating and duplicate code detection looks like this:
checks: python: code_rating: true duplicate_code: true build: nodes: analysis: tests: override: - py-scrutinizer-run
Learn more about configuring automated code reviews for Python.