diff --git a/.github/workflows/PR_test.yml b/.github/workflows/PR_test.yml index f1b57df..2689ee5 100644 --- a/.github/workflows/PR_test.yml +++ b/.github/workflows/PR_test.yml @@ -17,18 +17,20 @@ jobs: uses: actions/setup-python@v4 with: python-version: '3.10.5' - + - name: Ensure VERSION file exists + run: | + if [ ! -f VERSION ]; then echo "0.1.0" > VERSION; fi - name: Install Python dependencies run: | pip install -e .[test] # Install dependencies, including testing requirements - name: install pytest coverage run: | - pip install -e .[test] pytest-cov # Ensure pytest-cov is installed + pip install pytest-cov # Ensure pytest-cov is installed - name: Run Flake8 for PEP8 compliance run: | - flake8 --count src # Check code for PEP8 compliance in the 'src' directory + flake8 --count elabforms # Check code for PEP8 compliance in the 'src' directory - name: Run pytest for unit tests run: | - pytest --cov=src tests/ # Run unit tests and measure coverage \ No newline at end of file + pytest --cov=elabforms tests/ # Run unit tests and measure coverage \ No newline at end of file diff --git a/VERSION b/VERSION index 8a9ecc2..99d85ec 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.0.1 \ No newline at end of file +0.0.6 \ No newline at end of file diff --git a/src/__init__.py b/elabforms/__init__.py similarity index 100% rename from src/__init__.py rename to elabforms/__init__.py diff --git a/src/cli.py b/elabforms/cli.py similarity index 93% rename from src/cli.py rename to elabforms/cli.py index bd92b53..da50176 100644 --- a/src/cli.py +++ b/elabforms/cli.py @@ -1,5 +1,5 @@ import sys -from template_builder import TemplateBuilder +from .template_builder import TemplateBuilder def main(): diff --git a/src/generate_templates.py b/elabforms/generate_templates.py similarity index 100% rename from src/generate_templates.py rename to elabforms/generate_templates.py diff --git a/src/template.py b/elabforms/template.py similarity index 100% rename from src/template.py rename to elabforms/template.py diff --git a/src/template_builder.py b/elabforms/template_builder.py similarity index 97% rename from src/template_builder.py rename to elabforms/template_builder.py index f4d636a..85993e1 100644 --- a/src/template_builder.py +++ b/elabforms/template_builder.py @@ -1,7 +1,7 @@ import os import csv -from template_part import TemplatePart -from template import Template +from .template_part import TemplatePart +from .template import Template class TemplateBuilder: diff --git a/src/template_part.py b/elabforms/template_part.py similarity index 98% rename from src/template_part.py rename to elabforms/template_part.py index b8a8632..09456e7 100644 --- a/src/template_part.py +++ b/elabforms/template_part.py @@ -1,4 +1,4 @@ -from template import Template +from .template import Template class TemplatePart(Template): diff --git a/requirements.txt b/requirements.txt index 62db677..1958c8d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -pytest~=7.4.4 +#pytest~=7.4.4 gitpython PyYAML~=6.0.1 setuptools~=68.2.0 diff --git a/setup.py b/setup.py index cad7529..6bfb2d7 100644 --- a/setup.py +++ b/setup.py @@ -1,38 +1,35 @@ from setuptools import setup, find_packages import os -with open(os.path.join(os.path.dirname(__file__), "VERSION")) as version_file: +root_dir = os.path.abspath(os.path.dirname(__file__)) + +with open(os.path.join(root_dir, "VERSION")) as version_file: version = version_file.read().strip() -with open('requirements.txt') as f: +with open(os.path.join(root_dir, 'requirements.txt')) as f: requires = f.read().splitlines() -with open('README.md') as f: +with open(os.path.join(root_dir, 'README.md')) as f: long_description = f.read() setup( name="elabforms", version=version, - packages=find_packages(where="src"), - package_dir={"": "src"}, - package_data={ - "": ["*.json", "*.csv", "*.zip"], - }, - data_files=[('elabforms', ['VERSION', 'README.md', 'requirements.txt'])], - author=" Fatai Idrissou, Sylvain Takerkart", + packages=find_packages(where="."), + author="Fatai Idrissou, Sylvain Takerkart", description="A set of tools to create and manage standardized forms for eLabFTW", - long_description_content_type="text/markdown", long_description=long_description, + long_description_content_type="text/markdown", license='MIT', install_requires=requires, include_package_data=True, python_requires='>=3.8', extras_require={ - 'test': ['pytest', 'flake8'], # Added flake8 for code style checking + 'test': ['pytest', 'flake8'], }, entry_points={ "console_scripts": [ - "eform=src.cli:main" + "eform=elabforms.cli:main" ], }, ) diff --git a/src/exemple.py b/src/exemple.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/test_exemple.py b/tests/test_exemple.py deleted file mode 100644 index 277b906..0000000 --- a/tests/test_exemple.py +++ /dev/null @@ -1,2 +0,0 @@ -def test_addition(): - assert 1+1 ==2 \ No newline at end of file diff --git a/tests/test_template.py b/tests/test_template.py index 28c55db..db3fd54 100644 --- a/tests/test_template.py +++ b/tests/test_template.py @@ -4,7 +4,7 @@ import sys -from template import Template # noqa: E402 +from elabforms.template import Template # noqa: E402 class TestTemplate(unittest.TestCase): @@ -113,4 +113,4 @@ def test_add_template_part(self): if __name__ == "__main__": - unittest.main() + unittest.main() \ No newline at end of file diff --git a/tests/test_template_builder.py b/tests/test_template_builder.py index 317b381..c8cdedd 100644 --- a/tests/test_template_builder.py +++ b/tests/test_template_builder.py @@ -4,10 +4,10 @@ import json import sys # sys.path.insert(0, os.path.abspath( -# os.path.join(os.path.dirname(__file__), '../src'))) -from template_builder import TemplateBuilder -from template_part import TemplatePart -from template import Template +# os.path.join(os.path.dirname(__file__), '../elabforms'))) +from elabforms.template_builder import TemplateBuilder +from elabforms.template_part import TemplatePart +from elabforms.template import Template class TestTemplateBuilder(unittest.TestCase): @@ -102,4 +102,4 @@ def test_build_template(self): if __name__ == "__main__": - unittest.main() + unittest.main() \ No newline at end of file diff --git a/tests/test_template_part.py b/tests/test_template_part.py index 90c2c39..77c3b91 100644 --- a/tests/test_template_part.py +++ b/tests/test_template_part.py @@ -4,9 +4,9 @@ import sys # sys.path.insert(0, os.path.abspath( -# os.path.join(os.path.dirname(__file__), '../src'))) +# os.path.join(os.path.dirname(__file__), '../elabforms'))) -from template_part import TemplatePart +from elabforms.template_part import TemplatePart class TestTemplatePart(unittest.TestCase): @@ -82,4 +82,4 @@ def test_set_content_id(self): if __name__ == "__main__": - unittest.main() + unittest.main() \ No newline at end of file