diff --git a/README.md b/README.md index c3ade1f72..3f1d2a292 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Installation The easiest way to install conda-smithy is to use conda and conda-forge: -``` +```sh conda install -n root -c conda-forge conda-smithy ``` @@ -108,15 +108,70 @@ Running a build When everything is configured you can trigger a build with a push to the feedstock repo on github. -Developing conda-smithy +Developing `conda-smithy` ----------------------- -To develop conda smithy, use your favortite conda-based environment manager and create an environment based on the `environment.yml`. +If you don’t already have a conda-based environment manager, install one. For example [Miniforge](https://github.com/conda-forge/miniforge). + +To develop `conda-smithy`, use said environment manager and create an environment based on the included `environment.yml` file. + +```sh +$ conda env create -f environment.yml +``` + +Then activate the environment, check that it works and install the dependencies: + +```sh +$ conda activate conda-smithy +$ which python +# ☝️ should now point to an environment-specific python +$ python -m pip install -e . --no-deps +``` + +You might want to switch Python versions, for example if you wish to exactly replicate a CI issue locally. To do that: + +```sh +conda install -n conda-smithy python=x.y +``` + +### Testing + +Run all tests with `pytest`. + +Run specific test file: +```sh +pytest tests/test_configure_feedstock.py +``` +Run specific test within a file: +```sh +pytest tests/test_configure_feedstock.py::test_cuda_enabled_render ``` -$ conda env create + +Run with coverage (this is how the tests are run in CI): + +```sh +pytest tests --cov conda_smithy --cov-report lcov --cov-report term-missing ``` +#### Troubleshooting Tests + +If test coverage is reported as 0%, your `pytest` and `pytest-cov` plugin might be from different environments/Python instances. You can force the use the of the environment versions by prefixing the commands with `python -m`, so to run the tests with coverage: + +```sh +python -m pytest tests --cov conda_smithy --cov-report lcov --cov-report term-missing +``` + +### Linting and Formatting + +This repo currently uses `flake8` for linting (but doesn’t enforce it) and `black` for auto-formatting. `black` is already configured in the pre-commit hook, but you can run it manually whenever you like with: + +```sh +pre-commit run --all-files +``` + +To run flake, just type `flake8`. Note that `black` doesn’t auto-fix all errors found by `flake8`. + Releasing conda-smithy ----------------------