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

Use explicit package name in call to get_version #19

Merged
merged 1 commit into from
Jul 13, 2020
Merged

Conversation

taldcroft
Copy link
Member

Description

Use explicit package name to avoid problems with pytest and ska_helpers.version.

Testing

  • Passes unit tests on MacOS, linux, Windows (at least one required)
  • Functional testing

Ran python -c 'import Ska.Shell; Ska.Shell.test() and saw no pytest warnings.

Without the patch:

============================================ test session starts ============================================
platform darwin -- Python 3.7.7, pytest-5.4.3, py-1.9.0, pluggy-0.13.1
rootdir: /Users/aldcroft/miniconda3/envs/ska3-shiny/lib/python3.7/site-packages
collected 20 items                                                                                          

Ska/Shell/tests/test_shell.py ............s.......                                                    [100%]

============================================= warnings summary ==============================================
/Users/aldcroft/git/ska_helpers/ska_helpers/version.py:87
  /Users/aldcroft/git/ska_helpers/ska_helpers/version.py:87: UserWarning: Traceback (most recent call last):
    File "/Users/aldcroft/git/ska_helpers/ska_helpers/version.py", line 39, in get_version
      dist_info = get_distribution(distribution or package)
    File "/Users/aldcroft/miniconda3/envs/ska3-shiny/lib/python3.7/site-packages/pkg_resources/__init__.py", line 481, in get_distribution
      dist = get_provider(dist)
    File "/Users/aldcroft/miniconda3/envs/ska3-shiny/lib/python3.7/site-packages/pkg_resources/__init__.py", line 357, in get_provider
      return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
    File "/Users/aldcroft/miniconda3/envs/ska3-shiny/lib/python3.7/site-packages/pkg_resources/__init__.py", line 900, in require
      needed = self.resolve(parse_requirements(requirements))
    File "/Users/aldcroft/miniconda3/envs/ska3-shiny/lib/python3.7/site-packages/pkg_resources/__init__.py", line 786, in resolve
      raise DistributionNotFound(req, requirers)
  pkg_resources.DistributionNotFound: The 'Shell' distribution was not found and is required by the application
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "/Users/aldcroft/git/ska_helpers/ska_helpers/version.py", line 76, in get_version
      version = get_version(root=Path(*roots), relative_to=module_file)
    File "/Users/aldcroft/miniconda3/envs/ska3-shiny/lib/python3.7/site-packages/setuptools_scm/__init__.py", line 144, in get_version
      return _get_version(config)
    File "/Users/aldcroft/miniconda3/envs/ska3-shiny/lib/python3.7/site-packages/setuptools_scm/__init__.py", line 148, in _get_version
      parsed_version = _do_parse(config)
    File "/Users/aldcroft/miniconda3/envs/ska3-shiny/lib/python3.7/site-packages/setuptools_scm/__init__.py", line 118, in _do_parse
      "use git+https://github.com/user/proj.git#egg=proj" % config.absolute_root
  LookupError: setuptools-scm was unable to detect version for '/Users/aldcroft/miniconda3/envs/ska3-shiny/lib/python3.7/site-packages/Ska'.
  
  Make sure you're either building from a fully intact git repository or PyPI tarballs. Most other sources (such as GitHub's tarballs, a git checkout without the .git folder) don't contain the necessary metadata and will not work.
  
  For example, if you're using pip, instead of https://github.com/user/proj/archive/master.zip use git+https://github.com/user/proj.git#egg=proj
  
  
  
    warnings.warn(traceback.format_exc() + '\n\n')

/Users/aldcroft/git/ska_helpers/ska_helpers/version.py:88
  /Users/aldcroft/git/ska_helpers/ska_helpers/version.py:88: UserWarning: Failed to find a package version, setting to 0.0.0
    warnings.warn('Failed to find a package version, setting to 0.0.0')

-- Docs: https://docs.pytest.org/en/latest/warnings.html
=========================== 19 passed, 1 skipped, 2 warnings in 600.63s (0:10:00) ===========================

@taldcroft taldcroft changed the title Version for shiny Use explicit package name in call to get_version Jul 13, 2020
@taldcroft
Copy link
Member Author

This should not be controversial so merging.

@taldcroft taldcroft merged commit f37f78a into master Jul 13, 2020
@taldcroft taldcroft deleted the version branch July 13, 2020 13:35
@javierggt javierggt mentioned this pull request Dec 7, 2020
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.

1 participant