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

fix: Update Support Window spreadsheet #414

Merged
merged 10 commits into from
Jul 18, 2023

Conversation

MimmyJau
Copy link
Contributor

Note: There are two commits. The first commit adds the release date and EOL dates for the current ElasticSearch 7.17 version. The second commit adds functionality for auto-updating some of the version numbers based on Tutor defaults.

Background: Based on the notes in this issue. Current Support Windows spreadsheet is not up-to-date. Noticed there hasn't been any attempt to add these features, so this is a first pass at trying to update barcalendar.py.

Doesn't include:

  • tests
  • auto-updating django, ubuntu, ruby, or node versions

Happy to make any changes based on feedback. Thanks in advance.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jul 10, 2023
@openedx-webhooks
Copy link

openedx-webhooks commented Jul 10, 2023

Thanks for the pull request, @MimmyJau! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

@MimmyJau MimmyJau changed the title fix: update Support Windsows spreadsheet fix: update Support Windows spreadsheet Jul 11, 2023
@mphilbrick211
Copy link

Hi @MimmyJau! Thanks for this contribution. Please let me know if you have any questions regarding filling out the CLA form.

@mphilbrick211 mphilbrick211 added the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Jul 11, 2023
@MimmyJau
Copy link
Contributor Author

Hi @MimmyJau! Thanks for this contribution. Please let me know if you have any questions regarding filling out the CLA form.

Thanks! I've submitted the CLA, just waiting now for it to be processed.

@MimmyJau MimmyJau changed the title fix: update Support Windows spreadsheet fix: Update Support Windows spreadsheet Jul 11, 2023
@MimmyJau MimmyJau changed the title fix: Update Support Windows spreadsheet fix: Update Support Windows Spreadsheet Jul 12, 2023
@MimmyJau MimmyJau changed the title fix: Update Support Windows Spreadsheet fix: Update Support Windows spreadsheet Jul 12, 2023
@e0d
Copy link
Contributor

e0d commented Jul 12, 2023

I notice there are some commit-lint failures. Please note that we use conventional commits across Open edX projects. You can read about the details here. Can you please amend your commit messages to follow our standard?

@MimmyJau
Copy link
Contributor Author

Thanks @e0d! I noticed I made that mistake but was a little cautious to force push an updated git history.

With your permission I'll go ahead and make those changes.

@e0d
Copy link
Contributor

e0d commented Jul 12, 2023

No worries, you can force push in this case.

