Skip to content

Commit 5a002d2

Browse files
authored
Merge pull request #224 from openzim/expose_version
Expose `constants.VERSION` to have access to zimscraperlib version from scrapers
2 parents 974ac37 + 995ab95 commit 5a002d2

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
### Added
1616

1717
- Add `filesystem.validate_folder_writable` to check if a folder can be written to #200
18+
- Expose `constants.VERSION` to have access to zimscraperlib version from scrapers #224
1819

1920
### Fixed
2021

src/zimscraperlib/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
ROOT_DIR = pathlib.Path(__file__).parent
1111
NAME = pathlib.Path(__file__).parent.name
1212
SCRAPER = f"{NAME} {__version__}"
13+
VERSION = __version__
1314
CONTACT = "[email protected]"
1415
DEFAULT_USER_AGENT = f"{NAME}/{__version__} ({CONTACT})"
1516

tests/test_constants.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from zimscraperlib import constants
2+
3+
4+
def test_name():
5+
assert constants.NAME
6+
7+
8+
def test_scraper():
9+
assert constants.SCRAPER
10+
11+
12+
def test_version():
13+
assert constants.VERSION

0 commit comments

Comments
 (0)