Last active
February 14, 2023 08:32
-
-
Save freol35241/8d8d46a95e24354b9d0809f2a6ce1fe9 to your computer and use it in GitHub Desktop.
Setup.py allowing for reading version string from an environment variable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import setuptools | |
from packaging.version import Version | |
with open("README.md", "r") as fh: | |
long_description = fh.read() | |
with open("requirements.txt") as f: | |
required = f.read().splitlines() | |
# Try to read version string from env variable | |
# Default to 0.0.0.dev0 to allow for installs through `pip install -e .` | |
version_string = os.environ.get("RELEASE_VERSION", "0.0.0.dev0") | |
version = Version(version_string) | |
setuptools.setup( | |
name="package-name", | |
version=str(version), | |
description="Short description", | |
long_description=long_description, | |
long_description_content_type="text/markdown", | |
install_requires=required, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment