-
Notifications
You must be signed in to change notification settings - Fork 217
Additional easyconfig parameters for documentation (REVIEW) #2113
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
Conversation
usage, support, contact
| 'docpaths': [None, "List of paths of installed documentation relative to package root dir", MODULES], | ||
| 'docurls': [None, "List of URLs to package documentation", MODULES], | ||
| 'support': [None, "Package-specific support/bug report address", MODULES], | ||
| 'contact': [None, "Site contact for the package", MODULES], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, this is getting a bit messy, is it not?
we should try and sort these alphabetically, although maybe also keep related ones together in groups?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for contact, don't make it specific to site contact, could also be upstream contact for this software package (e.g. a mailing list)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, the idea was to separate upstream contacts (support) from site-local contacts (contact). The documentation of those two parameters already tries to make that clear. But maybe the naming is sub-optimal. I'm open for suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... I just noticed that there is already a docurls parameter defined in the MANDATORY section, though it is not (yet) enforced. I guess it hasn't been used so far?
Regarding the "messiness": Would it make sense to add a DOCUMENTATION group and add all those variables to it? Though description would then need to be in MANDATORY and DOCUMENTATION...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the support documentation needs to indicate that this is for upstream, not site-local support. Otherwise it's rather ambiguous.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about upstream_contact and site_contact? This should make it clear. And since the list values are free-form text fields, one could do something like
upstream_contact = [
'Support e-mail: [email protected]',
'Mailing list: [email protected]',
'Bugtracker: https://www.project.org/bugzilla'
]
site_contact = ['Jane Admin']
Which would be rendered as
More information
================
- Homepage: https://www.project.org
- Upstream contact:
- Support e-mail: [email protected]
- Mailing list: [email protected]
- Bugtracker: https://www.project.org/bugzilla
- Site contact: Jane Admin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, exactly what I had in mind.
easybuild/tools/module_generator.py
Outdated
| from easybuild.tools.filetools import convert_name, mkdir, read_file | ||
| from easybuild.tools.modules import ROOT_ENV_VAR_NAME_PREFIX, modules_tool | ||
| from easybuild.tools.utilities import quote_str | ||
| from textwrap import wrap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a non-easybuild import, it should go up with the others?
easybuild/tools/module_generator.py
Outdated
| 'Description', | ||
| '===========', | ||
| "%s" % description.strip(), | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a common pattern below, so maybe define a helper function inside of this method to ensure consistency of the format?
def _generate_help_text(self):
...
def generate_section(sec_name, sec_txt):
"""
Generate section with given name and contents
""""
if sec_txt:
return [
'',
sec_name,
'=' * len(sec_name),
sec_txt.strip(),
]
else:
return []
# General package description (mandatory)
lines = generate_section('Description', self.app.cfg['description'])
# Package usage instructions (optional)
lines.extend('Usage', self.app.cfg['usage'])
# Additional information: homepage + (if available) doc paths/urls, support info, contacts, ...
lines.extend('More information', " - Homepage: %s" % self.app.cfg['homepage'])
...
extensions = ', '.join(sorted(['%s-%s' % (ext[0], ext[1]) for ext in exts_list], key=str.lower))
lines.extend('Extensions', '\n'.join(wrap(extensions, 78)))
easybuild/tools/module_generator.py
Outdated
| '', | ||
| "Included extensions", | ||
| '===================', | ||
| "%s" % '\n'.join(wrap(extensions, 78)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, the 78 here looks very arbitrary/harcoded... why exactly 78?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make it fit nicely into a 80-character-wide terminal window 😁
When making this a configuration parameter, I'd also like to see all other sections to be wrapped at the given width. But this is (at least from my "I don't know much Python" perspective) by no means trivial to achieve with textwrap.wrap(). Maybe someone knows a good rst-to-ascii-text renderer that we could leverage?
easybuild/tools/module_generator.py
Outdated
| "proc ModulesHelp { } {", | ||
| " puts stderr { %(description)s", | ||
| " puts stderr {" | ||
| "%s" % self._generate_help_text(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"%s" % x is the same thing as just x
easybuild/tools/module_generator.py
Outdated
| lines = [ | ||
| "help([[%(description)s]])", | ||
| 'help([[', | ||
| "%s" % self._generate_help_text(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here too, no need for the "%s" %
easybuild/tools/module_generator.py
Outdated
| contact = self.app.cfg['contact'] | ||
| if contact: | ||
| if isinstance(contact, list): | ||
| lines.extend([" - Site contacts:"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drop the Site ?
|
I like the idea 👍 |
|
@boegel There is no test yet for the whatis/help text in the presence of extensions, and I'm not quite sure where to put it. Any suggestion? Otherwise I think this is now ready for prime time. |
|
@geimer Can you take care of the conflict before I revisit this? W.r.t. a test for whatis/help with extensions involved, we have |
…o additional_doc_params
|
@boegel Who f?$%ed up the The test checking the modulefile contents is currently using |
|
@geimer why would using |
Ups ;-P. Sorting it wasn't really necessary, but working with it with methods put at random places in the file was kind of annoying, that's why I shuffled everything around. |
|
@boegel If I'm not mistaken, |
|
|
||
| # MODULES documentation easyconfig parameters | ||
| # (docurls is part of MANDATORY) | ||
| 'docpaths': [None, "List of paths of installed documentation relative to package root dir", MODULES], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
List of paths for documentation relative to installation directory
| # MODULES documentation easyconfig parameters | ||
| # (docurls is part of MANDATORY) | ||
| 'docpaths': [None, "List of paths of installed documentation relative to package root dir", MODULES], | ||
| 'examples': [None, "Free-form text with examples", MODULES], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... with examples on using the software
| # (docurls is part of MANDATORY) | ||
| 'docpaths': [None, "List of paths of installed documentation relative to package root dir", MODULES], | ||
| 'examples': [None, "Free-form text with examples", MODULES], | ||
| 'site_contact': [None, "String/list of strings with site contacts for the package", MODULES], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plural: site_contacts
also: s/package/software/
| 'site_contact': [None, "String/list of strings with site contacts for the package", MODULES], | ||
| 'upstream_contact': [None, ("String/list of strings with upstream contact addresses " | ||
| "(e.g., support e-mail, mailing list, bugtracker)"), MODULES], | ||
| 'usage': [None, "Usage instructions for the package", MODULES], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/package/software/
| 'upstream_contact': [None, ("String/list of strings with upstream contact addresses " | ||
| "(e.g., support e-mail, mailing list, bugtracker)"), MODULES], | ||
| 'usage': [None, "Usage instructions for the package", MODULES], | ||
| 'whatis': [None, "List of brief (one line) package description entries", MODULES], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/package/software/
easybuild/tools/module_generator.py
Outdated
|
|
||
| return whatis | ||
|
|
||
| def _generate_extension_list(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sort these methods alphabetically, let's not let @damianam's efforts go to waste ;)
easybuild/tools/module_generator.py
Outdated
| Generate a string with a comma-separated list of extensions. | ||
| """ | ||
| exts_list = self.app.cfg['exts_list'] | ||
| extensions = ', '.join(sorted(['%s-%s' % (ext[0], ext[1]) for ext in exts_list], key=str.lower)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/(ext[0], ext[1])/ext[:2]/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypeError: not enough arguments for format string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now using '-'.join(ext[:2]) for ext in ... but I'm not sure it helps w.r.t. readablity...
easybuild/tools/module_generator.py
Outdated
| # - 'conflict Compiler/GCC/4.8.2/OpenMPI' for 'Compiler/GCC/4.8.2/OpenMPI/1.6.4' | ||
| lines.extend(['', "conflict %s" % os.path.dirname(self.app.short_mod_name)]) | ||
|
|
||
| whatis = self._generate_whatis_lines() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just move this inline, only used in one place?
easybuild/tools/module_generator.py
Outdated
| # conflict on 'name' part of module name (excluding version part at the end) | ||
| lines.extend(['', 'conflict("%s")' % os.path.dirname(self.app.short_mod_name)]) | ||
|
|
||
| whatis = self._generate_whatis_lines() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, move this inline?
test/framework/module_generator.py
Outdated
|
|
||
| gzip_txt = "gzip (GNU zip) is a popular data compression program as a replacement for compress " | ||
| gzip_txt += "- Homepage: http://www.gzip.org/" | ||
| gzip_txt = "gzip (GNU zip) is a popular data compression program as a replacement for compress" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename gzip_txt to descr?
|
lgtm, going in, thanks for your hard work and patience on this @geimer! |
This PR implements support for additional easyconfig parameters for customizing the documentation as discussed here: https://www.mail-archive.com/[email protected]/msg03050.html
It also includes the list of installed extensions of a package in the
module helpoutput.