diffpy / diffpy.pdfgui

graphical user interface for real space structure refinement to PDF
Other
19 stars 27 forks source link

versioning in pdfgui still seems not to be cookiecutter compliant #190

Closed sbillinge closed 3 weeks ago

sbillinge commented 3 weeks ago

I am getting this dump:

(pdfgui-rc) sb2896@build-platform-instance:~/dev/diffpy.pdfgui$ pdfgui
Traceback (most recent call last):
  File "/home/sb2896/miniconda3/envs/pdfgui-rc/bin/pdfgui", line 5, in <module>
    from diffpy.pdfgui.applications.pdfgui import main
  File "/home/sb2896/miniconda3/envs/pdfgui-rc/lib/python3.11/site-packages/diffpy/pdfgui/__init__.py", line 21, in <module>
    from diffpy.pdfgui.version import __version__
  File "/home/sb2896/miniconda3/envs/pdfgui-rc/lib/python3.11/site-packages/diffpy/pdfgui/version.py", line 32, in <module>
    fcfg = str(files(__name__).joinpath("version.cfg"))
               ^^^^^^^^^^^^^^^
  File "/home/sb2896/miniconda3/envs/pdfgui-rc/lib/python3.11/importlib/resources/_common.py", line 22, in files
    return from_package(get_package(package))
                        ^^^^^^^^^^^^^^^^^^^^
  File "/home/sb2896/miniconda3/envs/pdfgui-rc/lib/python3.11/importlib/resources/_common.py", line 55, in get_package
    raise TypeError(f'{package!r} is not a package')
TypeError: 'diffpy.pdfgui.version' is not a package

and the version.py doesn't look like cookiecutter.

sbillinge commented 3 weeks ago

@Tieqiong please can you take this one and make sure that pdfgui is running for you when typed from the command line?

Tieqiong commented 3 weeks ago

@sbillinge Well interestingly it's working for me. So when I Conda activate pdfgui environment and type pdfgui in command line it runs normally and the window pop up. There's also no issue with using it. I installed pdfgui locally both -e and no -e and both are working.

The only thing I did manually was pip install diffpy.pdffit2 with version 1.4.4rc0 and pip install diffpy.structure with version 3.2.0

Tieqiong commented 3 weeks ago

I think I know why. There is a version.cfg file that's in my pdfgui directory and it's gitignored, and it's used in the version management I believe. However this file came from nowhere and the version (2.0.3.post37), time(2024-08-15, about the first time I touched on this package), commit id are all weird. I guess this might be produced by local build when setup.py was still here. Let me delete this and work on this issue

Edit: Actually what I've just said is wrong. That file is supposed to be generated by version.py which is not doing it now. Let me try to fix that file

sbillinge commented 3 weeks ago

Just a heads-up we are ideally looking for hte solution that is cookiecutter compliant. Andrew and I actually bumped our heads into this when we were designing the cookiecutter and came up with a fix that was working, so as a starting point, trying to figure out what that solution was, and only then making project-specific mods here if they are needed.

This is the idea behind all the cookiecuttering. it is a huge amount of work now, but we are investing in a much less painful future! But every package that varies from that is technical debt that can bite us in the future, which is why I am asking for this approach. Not sure if that makes sense.