{"action":"created","issue":{"url":"https://api.github.com/repos/warner/python-versioneer/issues/180","repository_url":"https://api.github.com/repos/warner/python-versioneer","labels_url":"https://api.github.com/repos/warner/python-versioneer/issues/180/labels{/name}","comments_url":"https://api.github.com/repos/warner/python-versioneer/issues/180/comments","events_url":"https://api.github.com/repos/warner/python-versioneer/issues/180/events","html_url":"https://github.com/warner/python-versioneer/issues/180","id":312929875,"node_id":"MDU6SXNzdWUzMTI5Mjk4NzU=","number":180,"title":"Allow using API from python","user":{"login":"flying-sheep","id":291575,"node_id":"MDQ6VXNlcjI5MTU3NQ==","avatar_url":"https://avatars0.githubusercontent.com/u/291575?v=4","gravatar_id":"","url":"https://api.github.com/users/flying-sheep","html_url":"https://github.com/flying-sheep","followers_url":"https://api.github.com/users/flying-sheep/followers","following_url":"https://api.github.com/users/flying-sheep/following{/other_user}","gists_url":"https://api.github.com/users/flying-sheep/gists{/gist_id}","starred_url":"https://api.github.com/users/flying-sheep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flying-sheep/subscriptions","organizations_url":"https://api.github.com/users/flying-sheep/orgs","repos_url":"https://api.github.com/users/flying-sheep/repos","events_url":"https://api.github.com/users/flying-sheep/events{/privacy}","received_events_url":"https://api.github.com/users/flying-sheep/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-10T13:46:31Z","updated_at":"2018-07-04T09:16:31Z","closed_at":null,"author_association":"NONE","body":"I would like to use versioneer like this:\r\n\r\n`pip install versioneer`\r\n\r\n`mymodule/__init__.py` or `mymodule.py`:\r\n```python\r\nfrom versioneer import get_version\r\n__version__ = get_version(__file__)\r\ndel get_version\r\n```\r\n\r\nVersioneer could now use the following assumptions:\r\n\r\n```python\r\ndef get_version(package_file, style='pep440'):\r\n    package_file = Path(package_file)\r\n    assert package_file.name == '__init__.py'\r\n    package_name = package_file.parent.name\r\n    project_dir = package_file.parent.parent\r\n```\r\n\r\nVersioneer would then:\r\n\r\n1. Try from-vcs, e.g. `project_dir / '.git'`\r\n2. Try from-file `project_dir / '_version.py'`\r\n3. Try from-parentdir `project_dir.name`\r\n4. Try from-metadata `pkg_resources.get_distribution(package_name)`\r\n\r\nThe last step is new and can be used for installed packages instead of from-file, eliminating the need for a build step."},"comment":{"url":"https://api.github.com/repos/warner/python-versioneer/issues/comments/402418347","html_url":"https://github.com/warner/python-versioneer/issues/180#issuecomment-402418347","issue_url":"https://api.github.com/repos/warner/python-versioneer/issues/180","id":402418347,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMjQxODM0Nw==","user":{"login":"dzhoshkun","id":9197424,"node_id":"MDQ6VXNlcjkxOTc0MjQ=","avatar_url":"https://avatars2.githubusercontent.com/u/9197424?v=4","gravatar_id":"","url":"https://api.github.com/users/dzhoshkun","html_url":"https://github.com/dzhoshkun","followers_url":"https://api.github.com/users/dzhoshkun/followers","following_url":"https://api.github.com/users/dzhoshkun/following{/other_user}","gists_url":"https://api.github.com/users/dzhoshkun/gists{/gist_id}","starred_url":"https://api.github.com/users/dzhoshkun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dzhoshkun/subscriptions","organizations_url":"https://api.github.com/users/dzhoshkun/orgs","repos_url":"https://api.github.com/users/dzhoshkun/repos","events_url":"https://api.github.com/users/dzhoshkun/events{/privacy}","received_events_url":"https://api.github.com/users/dzhoshkun/received_events","type":"User","site_admin":false},"created_at":"2018-07-04T09:16:30Z","updated_at":"2018-07-04T09:16:30Z","author_association":"NONE","body":"Indeed point 4. above is needed to retrieve the version of pip-installed packages. So it would be great if it could be incorporated into versioneer."}}
{"actor":{"display_login":"dzhoshkun"}}