diff --git a/docs/conf.py b/docs/conf.py index e7f59acb6c6e1c24baa67cf3fe401be1fe39b9a6..c4d58781157c666681326a572d17daf33c13d3ec 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -10,11 +10,15 @@ import sys sys.path.insert(0, os.path.abspath("..")) +# read the version from version.txt +with open(os.path.join("../sample_project_ivi", "version.txt"), encoding="utf-8") as file_handler: + __version__ = file_handler.read().strip() -project = "sample_project" + +project = "sample_project_ivi" copyright = "2024, Harisankar Babu" author = "Harisankar Babu" -release = "0.0.1" +release = __version__ # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration diff --git a/docs/index.rst b/docs/index.rst index 290a60c859a59956963503ba07c6a1f35a46ce4f..3e1115ecde2a0c877c5d57a881885784c3fe6391 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,9 +1,9 @@ -.. sample_project documentation master file, created by +.. sample_project_ivi documentation master file, created by sphinx-quickstart on Thu Mar 14 15:19:00 2024. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. -Welcome to sample_project's documentation! +Welcome to sample_project_ivi's documentation! ========================================== .. toctree:: diff --git a/docs/modules.rst b/docs/modules.rst index 76d4c13d5a0a16adb67641d9906affe7502203dc..1e7f8fe7cf88b3d919b05ec2456acf348edcc5b3 100644 --- a/docs/modules.rst +++ b/docs/modules.rst @@ -1,7 +1,7 @@ -sample_project +sample_project_ivi ============== .. toctree:: :maxdepth: 4 - sample_project + sample_project_ivi diff --git a/docs/sample_project.rst b/docs/sample_project.rst index 98110e2998c2c0f89915cc961a6dbf2a11a8111c..6370e5aa3711859a737973ca9932700a344edbea 100644 --- a/docs/sample_project.rst +++ b/docs/sample_project.rst @@ -1,7 +1,7 @@ sample\_project package ======================= -.. automodule:: sample_project +.. automodule:: sample_project_ivi :members: :undoc-members: :show-inheritance: @@ -12,7 +12,7 @@ Submodules sample\_project.src module -------------------------- -.. automodule:: sample_project.src +.. automodule:: sample_project_ivi.src :members: :undoc-members: :show-inheritance: diff --git a/sample_project/__init__.py b/sample_project/__init__.py deleted file mode 100644 index 6651514bdea1ac5e5a5eeb67762270053acb56c0..0000000000000000000000000000000000000000 --- a/sample_project/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from .src import calculate_mean, print_mean - -__all__ = ["calculate_mean", "print_mean"] diff --git a/sample_project_ivi/__init__.py b/sample_project_ivi/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..87c5b3d793f8618b48d201f4a8228d3ea87ce5a8 --- /dev/null +++ b/sample_project_ivi/__init__.py @@ -0,0 +1,9 @@ +import os + +from .src import calculate_mean, print_mean + +__all__ = ["calculate_mean", "print_mean"] + +# read the version from version.txt +with open(os.path.join(os.path.dirname(__file__), "version.txt"), encoding="utf-8") as file_handler: + __version__ = file_handler.read().strip() diff --git a/sample_project/src.py b/sample_project_ivi/src.py similarity index 100% rename from sample_project/src.py rename to sample_project_ivi/src.py diff --git a/sample_project_ivi/version.txt b/sample_project_ivi/version.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a9ecc2ea99d607e92feae1656ddbf6fdd82a2c1 --- /dev/null +++ b/sample_project_ivi/version.txt @@ -0,0 +1 @@ +0.0.1 \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 45bd411dab60161b01fc960b0f0cd91d4a931736..e65e6479087028a4861575fc937c7481cdc03748 100644 --- a/setup.cfg +++ b/setup.cfg @@ -12,10 +12,10 @@ filterwarnings = [isort] profile = black line_length = 120 -src_paths = sample_project, tests +src_paths = sample_project_ivi, tests [coverage:run] -source = sample_project +source = sample_project_ivi [coverage:report] show_missing = True diff --git a/setup.py b/setup.py index 5706a49a052fcaf7894a2a516dfe09870117cbd2..a1f3a245e5f34a66ec1d806802e7f78ddddd5a23 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,15 @@ +import os + from setuptools import find_packages, setup +# read the version from version.txt +with open(os.path.join("sample_project_ivi", "version.txt"), encoding="utf-8") as file_handler: + __version__ = file_handler.read().strip() + + setup( - name="sample_project", - version="0.0.1", + name="sample_project_ivi", + version=__version__, description="A sample project to demonstrate packaging and testing.", author="Harisankar Babu", author_email="harisankar.babu@ivi.fraunhofer.de", @@ -17,7 +24,9 @@ setup( "Operating System :: OS Independent", "Programming Language :: Python :: 3.8", ], - packages=[package for package in find_packages() if package.startswith("sample_project")], + packages=[package for package in find_packages() if package.startswith("sample_project_ivi")], + # by default find packages will only include python files, so we need to manually add the version.txt file + package_data={"sample_project_ivi": ["version.txt"]}, install_requires=[ # tada! no external dependencies ], diff --git a/tests/test_src.py b/tests/test_src.py index 68bbdb0da0b050c2de24abd29401b510f88a3105..8046e271955f543faae4b26c9b1298356338be77 100644 --- a/tests/test_src.py +++ b/tests/test_src.py @@ -1,6 +1,5 @@ import pytest - -from sample_project import calculate_mean, print_mean +from sample_project_ivi import calculate_mean, print_mean def test_calculate_mean_normal_operation(): diff --git a/tox.ini b/tox.ini index da253f8d83047e7c1dd7a7dcd9aad7a8f5279c4e..214f584bf4b8f5ebb16f86d86a34055facff56aa 100644 --- a/tox.ini +++ b/tox.ini @@ -9,7 +9,7 @@ deps = pytest pytest-cov coverage -commands = pytest --cov-report term-missing --cov-config=setup.cfg --cov=sample_project --cov-append tests/ +commands = pytest --cov-report term-missing --cov-config=setup.cfg --cov=sample_project_ivi --cov-append tests/ [testenv:clean] description = remove all build, test, coverage and Python artifacts