nokia / git-changelog-generator

Git Changelog Generator
https://pypi.python.org/pypi/gcg
BSD 3-Clause "New" or "Revised" License
14 stars 5 forks source link

ImportError: No module named git #22

Closed alanjds closed 5 years ago

alanjds commented 6 years ago

Installed from PyPI.

What git package this asks for? (and hey, it should be installed automatically!)

$ pip2 install gcg
$ gcg --help
Traceback (most recent call last):
  File "/Users/alanjds/.virtualenvs/sandbox27/bin/gcg", line 7, in <module>
    from gcg.entrypoint import main
  File "/Users/alanjds/.virtualenvs/sandbox27/lib/python2.7/site-packages/gcg/entrypoint.py", line 25, in <module>
    import git
ImportError: No module named git
alanjds commented 6 years ago

Found. Its GitPython>=1.0.1

https://github.com/nokia/git-changelog-generator/blob/7fa87f5741215a3fa182141a1b2cde2bfe9fd912/requirements_setup.txt#L4

Should be installed automatically on pip install gcg

felfert commented 5 years ago

Got the same error. Actually your package's metadata is broken:

Metadata-Version: 2.1
Name: gcg
Version: 0.1.8
Summary: Git Changelog Generator
Home-page: https://github.com/nokia/git-changelog-generator
Author: Waldek Maleska
Author-email: waldek.maleska@nokia.com
License: BSD-3-Clause
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Topic :: Software Development :: Bug Tracking
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: Software Development :: Version Control :: Git
Classifier: Topic :: System :: Software Distribution
Classifier: Topic :: Utilities
Classifier: License :: OSI Approved :: BSD License

Not a single Requires-Dist: entry! Therefore, pip does not install any dependencies.

weakcamel commented 5 years ago

Oops. I missed notifications about this issue before. It should have been install_requires, shouldn't it?

I'll have a look at fixing this when I have a chance, but if someone feels like submitting a PR - I'll be happy to review it and take it in.

felfert commented 5 years ago

Oops. I missed notifications about this issue before. It should have been install_requires, shouldn't it?

I'll have a look at fixing this when I have a chance, but if someone feels like submitting a PR - I'll be happy to review it and take it in.

Yep. install_requires is correct. Will create a PR.

weakcamel commented 5 years ago

Dev version https://test.pypi.org/project/gcg/0.2.0.dev254/

Checking it myself once I get my VM to work again.

weakcamel commented 5 years ago
$ pipenv install  gcg
...
$ pip install --extra-index-url https://test.pypi.org/simple/ gcg==0.2.0.dev254

$ pip install --extra-index-url https://test.pypi.org/simple/ gcg==0.2.0.dev254
Looking in indexes: https://pypi.org/simple, https://test.pypi.org/simple/
Collecting gcg==0.2.0.dev254
  Using cached https://test-files.pythonhosted.org/packages/8d/da/a244e55217dc8d4a417247c2f7ab6f35dc218aacd760f09cee82596455f0/gcg-0.2.0.dev254.tar.gz
  WARNING: Requested gcg==0.2.0.dev254 from https://test-files.pythonhosted.org/packages/8d/da/a244e55217dc8d4a417247c2f7ab6f35dc218aacd760f09cee82596455f0/gcg-0.2.0.dev254.tar.gz#sha256=8ae47ec511f1ad465257ed1e7c75148b5da2e98b36ddf94ce80c914cc00edef2, but installing version 0.2.0
Collecting jinja2>=2.10 (from gcg==0.2.0.dev254)
  Downloading https://files.pythonhosted.org/packages/1d/e7/fd8b501e7a6dfe492a433deb7b9d833d39ca74916fa8bc63dd1a4947a671/Jinja2-2.10.1-py2.py3-none-any.whl (124kB)
     |████████████████████████████████| 133kB 1.6MB/s 
Collecting semver>=2.0.1 (from gcg==0.2.0.dev254)
  Downloading https://files.pythonhosted.org/packages/21/18/a0de8cda637ba3efee1b3617ded00601507ce15bd70a39399740e0fd415f/semver-2.8.1-py2.py3-none-any.whl
Collecting GitPython>=1.0.1 (from gcg==0.2.0.dev254)
  Downloading https://files.pythonhosted.org/packages/fe/e5/fafe827507644c32d6dc553a1c435cdf882e0c28918a5bab29f7fbebfb70/GitPython-2.1.11-py2.py3-none-any.whl (448kB)
     |████████████████████████████████| 450kB 1.6MB/s 
