Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-think the lib/ module structure a bit #62

Open
comps opened this issue Aug 24, 2023 · 0 comments
Open

Re-think the lib/ module structure a bit #62

comps opened this issue Aug 24, 2023 · 0 comments

Comments

@comps
Copy link
Contributor

comps commented Aug 24, 2023

The current structure,

lib
├── oscap.py
├── results.py
├── runtest.py
├── util
│   ├── content.py
│   ├── environment.py
│   ├── __init__.py
│   ├── log.py
│   ├── sanitization.py
│   └── subprocess.py
├── versions.py
├── virt.py
└── waive.py

Is somewhat confusing.

  • What should be in util instead of directly in lib?
  • What if I have a generic helper function? Do I put it in util/__init__.py or create util/misc.py or just misc.py under lib?

The historical answer is - stuff under lib directly are meant to be large categories of many classes/functions falling under that identifier, eg. big python modules.
Stuff under util/ was originally just util.py, basically "misc stuff that didn't fit elsewhere", but got split up when it became too big.

This is probably not a great structure, but the separation was meant to allow newcomers to Contest to find useful test-facing functions easily in big lib/ modules.
Also to have miscellaneous utilities accessible under util.* directly, not having to care whether they come from content.py or log.py.

It's hard to say what a better structure would be, but a better option might be to put everything directly in lib/ and turn bigger modules into directories, further splitting them as necessary. Or something like that. Investigate.

@comps comps changed the title Clean up lib/ a bit Re-think the lib/ module structure a bit Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant