twolfson / restructuredtext-lint

reStructuredText linter
The Unlicense
171 stars 20 forks source link

Expose version via -v or --version; Bump version to 0.14.3 #32

Closed peterjc closed 8 years ago

peterjc commented 8 years ago

Pull request to implement #31.

Tested locally via python3.5 setup.py install and also confirmed python3.5 setup.py bdist seems to work.

Also checked:

$ pip3.5 uninstall restructuredtext_lint
$ python3.5 setup.py bdist_wheel
$ pip3.5 install dist/restructuredtext_lint-0.14.4-py3-none-any.whl

New behaviour:

$ rst-lint --version
Lint reStructuredText v0.14.4
$ rst-lint -v
Lint reStructuredText v0.14.4

NOTE: Might you want to reserve -v for a future verbose option?

twolfson commented 8 years ago

While this works, putting the content in __init__.py feels a bit dirty; we could easily encounter a circular dependency or load unnecessary dependencies. Additionally, this breaks our existing foundry release setup =/.

Maybe we can move to a restructuredtext_lint/version.txt file? That would be easier to set up as a custom step in foundry (e.g. echo $VERSION)

twolfson commented 8 years ago

Also I concur with only keeping --version, let's leave -v alone for now

peterjc commented 8 years ago

Does anyone use your code from within Python (via import restructuredtext_lint)? If so then you really ought to have the version available there too (e.g. in __init__.py as currently proposed).

I'm not familiar with foundry.

twolfson commented 8 years ago

I mean __init__.py could load up __version__ as well but it seems backwards to have cli.py loading __init__.py as that's a circular dependency =/

peterjc commented 8 years ago

Given the version definition is innately tied to your release process and the packaging, I'm 100% OK with you taking this PR purely as a suggestion, and doing something a bit different.

twolfson commented 8 years ago

I probably will. Sorry for wasting your time/energy. I forgot about the complexities of Python library management x_x

peterjc commented 8 years ago

No problem - I'll try to check back and see how you end up solving this as I may learn a trick or two 👍