Skip to content

Commit 4bed554

Browse files
authored
Merge pull request #129 from lukasbindreiter/master
Infer version dynamically from installed pip package
2 parents 1a4f33a + 8200cf6 commit 4bed554

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

flake8_isort.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,19 @@
55
from pathlib import Path
66

77
import isort
8+
from pkg_resources import DistributionNotFound, get_distribution
9+
10+
11+
def _version():
12+
try:
13+
return get_distribution('flake8_isort').version
14+
except DistributionNotFound:
15+
return 'dev' # for local development if package is not installed yet
816

917

1018
class Flake8IsortBase:
1119
name = 'flake8_isort'
12-
version = '5.0.1'
20+
version = _version()
1321
isort_unsorted = 'I001 isort found an import in the wrong position'
1422
no_config_msg = 'I002 no configuration found (.isort.cfg or [isort] in configs)'
1523
isort_blank_req = 'I003 isort expected 1 blank line in imports, found 0'

0 commit comments

Comments
 (0)