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

More robust version handling: Keep versions aligned. #30

Open
thorwhalen opened this issue Jun 28, 2024 · 2 comments
Open

More robust version handling: Keep versions aligned. #30

thorwhalen opened this issue Jun 28, 2024 · 2 comments

Comments

@thorwhalen
Copy link
Member

We've had problems with versions (the opinion of tags, setup.cfg, and pypi) getting misaligned and causing havoc.

Good-enough solutions were implemented, but these are more to enable us to diagnose the problem (#11) and circumvent it (#29).

This issue is meant to diagnose the problem further, to see what kind of use actions lead to misalignment in the first place, and solution the problem at that level.

@thorwhalen
Copy link
Member Author

More on this.

Looked into the version update problem (version not updating in setup.cfg (see this example) where the repo in this state shows a setup.cfg of 0.0.28 while the tag and pypi are at 0.0.33.

This is where update should happen, but it's not clear how the version that is computed two lines above is communicated to the update_setup_cfg function -- not to be confused with wads version of the same (and same name) function. It's clear that there is a print to return hack happening (which we'd really like to eliminate). Yes, it seems like (hack continues) the VERSION is put in a variable, put in the GITHUB_ENV, and then it is recuperated by update_setup_cfg

@thorwhalen
Copy link
Member Author

thorwhalen commented Jan 21, 2025

Yet more.

In this new project, the Validation passed, but ci failed with the following message.
(Note that setup.cfg didn't have a url specified.)

Run export VERSION=$(isee gen-semver)
  export VERSION=$(isee gen-semver)
  echo "VERSION=$VERSION" >> $GITHUB_ENV
  isee update-setup-cfg
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    PROJECT_NAME: poclab
    pythonLocation: /opt/hostedtoolcache/Python/3.10.16/x64
    PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.10.16/x64/lib/pkgconfig
    Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.16/x64
    Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.16/x64
    Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.16/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.10.16/x64/lib
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/_distutils_hack/__init__.py:33: UserWarning: Setuptools is replacing distutils.
  warnings.warn("Setuptools is replacing distutils.")
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.10.16/x64/bin/isee", line 8, in <module>
    sys.exit(main())
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/isee/__init__.py", line 41, in main
    argh.dispatch_commands(argh_kwargs.get("functions", None))
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/argh/dispatching.py", line 511, in dispatch_commands
    dispatch(parser, *args, **kwargs)
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/argh/dispatching.py", line 199, in dispatch
    return run_endpoint_function(
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/argh/dispatching.py", line [270](https://github.com/i2mint/poclab/actions/runs/12884450489/job/35920802436#step:5:273), in run_endpoint_function
    return _process_command_output(lines, output_file, raw_output, always_flush)
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/argh/dispatching.py", line 290, in _process_command_output
    for line in lines:
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/argh/dispatching.py", line 415, in _execute_command
    for line in result:
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/argh/dispatching.py", line 395, in _call
    result = function(*positional_values, **values_by_name)
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/isee/generation_utils.py", line 111, in gen_semver
    version = get_new_version(
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/isee/generation_utils.py", line 73, in get_new_version
    versions = versions_from_different_sources(work_tree)
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/wads/pack.py", line 968, in versions_from_different_sources
    "current_pypi": current_pypi_version(pkg_spec),
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/wads/pack.py", line 884, in current_pypi_version
    raise Exception(f"Failed to get information for {package_name}")
NameError: name 'package_name' is not defined
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/_distutils_hack/__init__.py:33: UserWarning: Setuptools is replacing distutils.
  warnings.warn("Setuptools is replacing distutils.")
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.10.16/x64/bin/isee", line 8, in <module>
    sys.exit(main())
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/isee/__init__.py", line 41, in main
    argh.dispatch_commands(argh_kwargs.get("functions", None))
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/argh/dispatching.py", line 511, in dispatch_commands
    dispatch(parser, *args, **kwargs)
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/argh/dispatching.py", line 199, in dispatch
    return run_endpoint_function(
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/argh/dispatching.py", line 270, in run_endpoint_function
    return _process_command_output(lines, output_file, raw_output, always_flush)
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/argh/dispatching.py", line [290](https://github.com/i2mint/poclab/actions/runs/12884450489/job/35920802436#step:5:294), in _process_command_output
    for line in lines:
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/argh/dispatching.py", line 415, in _execute_command
    for line in result:
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/argh/dispatching.py", line 395, in _call
    result = function(*positional_values, **values_by_name)
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/isee/file_modification_utils.py", line 48, in update_setup_cfg
    version = version or get_env_var("VERSION")
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/isee/common.py", line 68, in get_env_var
    raise RuntimeError(f"{key} is not defined or is empty!")
RuntimeError: VERSION is not defined or is empty!
Error: Process completed with exit code 1.

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

No branches or pull requests

1 participant