BewareMyPower commented on PR #81:
URL: 
https://github.com/apache/pulsar-client-python/pull/81#issuecomment-1377007442

   This PR looks like to use the 4th method of 
https://packaging.python.org/en/latest/guides/single-sourcing-package-version/#single-sourcing-the-version,
 but as the warning says:
   
   > With this approach you must make sure that the VERSION file is included in 
all your source and binary distributions
   
   The `version.txt` should be packaged into the Python wheel. I'm not familiar 
with the PyPI setup.py and you might need to search for how to package it.
   
   If I were you, I would adopt the 3rd method, which is simple and clear.
   
   Create an `__about__.py`, which defines a `__version__` global variable, in 
the `pulsar/` directory:
   
   ```python
   __version__='3.1.0a1'
   ```
   
   Then, in `pulsar/__init__.py` you can get the version by:
   
   ```python
   from pulsar.__about__ import __version__
   ```
   
   And in `setup.py` you can change the `get_version` function to:
   
   ```python
   def get_version():
       version = {}
       with open("./pulsar/__about__.py") as fp:
           exec(fp.read(), version)
       return version['__version__']
   ```
   
   References:
   - 
https://github.com/pypi/warehouse/blob/64ca42e42d5613c8339b3ec5e1cb7765c6b23083/warehouse/__init__.py
   - 
https://github.com/pypi/warehouse/blob/64ca42e42d5613c8339b3ec5e1cb7765c6b23083/warehouse/__about__.py


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to