Unverified Commit 5a2b5720 authored by msbaines's avatar msbaines Committed by GitHub
Browse files

[chore] setup a proper version number (#20)

parent 8e363567
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.0.0] - 2020-07-31
- Initial release.
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
# This source code is licensed under the BSD license found in the # This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree. # LICENSE file in the root directory of this source tree.
__version__ = "0.0.0"
################################################################################ ################################################################################
# Import most common subpackages # Import most common subpackages
################################################################################ ################################################################################
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import os import os
import re
import warnings import warnings
import setuptools import setuptools
...@@ -16,6 +17,15 @@ def fetch_requirements(): ...@@ -16,6 +17,15 @@ def fetch_requirements():
return reqs return reqs
# https://packaging.python.org/guides/single-sourcing-package-version/
def find_version(version_file_path):
with open(version_file_path) as version_file:
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file.read(), re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")
extensions = [] extensions = []
cmdclass = {} cmdclass = {}
...@@ -43,6 +53,7 @@ if __name__ == "__main__": ...@@ -43,6 +53,7 @@ if __name__ == "__main__":
setuptools.setup( setuptools.setup(
name="fairscale", name="fairscale",
description="fairscale: Utility library for large-scale and high-performance training.", description="fairscale: Utility library for large-scale and high-performance training.",
version=find_version("fairscale/__init__.py"),
install_requires=fetch_requirements(), install_requires=fetch_requirements(),
include_package_data=True, include_package_data=True,
packages=setuptools.find_packages(exclude=("tests", "tests.*")), packages=setuptools.find_packages(exclude=("tests", "tests.*")),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment