Add numeric flag in generate ontology to control namespace package root depth
- Dominant language
- Python
- Stars
- 253
- Forks
- 59
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
This is a follow-up to https://github.com/asyml/forte/issues/497
Instead of adding a boolean flag `use_name_space_packaging`, it's better to set an integer argument `namespace_depth` to allow a customized number of levels of namespace packaging. By doing so, we want to disable the generation of `__init__.py` for all the directory levels above `namespace_depth`.
For example, if we have an ontology `level1.levle2.level3.something` and `namespace_depth=2`, then we remove `__init__.py` under level1 and level1/level2 while keeping `__init__.py` under level1/level2/level3 (or any layer deeper). When `namespace_depth<=0`, we just disable namespace packaging and include `__init__.py` in all directory levels.
Further, there is one part not resolved in issue 497, where this new feature should be reflected in `generate-ontology` command line tool: https://github.com/asyml/forte/blob/master/forte/command_line/generate_ontology/__main__.py. For example, we can add a new integer argument called --namespace_depth. Only by doing this we can expose the feature to users.
**Describe the solution you'd like**
Same as above.
**Describe alternatives you've considered**
**Additional context**
Add any other context or screenshots about the feature request here.
Contributor guide
Research direction
Start with forte/command_line/generate_ontology/__main__.py and review the existing generate-ontology arguments. Trace how ontology package directories and __init__.py files are generated, then verify the requested namespace_depth behavior for zero, negative, and positive values against the example in the issue. Done means the integer option is exposed through the CLI and controls the generated namespace roots as described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100