Collecting MarkupSafe>=0.23 (from jinja2>=2.10->gcg==0.2.0.dev254)
  Downloading https://files.pythonhosted.org/packages/6e/57/d40124076756c19ff2269678de7ae25a14ebbb3f6314eb5ce9477f191350/MarkupSafe-1.1.1-cp35-cp35m-manylinux1_x86_64.whl
Collecting gitdb2>=2.0.0 (from GitPython>=1.0.1->gcg==0.2.0.dev254)
  Downloading https://files.pythonhosted.org/packages/da/30/a407568aa8d8f25db817cf50121a958722f3fc5f87e3a6fba1f40c0633e3/gitdb2-2.0.5-py2.py3-none-any.whl (62kB)
     |████████████████████████████████| 71kB 6.8MB/s 
Collecting smmap2>=2.0.0 (from gitdb2>=2.0.0->GitPython>=1.0.1->gcg==0.2.0.dev254)
  Downloading https://files.pythonhosted.org/packages/55/d2/866d45e3a121ee15a1dc013824d58072fd5c7799c9c34d01378eb262ca8f/smmap2-2.0.5-py2.py3-none-any.whl
Building wheels for collected packages: gcg
  Building wheel for gcg (setup.py) ... done
  Stored in directory: /home/waldek/.cache/pip/wheels/6b/55/7f/1c744c11a59d8389a83b5abc84ebb8a99728438f801b46810a
Successfully built gcg
Installing collected packages: MarkupSafe, jinja2, semver, smmap2, gitdb2, GitPython, gcg
  Found existing installation: gcg 0.1.8
    Uninstalling gcg-0.1.8:
      Successfully uninstalled gcg-0.1.8
Successfully installed GitPython-2.1.11 MarkupSafe-1.1.1 gcg-0.2.0 gitdb2-2.0.5 jinja2-2.10.1 semver-2.8.1 smmap2-2.0.5

And verified on gcg's repo:

$ git clone https://github.com/nokia/git-changelog-generator
...
$ cd git-changelog-generator 
$ gcg -O rpm  | head
* Tue Jul 09 2019 Waldek Maleska <w.maleska@gmail.com> - current
- bump version to 0.2.0 (rev.7042e4e9)
- Removed unused dependencies (rev.d759b77f)
- Fix #22 (rev.f7169ae0)

* Wed Jun 06 2018 Waldek Maleska <waldek.maleska@nokia.com> - 0.1.8
- In spec, fix installation path to patch CentOS (rev.5507441f)
- deb template: excessive space before date stamp (rev.5185e2ab)

* Tue Jun 05 2018 Waldek Maleska <waldek.maleska@nokia.com> - 0.1.6
felfert commented 5 years ago

BTW: Seeing that output, begs the question: Why those empty lines between the releases? They really aren't necessary. Same goes for the deb changelog (2 empty lines instead of 1). Oh and finally something else: I would like the author and email of the release specified as params instead being fetched from the repo. Expect some PRs in the near Future :-)

Cheers -Fritz

weakcamel commented 5 years ago

@felfert

Why those empty lines between the releases?

In case of RPMs it's quite typical, isn't it? See e.g. https://www.thegeekdiary.com/how-to-check-change-log-of-rpm-packages-on-centos-rhel/ If I had a Centos/RH box around, I'd snoop to double check. IMO it rather improves readability.

Same goes for the deb changelog (2 empty lines instead of 1)

Yep, feel free to fix that. https://www.debian.org/doc/debian-policy/ch-source.html#debian-changelog-debian-changelog doesn't say either way and 2 empty lines do seem excessive.

I would like the author and email of the release specified as params instead being fetched from the repo.

That's something I've considered a while ago; it could be fed to the script using data from e.g. local Git config or environment or just plain and simple manually.

The approach of gcg is to assume that a release == Git tag, therefore whoever put the tag in place is the person who released the SW.

I don't have a problem with having an optional parameter to override that behaviour. The catch is: which release should this be? Just the latest or all of them? In the latter case and >1 maintainers of a package, each changelog would tell a different history.

That said, a proposal and/or PR would be welcome!

P.S. And many thanks for your contribution and comments. I'm very happy to see it being useful for anyone.

P.P.S. As for @alanjds - thank for reporting the issue in the first place and apologies for losing it from my radar.

holdjun commented 5 years ago

你好呀