Metadata-Version: 2.1
Name: anaconda-linter
Version: 0.1.1
Summary: A linter to validate recipe meta.yaml files.
Home-page: https://github.com/anaconda-distribution/anaconda-linter
Author: Anaconda, Inc.
Author-email: distribution_team@anaconda.com
License: BSD-3-Clause
Keywords: anaconda_linter
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Utilities
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: AUTHORS.rst
Requires-Dist: conda-build
Requires-Dist: jinja2
Requires-Dist: jsonschema
Requires-Dist: license-expression
Requires-Dist: networkx
Requires-Dist: requests
Requires-Dist: ruamel.yaml
Provides-Extra: docs
Requires-Dist: sphinx ; extra == 'docs'
Requires-Dist: myst-parser ; extra == 'docs'

# Anaconda Linter

Anaconda Linter is a utility to validate that a recipe for a conda package
will render correctly.

The package is currently a very rough draft of a pure Python linter specifically to make sure
that packages' meta.yaml files adhere to certain Anaconda standards.

## Installation
1. `make environment`
2. `conda activate anaconda-linter`

## Usage

```sh
usage: conda-lint [-h] [-V] [-m VARIANT_CONFIG_FILES] [-e EXCLUSIVE_CONFIG_FILES] [-s SUBDIRS] [--severity {INFO,WARNING,ERROR}] [-v] [-f] RECIPE_PATH

positional arguments:
  RECIPE_PATH           Path to recipe directory.

options:
  -h, --help            show this help message and exit
  -V, --version         The version of anaconda-linter
  -m VARIANT_CONFIG_FILES, --variant-config-files VARIANT_CONFIG_FILES
                        Additional variant config files to add. These yaml files can contain keys such as `c_compiler` and `target_platform` to form a
                        build matrix.
  -e EXCLUSIVE_CONFIG_FILES, --exclusive-config-files EXCLUSIVE_CONFIG_FILES, --exclusive-config-file EXCLUSIVE_CONFIG_FILES
                        Exclusive variant config files to add. Providing files here disables searching in your home directory and in cwd. The files
                        specified here come at the start of the order, as opposed to the end with --variant-config-files. Any config files in recipes and
                        any config files specified with --variant-config-files will override values from these files.
  -s SUBDIRS, --subdirs SUBDIRS
                        List subdir to lint. Example: linux-64, win-64...
  --severity {INFO,WARNING,ERROR}
                        The minimum severity level displayed in the output.
  -v, --verbose         Enable verbose output. This displays all of the checks that the linter is running.
  -f, --fix             Attempt to fix issues.
```

The usage is similar to conda-build.

1. navigate into the folder of your main `conda_build_config.yaml` file:
`cd <path/to/aggregate/>`

2. run `conda-lint` with:  `conda-lint <path_to_feedstock>`

Concrete example:
`cd ~/work/recipes/aggregate/`
`conda-lint -v ../wip/airflow-feedstock`

Full usage details can be found under the help menu (`conda-lint -h`). New users may find it easier to run the script with the verbose flag, `-v` which will provide additional context for linting errors.

## Skipping Lints

In order to force the linter to ignore a certain type of lint, you can use the top-level `extra` key in a `meta.yaml file`. To skip lints individually, add lints from this [list of current lints](anaconda_linter/lint_names.md) to the `extra` key as a list with a `skip-lints` key. For example:

    extra:
      skip-lints:
        - unknown_selector
        - invalid_url

You can also do the opposite of this, and skip all other lints *except* the lints you want, with `only-lint`. For example:

    extra:
      only-lint:
        - missing_license
        - incorrect_license

Note: if you have both `skip-lints` and `only-lint`, any lints in `skip-lint` will override identical lints in `only-lint`.

## Testing the Anaconda Linter

Make sure that your `anaconda-linter` environment is activated, then:

`pytest tests` OR `make test` (if you would like to see test reports)

It's that easy!

## Contributing

We welcome contributions for bug fixes, enhancements, or new tests.
For a list of projects, please see the [Issues page](https://github.com/anaconda-distribution/anaconda-linter/issues)

Before submitting a PR, please make sure to:

  * run `make pre-commit` to format your code using `flake8` and `black`.
  * run `make test` to make sure our unit tests pass.
  * add unit tests for new functionality. To print a coverage report, run `make coverage`.

If you would like to develop in a hosted linux environment, a [gitpod instance](https://gitpod.io/#https://github.com/anaconda-distribution/anaconda-linter/tree/gitpod-poc) is available to test linter changes with real life packages, without having to download them to your own machine.

## Contributions
This package is inspired by bioconda's [linter](https://github.com/bioconda/bioconda-utils/blob/master/bioconda_utils/lint/__init__.py).

Some of the code for suggesting hints comes from [Peter Norvig](http://norvig.com/spell-correct.html).

## License
[BSD-3-Clause](https://choosealicense.com/licenses/bsd-3-clause/)


# Changelog
Note: version releases in the 0.x.y range may introduce breaking changes.

## 0.1.1
- Add knowledge of Python build backends to the missing_wheel rule
- Relax host_section_needs_exact_pinnings
- Add cbc_dep_in_run_missing_from_host
- Make uses_setup_py an error
- Add auto-fix for cbc_dep_in_run_missing_from_host, uses_setup_py, pip_install_args
- Update percy to >=0.1.0,<0.2.0
- Add wrong_output_script_key
- Add potentially_bad_ignore_run_exports

## 0.1.0
- Use percy as render backend
- Fix linter parsing bugs
- Shorten file paths in linter messages
- Support lists in `scripts` recipe fields
- Remove `packaging` from python build tools list
- Check for English-specific doc links
- Prohibit license_family: none
- Add `anaconda-lint` entry point

## 0.0.5

- Add fallbacks to all get commands
- Update recipe
- Fix build tools bugs
- Add no_git_on_windows check
- updates licenses and exceptions to latest as of March
- Add license automation
- Enforce use of --no-build-isolation on pip install
- Fix `pip` dependency for linter environment
- Do not require version pin for hatch extensions
- Remove has_imports_and_run_test_py

## 0.0.4

- Add test suite
- Update documentation
- Bug fixes for message system
- Add new check: `patch_unnecessary`
- Add `--severity` option to control the severity level of linter messages
- Remove threading functionality and unused functions
- Use ruamel.yaml through the module and remove pyyaml
- Remove `load_skips` function
- Bug fix: Correct mocks of conda-build jinja functions. PR: #131, Issues: #118
- Bug fix: Correct error line reporting. PR: #131, Issues: #123
- Bug fix: Handle YAML parsing errors. PR: #131, Issues: #126
- Enhancement: Render recipe using cbc files defined variables. PR: #131
- Add multi-output recipe support. PR: #149, #159, Issues: #88
- Fix missing_pip_check for test scripts. PR: #149, Issues: #144
- Implement new Perseverance Recipe Standards. PR: #160, #161, #162, #164, #165
- Code clean-ups. PR: #154, #155, #163.

## 0.0.3

- Update installation files
- Bug fixes

## 0.0.2

- patch: Additional checks added
- patch: More compilers supported

## 0.0.1

Initial release:
- To support downloading of tarballs like: https://github.com/anaconda-distribution/anaconda-linter/archive/{{ version }}.tar.gz