@MimmyJau MimmyJau changed the title fix: Update Support Windows spreadsheet fix: Update Support Window spreadsheet Jul 13, 2023
barcalendar.py Outdated
Get openedx version name in line from YAML file.
e.g. "open-release/palm.1" -> "Palm"
"""
match = re.search(r'(?P<version_name>[A-Za-z]+)[\.\d+]*$', line)
Copy link
Contributor

@nedbat nedbat Jul 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how this setting is managed. Sometimes its value is open-release/palm.master. Perhaps the best approach is to use:

match = re.search(r'/(?P<version_name>[A-Za-z]+)\.', line)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified it to

match = re.search(r'(?P<version_name>[A-Za-z]+)(\.\w*)*$', line)

to also match the following cases:

  • "open-release/palm.1"
  • "open-release/palm.1.2.3"
  • "open-release/palm.master"
  • "open-release/palm.master.1.2.3"
  • "open-release/palm."

It is a bit redundant. Looking at this page, it shouldn't deviate from the two formats we considered here.

Happy to go with the simpler approach.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me, it's simpler to say, "the word between the slash and the dot." Your regex is, "the word followed by dots and words at the end of the line," which seems more confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you phrase it that way, I completely agree. I've made the change.

barcalendar.py Outdated Show resolved Hide resolved
barcalendar.py Outdated

if resp.status_code == 200:
return safe_load(resp.text)
return None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For many of the info functions, it would be better to raise an exception than to return None. If a problem occurs, and they return None, we'll have a mysterious error elsewhere in the program.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a raise RuntimeError if resp.status_code is anything but 200.

Also in the except block above, I re-raised the RequestException error. Let me know if this makes sense.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requests has a helper method: https://requests.readthedocs.io/en/latest/api/#requests.Response.raise_for_status . It will raise an exception based on the status code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, did not know about this. I've incorporated it.

barcalendar.py Outdated Show resolved Hide resolved
@e0d e0d removed the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Jul 17, 2023
MimmyJau added a commit to MimmyJau/openedx-repo-tools that referenced this pull request Jul 17, 2023
See here for original comment:
openedx#414 (comment)

Version name might be something like "palm.master", in which case we
don't just want to capture a version number.
MimmyJau added a commit to MimmyJau/openedx-repo-tools that referenced this pull request Jul 17, 2023
Was previously importing a specific function but this was not consistent
with style.

See here for original comment:
openedx#414 (comment)
MimmyJau added a commit to MimmyJau/openedx-repo-tools that referenced this pull request Jul 17, 2023
Before, if http request to tutor's defaults.yml returned status code !=
200, function would return None and continue. No error would be
raised.

This fix now raises a RuntimError.

See here for original comment:
openedx#414 (comment)
MimmyJau added a commit to MimmyJau/openedx-repo-tools that referenced this pull request Jul 17, 2023
f-string is unnecessary if the string is a single Python expression.
Replaced f-string with just the expression where possible.

See here for original comment:
openedx#414 (comment)
@mphilbrick211
Copy link

Hi @nedbat! Would you please re-run the tests, as they bounced back to needing approval.

barcalendar.py Outdated Show resolved Hide resolved
barcalendar.py Outdated
if match is not None:
version_number = match.group("version_number")
return version_number
return None
Copy link
Contributor

@nedbat nedbat Jul 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be good to raise an exception if the version number can't be found. If it's missing, then no error happens, and the chart is made with no version highlighted as current. Maybe something like:

Suggested change
return None
raise ValueError(f"Couldn't get version from {line!r}")

and something similar for parse_version_name also.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense and I agree. The latest commit adds this and also an exception for the related function parse_version_name.

@nedbat
Copy link
Contributor

nedbat commented Jul 18, 2023

Sorry for all the tweaks, thanks for pushing through with this.

BTW, I have to ask: what drew your attention to this program? It's off the beaten path, so to speak! 😄

Add support date for Elasticsearch version 7.17.

Did not include support dates for previous versions between 7.14 and
7.16 inclusive.
Add functions for automatically pulling version number from tutor's
default config file and choosing which bars to bold and outline.

This pulls the name and / or number for the current version of openedx,
MongoDB, Elasticsearch, MySQL, and Redis. It does not pull the current
version of Python, Django, Ubuntu, Node, or Ruby.

To be clear, this commit doesn't add new bars to the calendar, it only
automates how we choose which bars to bold and outline. For example, if
we were to switch to Elasticsearch 8.x.x, we'll still need to manually
add the release and EOL dates.
See here for original comment:
openedx#414 (comment)

Version name might be something like "palm.master", in which case we
don't just want to capture a version number.
Was previously importing a specific function but this was not consistent
with style.

See here for original comment:
openedx#414 (comment)
Before, if http request to tutor's defaults.yml returned status code !=
200, function would return None and continue. No error would be
raised.

This fix now raises a RuntimError.

See here for original comment:
openedx#414 (comment)
f-string is unnecessary if the string is a single Python expression.
Replaced f-string with just the expression where possible.

See here for original comment:
openedx#414 (comment)
MimmyJau and others added 2 commits July 18, 2023 13:53
Before, if version name or number wasn't found, will continue to run
program and generate a bar calendar that doesn't have bolded bars. Want
to instead raise an error.

See here for original comment:
openedx#414 (comment)
@MimmyJau
Copy link
Contributor Author

Sorry for all the tweaks, thanks for pushing through with this.

BTW, I have to ask: what drew your attention to this program? It's off the beaten path, so to speak! 😄

Not a problem at all! Thanks for taking the time and attention.

I came across the issue here. Saw that it was backlogged and at the top. It also looked like a good first issue so I figured why not :)

@nedbat nedbat merged commit 2dc7322 into openedx:master Jul 18, 2023
@openedx-webhooks
Copy link

@MimmyJau 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants