fix_contribs
This module provides functionality to ensure that necessary files and directories exist for each contribution in a specified contributions directory.
It automates the creation of essential files such as pyproject.toml, README.md,
__init__.py, a main Python file, and test files for each subdirectory within the
contributions directory.
Additionally, it ensures the presence of a tests directory for each
contribution.
Functions:
- Create_files_for_contribs: Ensures the existence of required files and directories for each contribution subdirectory.
Usage:
- Run this script directly to automatically create or verify the required files
and directories for contributions in the specified
CONTRIB_DIR.
create_files_for_contribs()
Ensures that necessary files and directories exist for each contribution in the specified contributions directory.
This function performs the following tasks for each subdirectory in the contributions directory:
- Checks if a
pyproject.tomlfile exists; if not, creates one. - Checks if a
README.mdfile exists; if not, creates one. - Checks if an
__init__.pyfile exists; if not, creates one. - Checks if a main Python file named after the subdirectory exists; if not, creates one.
- Creates a
testsdirectory if it does not already exist. - Checks if a test file named
test_<subdir>.pyexists in thetestsdirectory; if not, creates one.
If any of the above files or directories already exist, a message is printed indicating their presence.
Returns:
| Type | Description |
|---|---|
None
|
None |
Source code in scripts/fix_contribs.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |