- On the top right of the page, click "Use this template", select "create a new repository" and set a name for the package.
- Modify the class in validator/main.py with source code for the new validator
- Make sure that the class still inherits from
Validatorand has theregister_validatorannotation. - Set the
namein theregister_validatorto the name of the repo and set the appropriate data type.
- Make sure that the class still inherits from
- Change validator/init.py to your new Validator classname instead of RegexMatch
- Locally test the validator with the test instructions below
- Note: This package uses a pyproject.toml file, on first run, run
pip install .to pull down and install all dependencies
- Open test/test-validator.py to test your new validator
- Import your new validator and modify
ValidatorTestObjectaccordingly - Modify the TEST_OUTPUT and TEST_FAIL_OUTPUT accordingly
- Run
python test/test-validator.pyvia terminal, make sure the returned output reflects the input object - Write advanced tests for failures, etc.
- Update the pyproject.toml file and make necessary changes as follows:
- Update the
namefield to the name of your validator - Update the
descriptionfield to a short description of your validator - Update the
authorsfield to your name and email - Add/update the
dependenciesfield to include all dependencies your validator needs.
- Update the
- If there are are any post-installation steps such as downloading tokenizers, logging into huggingface etc., update the post-install.py file accordingly.
- You can add additional files to the validator directory, but don't rename any existing files/directories.
- e.g. Add any environment variables (without the values, just the keys) to the .env file.
- Ensure that there are no other dependencies or any additional steps required to run your validator.