Skip to content

Commit

Permalink
Move to setuptools_scm instead of hardcoded version
Browse files Browse the repository at this point in the history
  • Loading branch information
thatch committed Sep 17, 2020
1 parent e2a4b7b commit f8b2391
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# setuptools_scm
bowler/version.py

# Docusaurus
.DS_Store

Expand Down
5 changes: 4 additions & 1 deletion bowler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
"""Safe code refactoring for modern Python projects."""

__author__ = "John Reese, Facebook"
__version__ = "0.9.0"
try:
from .version import version as __version__
except ImportError:
__version__ = "dev"

from .imr import FunctionArgument, FunctionSpec
from .query import Query
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ packages =
test_suite = bowler.tests
python_requires = >=3.6
setup_requires =
setuptools_scm
setuptools>=38.6.0

[options.entry_points]
Expand Down
7 changes: 1 addition & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,10 @@

from setuptools import find_packages, setup

with open("bowler/__init__.py") as f:
for line in f:
if line.startswith("__version__"):
version = line.split('"')[1]

with open("requirements.txt") as f:
requires = f.read().strip().splitlines()

setup(
version=version,
install_requires=requires,
use_scm_version={"write_to": "bowler/version.py"},
)

0 comments on commit f8b2391

Please sign in to comment.