Skip to content

Commit e19fe17

Browse files
committed
Update version location
1 parent ab74bfd commit e19fe17

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[metadata]
22
name = sqlalchemyseed
3+
version = 1.0.0
34
description = SQLAlchemy Seeder
45
long_description = file: README.md
56
long_description_content_type = text/markdown

setup.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33

44
from setuptools import setup
55

6-
with open("README.md", encoding="utf-8") as f:
7-
LONG_DESCRIPTION = f.read()
86

7+
# with open(os.path.join('src', 'sqlalchemyseed', '__init__.py'), 'r') as f:
8+
# pattern = r"^__version__ = ['\"]([^'\"]*)['\"]"
9+
# VERSION = re.search(pattern, f.read(), re.MULTILINE).group(1)
910

10-
with open(os.path.join('src', 'sqlalchemyseed', '__init__.py'), 'r') as f:
11-
pattern = r"^__version__ = ['\"]([^'\"]*)['\"]"
12-
VERSION = re.search(pattern, f.read(), re.MULTILINE).group(1)
1311

14-
15-
setup(version=VERSION,)
12+
# setup(version=VERSION,)
13+
setup()

src/sqlalchemyseed/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@
2727
from .loader import load_entities_from_json
2828
from .loader import load_entities_from_yaml
2929
from .loader import load_entities_from_csv
30+
import importlib_metadata
3031

31-
__version__ = '1.0.0'
32+
__version__ = importlib_metadata.version('sqlalchemyseed')
3233

3334
if __name__ == '__main__':
3435
pass

tests/scratch.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@
66
engine = create_engine('sqlite://')
77
Session = sessionmaker(bind=engine)
88
Base.metadata.create_all(engine)
9+
10+
import sqlalchemyseed
11+
12+
print(sqlalchemyseed.__version__)

0 commit comments

Comments
 (0)