Skip to content

Move addheader to ./bin/ with various refactoring and lint style fixes. #198

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

Open
wants to merge 5 commits into
base: edge
Choose a base branch
from

Conversation

jonasbardino
Copy link
Contributor

Move addheader.py to ./bin/ with various refactoring and lint style fixes:

  • Change constants to UPPER_CASE as suggested by linters and PEP8
  • Wrap action in main function for better isolation
  • Switch to shared.fileio helpers instead of raw open+read/write+close
  • Automatic python module load path lookup from cmd parent path if insufficient
  • Simplify some if X: return True constructs as suggested by linters
  • Normalize path patterns to actually make the ../X ones from projcode work

Adjust the addition of shebang interpreter and encoding lines to actually do what the label says.

Add new bin, sbin and mig/lib dirs to projcode paths.

@jonasbardino jonasbardino self-assigned this Feb 13, 2025
@jonasbardino jonasbardino added the refactor Non-functional changes to simplify or clean up label Feb 13, 2025
 * Change constants to `UPPER_CASE` as suggested by linters and PEP8
 * Wrap action in main function for better isolation
 * Switch to fileio helpers instead of raw open+read/write+close
 * Automatic python module load path lookup from cmd parent path if insuffient
 * Simplify some `if X: return True` constructs as suggested by linters
 * Normalize path patterns to actually make the ../X ones work

Adjust the addition of shebang interpreter and encoding lines to actually do
what the label says.

Add new bin, sbin and mig/lib dirs to projcode paths.
…bit and

changed strings to use double quotes.
Applied `isort` last to revert from the `black` import mangling and preserve
our usual hanging indent imports.
…which

optionally takes a list of languages to filter on or all by default.

Make sure that there's at least a single blank line between license header and
actual module content.

Minor adjustments to fix style check warnings.
Fix language lookup and skip append if missing.
@jonasbardino jonasbardino force-pushed the adjust/move-addheader-to-bin-with-lint-fixes branch from 97cfd2a to 9f9edb4 Compare February 13, 2025 11:29
@jonasbardino jonasbardino requested a review from a team February 13, 2025 12:03
@albu-diku
Copy link

Hm - I'm not a fan of this in particular being in bin. It's not something that users of the system will invoke, it's an internal tool, so to me it feels like putting it there starts to dilute the purpose of the bin directory. Since this is really an internal thing and development facing I'd prefer to see it placed elsewhere - perhaps envhelp or similar as other development helpers.

@jonasbardino
Copy link
Contributor Author

Well, on one hand I can see your point that it is not really relevant to site deployments, but that could be handled e.g. by simply filtering what we distribute in docker-migrid (or migrid releases) if that's a concern.

As noted in the new associated milestone one important part of the motivation for having a shared ./bin was to only have one obvious place with a standard name to look for tools. Another was a fresh start where we can clean up and force linting requirements. So putting it in ./envhelp or other existing locations goes against that IMO - then we're not much better off than leaving it in the base dir.

We could consider introducing the corresponding FHS ./libexec dir for such tools. It's not a perfect fit either but a somewhat telling name and apparently often used for such non-user tools according to the FHS spec and
https://unix.stackexchange.com/questions/312146/what-is-the-purpose-of-usr-libexec

@albu-diku
Copy link

Fair enough. Given that interpretation I think we should place it in bin for consistency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Non-functional changes to simplify or clean up
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants