Skip to content

Conversation

@austinorr
Copy link

@austinorr austinorr commented Apr 29, 2024

  • removed non-consensus tooling; can add back after consensus & dependencies & documentation are included.
    • check-manifest: this project doesn't have a MANIFEST file, and can get by without one.
    • commitizen: this is a powerful tool, but the team has not agreed to use it. It's not in the dev-deps. New tools that change developer workflows should have some consensus and a separate PR and a section added to the 'contributing' file
    • isort/black: we should definitely lint this project, but this section is premature since there's no linting CI, no linting deps, and no consensus. the team should consider ruff since it does all of isort, black, flake8, and every other imaginable python lint tool all in one -- it's the current standard (scipy, pandas, jupyter, pytest, pip, mypy... on and on.)

I attempted to install with current 'develop' branch, several issues:

  • all imports are broken:
/HSPsquared/tests/test10/HSP2results$ hsp2 import_uci test10.uci test10.h5
Traceback (most recent call last):
  File "/home/aorr/miniconda3/envs/hsp2-install/bin/hsp2", line 5, in <module>
    from HSP2tools.HSP2_CLI import main
ModuleNotFoundError: No module named 'HSP2tools'

To fix this i changed

[tool.setuptools.packages.find]
exclude = ["tests*", "examples*", "tools*", "docs*"]
where = ["HSP2", "HSP2tools", "HSP2IO"]

to

[tool.setuptools.packages.find]
include = ["HSP2", "HSP2tools", "HSP2IO"]

and got a new error:

Traceback (most recent call last):
  File "/home/aorr/miniconda3/envs/hsp2-install/bin/hsp2", line 5, in <module>
    from HSP2tools.HSP2_CLI import main
  File "/home/aorr/miniconda3/envs/hsp2-install/lib/python3.11/site-packages/HSP2tools/__init__.py", line 13, in <module>
    import HSP2
  File "/home/aorr/miniconda3/envs/hsp2-install/lib/python3.11/site-packages/HSP2/__init__.py", line 9, in <module>
    from _version import __version__
ModuleNotFoundError: No module named '_version'

to fix this per the old setup.py method, i added _version to py-modules, which makes it importable, but still throws when we try to use the hsp2 command.

Traceback (most recent call last):
  File "/home/aorr/miniconda3/envs/hsp2-install/bin/hsp2", line 5, in <module>
    from HSP2tools.HSP2_CLI import main
  File "/home/aorr/miniconda3/envs/hsp2-install/lib/python3.11/site-packages/HSP2tools/__init__.py", line 13, in <module>
    import HSP2
  File "/home/aorr/miniconda3/envs/hsp2-install/lib/python3.11/site-packages/HSP2/__init__.py", line 9, in <module>
    from _version import __version__
  File "/home/aorr/miniconda3/envs/hsp2-install/lib/python3.11/site-packages/_version.py", line 3, in <module>
    with open(os.path.join(os.path.dirname(__file__), "VERSION"), encoding="ascii") as version_file:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/home/aorr/miniconda3/envs/hsp2-install/lib/python3.11/site-packages/VERSION'

bundling the top-level VERSION file so that it's importable by our tools is tricky -- notice that now our _version.py module lives in the top-level of our site-packages folder:

image

this is not how we are supposed to version our package -- imagine if everyone did this!

Instead we need to find a way to bundle our package so that the version number is both available to modules that need to import/export it, and secondarily make it available for easy modification with future version-bump tooling (I believe this is why it was placed in a VERSION file to begin with).

I believe we should simplify our versioning approach for now and adapt it for tooling once we have consensus for who/how version bumps are made.

This PR has a working distribution that is also a good citizen in our site-packages. However, now our site packages looks like:

image

In the future we should consider distributing a single package called hsp2 with each of these modules included as part of that single package.

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