-
Notifications
You must be signed in to change notification settings - Fork 1
skpkg: setup CI after migrating tests, src, requirements, and .github folder #20
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
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.
See comments
.github/workflows/tests-on-pr.yml
Outdated
| c_extension: false | ||
| headless: false | ||
| secrets: | ||
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
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.
There's a workflow file in our release-scripts repo that's similar to the _tests-on-pr.yml workflow script except it doesn't upload to Codecov. I believe that it's best to call upon that instead. So you'd call it like:
uses: scikit-package/release-scripts/.github/workflows/_tests-on-pr-no-codecov.yml@v0
The reason we do this is that this is a private repo, and uploading to Codecov would not work. Then, delete the line containing the Codecov token. Similarly, we want our CI to run pre-commit in every PR, so I would add a section with user run commands as well. So the final segment would be something like:
jobs:
tests-on-pr:
uses: scikit-package/release-scripts/.github/workflows/_tests-on-pr-no-codecov.yml@v0
with:
project: diffpy.pdfgetx
c_extension: false
headless: false
run: |
conda install pre-commit
pre-commit run --all-files
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.
So for here, is that project: diffpy.pdfgetx to be replaced by project: diffpy.srxplanargui?
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, my bad. I happened to have a tab open for pdfgetx and just copy pasted a section of it haha
pyproject.toml
Outdated
| namespaces = false # to disable scanning PEP 420 namespaces (true by default) | ||
|
|
||
| [project.scripts] | ||
| diffpy-srxplanargui = "diffpy.srxplanargui.app:main" |
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 don't see such a file in the project repo
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.
It is uploaded in one of the commits, there is a file called diffpy.srxplanargui_app.py
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 assume it would be called as "diffpy.srxplanargui_app:main"
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.
Have changed to you said, see new commit.
pyproject.toml
Outdated
| | build | ||
| | dist | ||
| | dpx/srxplanargui/(live|selectfiles|imageplot)\.py |
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.
Can I ask why these files are being excluded? And why dpx?
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.
These files are excluded because as I said in the linting issue before, there is pre-commit conflict between flake8 and isort auto-fix, so in order to suppress that, I excluded these files. Originally it is in dpx (my bad, I forgot to delete that in new version)
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.
You won't need to exclude these files if you already # noqa those lines. That will already suppress the flake8 errors, and you can just default to the isort autofixes
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.
Sorry, my bad. It is not flake8 issue but black and isort formatting conflict
pyproject.toml
Outdated
| skip = [ | ||
| "src/diffpy/srxplanargui/live.py", | ||
| "src/diffpy/srxplanargui/selectfiles.py", | ||
| "src/diffpy/srxplanargui/imageplot.py", |
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, why are these being skipped?
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 reason as previous one
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 that I think about it, why is this here? .pre-commit-config.yaml already sets the "profile" of isort to black, and you can also exclude certain files in that config file directly (if it comes to that in the worst case). This feels kind of unnecessary
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 have deleted the hook exclusion files for black . Now it seems to be right on my local. Let's try not to exclude files for black check and also edits in .pre-commit-config.yaml. So, now these exclusion for isort is necessary. Also, I made these exclusion to .isort.cfg file so it would be deleted in the latest commit.
| chaco | ||
| fabio | ||
| pyfai | ||
| matplotlib |
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.
According to the old pip.txt, it seems like pyface is also a dependency?
requirements/pip.txt
Outdated
| pyface | ||
| diffpy.srxplanar | ||
| configparser | ||
| numpy No newline at end of file |
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.
Why did you delete all of this? configparser can be left deleted, however, since it is now in the Python standard library as of Python 3.
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.
Because I assumed that diffpy.srxplanar would perferrably be installed via conda since we prefer more stable build of dependencies. (My bad, I forgot to push that commit for this edition, I would do that shortly.)
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 private repo, and I don't believe we intend to upload this to conda forge and allow it to be conda installed
src/diffpy/srxplanargui/functions.py
Outdated
| @@ -0,0 +1,31 @@ | |||
| import numpy as np | |||
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.
Delete this file, it's a template file created by skpkg
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.
Have deleted, see new update
… dependency, delete useless linting exclusion file command
zmx27
left a comment
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.
See comments
.pre-commit-config.yaml
Outdated
| rev: 24.4.2 | ||
| hooks: | ||
| - id: black | ||
| exclude: '(^|/)(diffpy/srxplanargui)/(live|selectfiles|imageplot)\.py$' |
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.
You mentioned linting issues between flake8 and isort, so why are these files excluded for black as well?
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.
Sorry, not flake8, it is black and isort autofix conflict as in #3
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 don't know why that is happening. First, try adding in the extra config file .isort.cfg. Maybe also use this chance to add in .flake8 and .codespell/. If the auto fix conflict still comes up (uncomment these excludes to test), you can probably just leave it there and ask Professor Simon whether it's okay. Because as far as I know, it's not a very good idea to allow black to ignore multiple files.
requirements/pip.txt
Outdated
| pyface | ||
| diffpy.srxplanar | ||
| configparser | ||
| pyface |
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 those other dependencies that you deleted?
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.
traits and traitsui have conda version as I checked, so I add those to conda.txt
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 pyface, I have added to conda.txt and for configparser you just said we could left deleted.
.pre-commit-config.yaml
Outdated
| rev: 24.4.2 | ||
| hooks: | ||
| - id: black | ||
| exclude: '(^|/)(diffpy/srxplanargui)/(live|selectfiles|imageplot)\.py$' |
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 don't know why that is happening. First, try adding in the extra config file .isort.cfg. Maybe also use this chance to add in .flake8 and .codespell/. If the auto fix conflict still comes up (uncomment these excludes to test), you can probably just leave it there and ask Professor Simon whether it's okay. Because as far as I know, it's not a very good idea to allow black to ignore multiple files.
pyproject.toml
Outdated
| skip = [ | ||
| "src/diffpy/srxplanargui/live.py", | ||
| "src/diffpy/srxplanargui/selectfiles.py", | ||
| "src/diffpy/srxplanargui/imageplot.py", |
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 that I think about it, why is this here? .pre-commit-config.yaml already sets the "profile" of isort to black, and you can also exclude certain files in that config file directly (if it comes to that in the worst case). This feels kind of unnecessary
requirements/pip.txt
Outdated
| pyface | ||
| diffpy.srxplanar | ||
| configparser | ||
| diffpy.srxconfutils |
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 package won't be in PyPI I believe.
Also, what I meant is that I believe the dependencies listed in pip.txt and conda.txt should be more or less the same except for when there are certain exceptions such as when packages are only on conda forge and not PyPI or when the package names are slightly different. So dependencies like traits, scipy, etc should also be here
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.
But for diffpy.srxconfutils it is a dependency for diffpy.srxplanrgui, so where should it be as we need it.
zmx27
left a comment
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 haven't checked all the files yet, but I will say that this PR is becoming too big and complicated. For good practice, we usually want each PR to be quite small and lightweight and divide up the skpkging work into multiple PRs instead of doing everything at the same time. I'd suggest referring back to the skpkg documentation here to see what you want to include in this step of the skpkging process. For example, let's only add the tests-on-pr.yml file in the .github folder for now. We also usually want to add the config files for the precommit hooks in another PR. I initially mentioned adding them as a possible solution to the auto fix conflict you were encountering, but since you ended up creating some auto fixes now that black is not skipped anymore, it's probably fine to keep both the config files (like .flake8, .isort, etc) and the auto fixes. The rest, like README.rst and MANIFEST.in should be removed from this PR.
| @@ -0,0 +1,18 @@ | |||
| name: Release (GitHub/PyPI) and Deploy Docs | |||
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 file will change because I don't think we're releasing this package to PyPI, etc. I suggest we work on this in another PR.
| @@ -0,0 +1,21 @@ | |||
| name: CI | |||
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 for this file
| @@ -0,0 +1,12 @@ | |||
| name: Deploy Documentation on Release | |||
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 for this
| multi_line_output = 3 | ||
| include_trailing_comma = True | ||
| profile=black | ||
| skip=src/diffpy/srxplanargui/live.py,src/diffpy/srxplanargui/selectfiles.py,src/diffpy/srxplanargui/imageplot.py |
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.
Does this mean that you need the skip to avoid the auto fix conflicts?
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 have retest this on a clean branch and found that now we do not need to skip these files.
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 file can be deleted because this package only has Python code
|
@zmx27 I would close this PR because it is too messy to make more commits. Instead I would create a new clean branch to redo pieces of work into multiple PRs so that it could be reviewed easily. |
@zmx27 Ready for review, I'm in the step of migration of files