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

Apply the cookiecutter to LMS #5444

Merged
merged 1 commit into from
Jun 5, 2023
Merged

Apply the cookiecutter to LMS #5444

merged 1 commit into from
Jun 5, 2023

Conversation

seanh
Copy link
Collaborator

@seanh seanh commented May 31, 2023

Apply our pyramid-app cookiecutter to LMS. Depends on hypothesis/cookiecutters#121

These cookiecutter PRs are by their nature kind of hard to review by looking at the diff. Some recommendations on how to test it:

@seanh seanh force-pushed the apply-cookiecutter branch from acce7ac to 23fee88 Compare May 31, 2023 16:54
@seanh seanh changed the title Apply our pyramid-app cookiecutter to this project Apply the cookiecutter to LMS Jun 1, 2023
@seanh seanh force-pushed the apply-cookiecutter branch 2 times, most recently from 34c08eb to 5f22eca Compare June 1, 2023 15:22
@seanh seanh marked this pull request as ready for review June 1, 2023 15:39
@seanh seanh requested review from marcospri and jon-betts June 1, 2023 15:44
@seanh
Copy link
Collaborator Author

seanh commented Jun 1, 2023

Note to self: recompile the requirements/*.txt files without upgrading everything

Copy link
Contributor

@jon-betts jon-betts left a comment

Choose a reason for hiding this comment

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

This is too much at once to seriously review on a line by line basis, but I can test it as a black box.

As mentioned, I think we've upgraded all the dependencies by mistake, but even with this it seems to work for me. I ran through these, mostly just checking it completed and didn't spit out any errors:

  • make clean
  • make sure (ran twice)
  • make dev
  • make devdata
  • make docker
  • make docker-run - Seems broken to me - Missing env settings?
  • make sql
  • make template - Resulted in quite a few changes

I didn't do any manual testing to see the app is actually working.

@seanh seanh force-pushed the apply-cookiecutter branch 2 times, most recently from f0677e7 to b77f765 Compare June 5, 2023 09:45
@seanh
Copy link
Collaborator Author

seanh commented Jun 5, 2023

@jon-betts Could you re-review?

  1. make template should be clean now that Various fixups cookiecutters#121 is merged
  2. I've fixed the requirements/*.txt files. Note that there are some deliberate changes to these files corresponding to the changes to the requirements/*.in files. But I've fixed this PR to not accidentally upgrade any existing packages in the *.txt files
  3. make devdata docker docker-run is indeed broken but it's broken in the same way on main so I'm going to opt not to fix it in this PR: it's not something that this PR has changed

@seanh seanh requested a review from jon-betts June 5, 2023 10:01
@seanh seanh force-pushed the apply-cookiecutter branch from b77f765 to bff9caf Compare June 5, 2023 10:41
Copy link
Contributor

@jon-betts jon-betts left a comment

Choose a reason for hiding this comment

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

I'm not sure if these are things you want to do anything about, but there is a conflict with the formatting of some of the requirements files and dependabot. This is due to us running pip-compile with --allow-unsafe on. If we want to resolve it it can be removed.

When running make template I still see some chnages in pyproject.toml.

pip==23.1.2
# via pip-tools
setuptools==67.8.0
# via pip-tools
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is due to a difference between how we compile things and how dependabot does. If you want to resolve this so we don't get so much chatter in PRs from dependabot you can remove the --allow-unsafe from the requirements building.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can we see what happens with future Dependabot PRs? If it's still not using --allow-unsafe then we can remove that from the cookiecutter and apply the change to all our projects at once

Comment on lines +44 to +47
"lms/pshell.py",
"lms/migrations/*",
"lms/extensions/feature_flags/views/test.py",
"lms/views/feature_flags_test.py",
Copy link
Contributor

Choose a reason for hiding this comment

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

Running make template removes the lines from pshell.py onwards.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a weird one:

  • make template does not make any changes to pshell.py for me even if I do make clean template
  • But if I clone another copy of the repo, switch to this branch, and run make template then it does make the changes to pshell.py 😕

This is the relevant part of the cookiecutter's pyproject.toml template:

https://github.com/hypothesis/cookiecutters/blob/d5ae86cc5817e86a51f689152e0dd49c76c22103/_shared/project/pyproject.toml#L57-L65

The lines that are being removed need to go in a .cookiecutter/includes/coverage/omit file. And indeed there is no such omit file on this branch, so I would expect the lines to be getting removed by make template. So why are these lines not being removed when I run make template in my original clone of this repo?

It turns out that I do have a cookiecutter/includes/coverage/omit file locally but this file is ignored by one of the cookiecutter's .gitignore rules:

https://github.com/hypothesis/cookiecutters/blob/d5ae86cc5817e86a51f689152e0dd49c76c22103/_shared/project/.gitignore#L2

I'll open an issue in the cookiecutter's repo to fix that rule. In the meantime I've force-added the missing file on this branch (even though it's .gitignore'd) so make template is clean now

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@seanh seanh merged commit 43ae8f5 into main Jun 5, 2023
@seanh seanh deleted the apply-cookiecutter branch June 5, 2023 14:26
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

Successfully merging this pull request may close these issues.

2 participants