diff --git a/MANIFEST.in b/MANIFEST.in index 0a6d803..422de63 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,13 +3,11 @@ include CHANGES.rst include LICENSE include README.rst +include VERSION.txt include tox.ini -include dev-requirements.in -include dev-requirements.txt include requirements.in include requirements.txt include .pylintrc -include .travis.yml recursive-include examples * recursive-include src/crcengine/templates * diff --git a/Makefile b/Makefile index da7d514..5c72eaf 100644 --- a/Makefile +++ b/Makefile @@ -123,8 +123,8 @@ install: clean ## install the package to the active Python's site-packages UPDATE_REQS=pip-compile -q -U --output-file=requirements.txt requirements.in -.PHONY: update-requirements -update-requirements: ## Update dependencies in requirements.txt +.PHONY: update-deps +update-deps: ## Update dependencies in requirements.txt $(call UPDATE_REQS) requirements.txt: requirements.in diff --git a/VERSION.txt b/VERSION.txt new file mode 100644 index 0000000..0223957 --- /dev/null +++ b/VERSION.txt @@ -0,0 +1 @@ +0.3.2a1 diff --git a/requirements.in b/requirements.in index bf519f9..a9ccaab 100644 --- a/requirements.in +++ b/requirements.in @@ -1,6 +1,8 @@ wheel>=0.26 build +importlib-metadata jinja2 +packaging pip-tools Pygments # needed for the docs pytest>=3 diff --git a/requirements.txt b/requirements.txt index 3c79ba0..b8e63d7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -49,10 +49,17 @@ idna==2.10 # via requests imagesize==1.2.0 # via sphinx -importlib-metadata==3.10.0 +importlib-metadata==3.6.0 # via + # -r requirements.in + # build # keyring + # pep517 + # pluggy + # pytest + # tox # twine + # virtualenv iniconfig==1.1.1 # via pytest isort==5.8.0 @@ -71,6 +78,7 @@ mccabe==0.6.1 # via pylint packaging==20.9 # via + # -r requirements.in # bleach # build # pytest @@ -153,10 +161,14 @@ toml==0.10.2 # tox tox==3.23.0 # via -r requirements.in -tqdm==4.59.0 +tqdm==4.60.0 # via twine twine==3.4.1 # via -r requirements.in +typed-ast==1.4.2 + # via astroid +typing-extensions==3.7.4.3 + # via importlib-metadata urllib3==1.26.4 # via requests virtualenv==20.4.3 @@ -168,7 +180,9 @@ wheel==0.36.2 wrapt==1.12.1 # via astroid zipp==3.4.1 - # via importlib-metadata + # via + # importlib-metadata + # pep517 # The following packages are considered to be unsafe in a requirements file: # pip diff --git a/setup.cfg b/setup.cfg index 7659ea9..5463c6f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -18,7 +18,7 @@ long_description = file: README.rst long_description_content_type = text/x-rst keywords = crcengine crc cyclic redundancy check checksum code-generation Castagnoli CRC32 CRC16-CCITT url = https://github.com/GardenTools/crcengine -version = attr: crcengine.version.__version__ +version = file: VERSION.txt project_urls = Changelog = https://github.com/GardenTools/CrcEngine/blob/master/CHANGES.rst Documentation = https://crcengine.readthedocs.io/en/latest/ @@ -37,6 +37,7 @@ package_dir = packages = crcengine install_requires = + importlib-metadata>=3.6 jinja2>=2.7 [options.entry_points] diff --git a/src/crcengine/__init__.py b/src/crcengine/__init__.py index dd1ed02..15f0c88 100644 --- a/src/crcengine/__init__.py +++ b/src/crcengine/__init__.py @@ -18,6 +18,9 @@ # You should have received a copy of the GNU General Public License # along with crcengine. If not, see . +import importlib_metadata + +__version__ = importlib_metadata.version('crcengine') from .algorithms import ( AlgorithmNotFoundError, @@ -36,5 +39,5 @@ get_bits_max_value, new, ) -from .codegen import generate_code, generate_test -from .version import __version__ +from crcengine.codegen import generate_code, generate_test + diff --git a/src/crcengine/codegen.py b/src/crcengine/codegen.py index 400a88a..c936534 100644 --- a/src/crcengine/codegen.py +++ b/src/crcengine/codegen.py @@ -31,7 +31,7 @@ from .algorithms import get_algorithm_params from .calc import create_lsb_table, create_msb_table -from .version import __version__ as crcengine_version +from crcengine import __version__ as crcengine_version # Generated file information _GenFile = namedtuple("GenFile", ["template", "output"]) diff --git a/tests/conftest.py b/tests/conftest.py index 18b1d83..a14cf58 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -16,7 +16,6 @@ def pytest_configure(config): def pytest_collection_modifyitems(config, items): # If a test has the needs_ceedling marker and no-ceedling has been specified # mark it as a skipped test - print("beep") if config.getoption("--no-ceedling"): print("no ceedling") skip_ceedling = pytest.mark.skip(reason="--no-ceedling specified") diff --git a/tests/test_crcengine.py b/tests/test_crcengine.py index 00c15f5..b741b95 100644 --- a/tests/test_crcengine.py +++ b/tests/test_crcengine.py @@ -1,4 +1,4 @@ -"""Unit tests for the crcengine module""" +"""Unit tests for the calc module""" # This file is part of crcengine. # # crcengine is free software: you can redistribute it an d /or modify @@ -210,3 +210,4 @@ def test_custom_algorithm(): assert "mycrc8" not in crcengine.algorithms_available() with pytest.raises(crcengine.AlgorithmNotFoundError): crcengine.get_algorithm_params("mycrc8") + diff --git a/src/crcengine/version.py b/tests/test_version.py similarity index 66% rename from src/crcengine/version.py rename to tests/test_version.py index 3bde636..50d11b4 100644 --- a/src/crcengine/version.py +++ b/tests/test_version.py @@ -1,9 +1,5 @@ -""" -CrcEngine package version number definition -""" -# This file is part of CrcEngine, a python library for CRC calculation -# -# Copyright 2021 Garden Tools software +"""Unit tests for version number reporting""" +# This file is part of crcengine. # # crcengine is free software: you can redistribute it an d /or modify # it under the terms of the GNU General Public License as published by @@ -18,4 +14,13 @@ # You should have received a copy of the GNU General Public License # along with crcengine. If not, see . -__version__ = "0.3.2a1" +import packaging.version + +import crcengine + +def test_version(): + pkg_ver = packaging.version.parse(crcengine.__version__) + ref_ver = packaging.version.parse("0.3.0") + print(pkg_ver) + print(ref_ver) + assert pkg_ver > ref_ver