Giter Site home page Giter Site logo

git-props's People

Contributors

rkrahl avatar

Watchers

 avatar  avatar

git-props's Issues

Drop setuptools_scm in favour of this package

This package has been created with the intention to replace setuptools_scm for my own packages. It should thus also be used in this package itself to manage the version number.

Obviously this seem to create a circular dependency if git-props is needed to build git-props itself. But in fact, this is not really a problem, because any version of git-props will do. So we may use the already released version git-props 0.1 to build newer versions of git-props starting with 0.2.

Review test cases

Review the test cases to make the test suite more concise and at the same time to make sure all relevant situations are covered.

High level package functions should raise LookupError if git is not available

The functions get_version(), get_last_release() and get_date() defined in __init__.py, e.g. at package level, are intended to provide a high level API. They raise LookupError if they are unable to provide the requested information, for instance on any error returned from git, which usually happens if invoked outside of a git repository. This is the intended behavior. But if git itself is not installed, the GitRepo() constructor raises FileNotFoundError, which is not caught:

Traceback (most recent call last):
  File "/home/abuild/test/pytest-dependency-0.6.0/setup.py", line 26, in <module>
    release = str(gitprops.get_last_release())
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/python/lib/python3.12/site-packages/gitprops/__init__.py", line 31, in get_last_release
    repo = _get_repo(root)
           ^^^^^^^^^^^^^^^
  File "/opt/python/lib/python3.12/site-packages/gitprops/__init__.py", line 17, in _get_repo
    _repo_cache[root] = GitRepo(root)
                        ^^^^^^^^^^^^^
  File "/opt/python/lib/python3.12/site-packages/gitprops/repo.py", line 41, in __init__
    self.git_version = self._exec("git version")
                       ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/python/lib/python3.12/site-packages/gitprops/repo.py", line 25, in _exec
    proc = subprocess.run(cmd.split(),
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/python/lib/python3.12/subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/python/lib/python3.12/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/opt/python/lib/python3.12/subprocess.py", line 1950, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'git'

This should also be translated to LookupError, because that belongs to the same class of errors from the callers perspective.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.