From fac51bb698a668bb32b3410ec80820e0c4a76b11 Mon Sep 17 00:00:00 2001 From: Hari <harisankar995@gmail.com> Date: Thu, 14 Mar 2024 17:41:47 +0100 Subject: [PATCH] Updated project name --- docs/conf.py | 8 ++++++-- docs/index.rst | 4 ++-- docs/modules.rst | 4 ++-- docs/sample_project.rst | 4 ++-- sample_project/__init__.py | 3 --- sample_project_ivi/__init__.py | 9 +++++++++ {sample_project => sample_project_ivi}/src.py | 0 sample_project_ivi/version.txt | 1 + setup.cfg | 4 ++-- setup.py | 15 ++++++++++++--- tests/test_src.py | 3 +-- tox.ini | 2 +- 12 files changed, 38 insertions(+), 19 deletions(-) delete mode 100644 sample_project/__init__.py create mode 100644 sample_project_ivi/__init__.py rename {sample_project => sample_project_ivi}/src.py (100%) create mode 100644 sample_project_ivi/version.txt diff --git a/docs/conf.py b/docs/conf.py index e7f59ac..c4d5878 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 290a60c..3e1115e 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 76d4c13..1e7f8fe 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 98110e2..6370e5a 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 6651514..0000000 --- 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 0000000..87c5b3d --- /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 0000000..8a9ecc2 --- /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 45bd411..e65e647 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 5706a49..a1f3a24 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 68bbdb0..8046e27 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 da253f8..214f584 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 -- GitLab