Skip to content

Conversation

@stevenhua0320
Copy link
Contributor

@stevenhua0320 stevenhua0320 commented Oct 3, 2025

@zmx27 Ready for review, I'm in the step of migration of files

@stevenhua0320 stevenhua0320 requested a review from zmx27 October 3, 2025 00:49
Copy link
Collaborator

@zmx27 zmx27 left a comment

Choose a reason for hiding this comment

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

See comments

c_extension: false
headless: false
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
Copy link
Collaborator

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

Copy link
Contributor Author

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?

Copy link
Collaborator

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"
Copy link
Collaborator

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

Copy link
Contributor Author

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

Copy link
Collaborator

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"

Copy link
Contributor Author

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
Copy link
Collaborator

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?

Copy link
Contributor Author

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)

Copy link
Collaborator

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

Copy link
Contributor Author

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",
Copy link
Collaborator

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?

Copy link
Contributor Author

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

Copy link
Collaborator

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

Copy link
Contributor Author

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
Copy link
Collaborator

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?

pyface
diffpy.srxplanar
configparser
numpy No newline at end of file
Copy link
Collaborator

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.

Copy link
Contributor Author

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.)

Copy link
Collaborator

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

@@ -0,0 +1,31 @@
import numpy as np
Copy link
Collaborator

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

Copy link
Contributor Author

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

@stevenhua0320 stevenhua0320 requested a review from zmx27 October 3, 2025 18:02
Copy link
Collaborator

@zmx27 zmx27 left a comment

Choose a reason for hiding this comment

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

See comments

rev: 24.4.2
hooks:
- id: black
exclude: '(^|/)(diffpy/srxplanargui)/(live|selectfiles|imageplot)\.py$'
Copy link
Collaborator

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?

Copy link
Contributor Author

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

Copy link
Collaborator

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.

pyface
diffpy.srxplanar
configparser
pyface
Copy link
Collaborator

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?

Copy link
Contributor Author

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

Copy link
Contributor Author

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.

@stevenhua0320 stevenhua0320 requested a review from zmx27 October 3, 2025 19:00
rev: 24.4.2
hooks:
- id: black
exclude: '(^|/)(diffpy/srxplanargui)/(live|selectfiles|imageplot)\.py$'
Copy link
Collaborator

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",
Copy link
Collaborator

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

pyface
diffpy.srxplanar
configparser
diffpy.srxconfutils
Copy link
Collaborator

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

Copy link
Contributor Author

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.

@stevenhua0320 stevenhua0320 requested a review from zmx27 October 3, 2025 21:20
Copy link
Collaborator

@zmx27 zmx27 left a 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
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

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?

Copy link
Contributor Author

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.

Copy link
Collaborator

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

@stevenhua0320
Copy link
Contributor Author

@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.

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