diff --git a/.github/workflows/check-style.yaml b/.github/workflows/check-style.yaml new file mode 100644 index 0000000..95254c0 --- /dev/null +++ b/.github/workflows/check-style.yaml @@ -0,0 +1,27 @@ +name: Check Python Style +on: [pull_request] + +jobs: + python-style-check: + strategy: + matrix: + path: + - fred-mlambda + name: Python Style Check for ${{ matrix.path }} + runs-on: ubuntu-latest + steps: + - name: Clone Repo + uses: actions/checkout@v4 + with: + submodules: true + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Install Requirements + run: | + python -m pip install --upgrade pip + python -m pip install -r requirements-develop.txt + - name: Execute Style Check + run: | + bash check-style.sh ${{ matrix.path }} diff --git a/.github/workflows/check-tests.yaml b/.github/workflows/check-tests.yaml new file mode 100644 index 0000000..72f2fd1 --- /dev/null +++ b/.github/workflows/check-tests.yaml @@ -0,0 +1,30 @@ +name: Check Unit-Tests and Simple Coverage Report +on: [pull_request] + +jobs: + python-unit-testing: + strategy: + matrix: + path: + - fred-mlambda + name: Unit-Test Check for ${{ matrix.path }} + runs-on: ubuntu-latest + steps: + - name: Clone Repo + uses: actions/checkout@v4 + with: + submodules: true + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Install Requirements + run: | + python -m pip install --upgrade pip + python -m pip install -r requirements-develop.txt + - name: Install Package + run: python -m pip install -e ./${{ matrix.path }} + - name: Execute Unit-Tests + run: | + bash tests-unit.sh ${{ matrix.path }} + bash tests-coverage.sh ${{ matrix.path }} diff --git a/.github/workflows/check-types.yaml b/.github/workflows/check-types.yaml new file mode 100644 index 0000000..8bfaf08 --- /dev/null +++ b/.github/workflows/check-types.yaml @@ -0,0 +1,29 @@ +name: Check Python Types +on: [pull_request] + +jobs: + python-unit-testing: + strategy: + matrix: + path: + - fred-mlambda + name: Python Types Check for ${{ matrix.path }} + runs-on: ubuntu-latest + steps: + - name: Clone Repo + uses: actions/checkout@v4 + with: + submodules: true + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Install Requirements + run: | + python -m pip install --upgrade pip + python -m pip install -r requirements-develop.txt + - name: Install Package + run: python -m pip install -e ./${{ matrix.path }} + - name: Execute Type Checks + run: | + bash check-types.sh ${{ matrix.path }} diff --git a/.github/workflows/check-wheel.yaml b/.github/workflows/check-wheel.yaml new file mode 100644 index 0000000..dfcd1ff --- /dev/null +++ b/.github/workflows/check-wheel.yaml @@ -0,0 +1,31 @@ +name: Check Creation of Wheel Package +on: [pull_request] + +jobs: + python-wheel-check: + strategy: + matrix: + path: + - fred-mlambda + name: Wheel Package Check for ${{ matrix.path }} + runs-on: ubuntu-latest + steps: + - name: Clone Repo + uses: actions/checkout@v4 + with: + submodules: true + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Install Requirements + run: | + python -m pip install --upgrade pip + python -m pip install setuptools wheel + - name: Create Wheel Package + run: (cd ${{ matrix.path }}; python setup.py bdist_wheel) + - name: Install Wheel Package + run: python -m pip install ${{ matrix.path }}/dist/fred*.whl + - name: Execute Simple Command to Verify Installation + run: | + python -c "from fred.mlambda.version import version; print(version)" \ No newline at end of file diff --git a/.github/workflows/package-publish.yaml b/.github/workflows/package-publish.yaml new file mode 100644 index 0000000..b02cf7f --- /dev/null +++ b/.github/workflows/package-publish.yaml @@ -0,0 +1,43 @@ +name: Python Package Publish + +on: + pull_request: + paths: + - .github/workflows/package-publish.yaml + - fred-mlambda/** + types: + - closed + branches: + - main + +jobs: + python-publish: + environment: PYPI Package Publishing + strategy: + matrix: + path: + - fred-mlambda + if: github.event.pull_request.merged == true + name: Python Package Build and Publish for ${{ matrix.path }} + runs-on: ubuntu-latest + steps: + - name: Clone Repo + uses: actions/checkout@v4 + with: + submodules: true + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Install Twine + run: | + python -m pip install --upgrade pip + python -m pip install setuptools wheel twine + - name: Build and Publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + GH_BRANCH: ${{ github.ref }} + run: | + (cd ${{ matrix.path }}; python setup.py sdist) + twine upload --verbose --skip-existing ${{ matrix.path }}/dist/* diff --git a/check-style.sh b/check-style.sh new file mode 100644 index 0000000..d7357b8 --- /dev/null +++ b/check-style.sh @@ -0,0 +1 @@ +pycodestyle ${1} --max-line-length 120 \ No newline at end of file diff --git a/check-types.sh b/check-types.sh new file mode 100644 index 0000000..f4ca9f9 --- /dev/null +++ b/check-types.sh @@ -0,0 +1 @@ +mypy ${1} --ignore-missing-imports --install-types --non-interactive \ No newline at end of file diff --git a/fred-mlambda/MANIFEST.in b/fred-mlambda/MANIFEST.in new file mode 100644 index 0000000..1351bb0 --- /dev/null +++ b/fred-mlambda/MANIFEST.in @@ -0,0 +1,2 @@ +include requirements.txt +include src/main/fred/mlambda/version diff --git a/fred-mlambda/README.md b/fred-mlambda/README.md new file mode 100644 index 0000000..db7178c --- /dev/null +++ b/fred-mlambda/README.md @@ -0,0 +1 @@ +# FRED MLAMBDA diff --git a/fred-mlambda/requirements.txt b/fred-mlambda/requirements.txt new file mode 100644 index 0000000..1a3c8c5 --- /dev/null +++ b/fred-mlambda/requirements.txt @@ -0,0 +1,2 @@ +# Install the baseline fred-oss package +fred-oss==0.66.0 diff --git a/fred-mlambda/setup.py b/fred-mlambda/setup.py new file mode 100644 index 0000000..74eb269 --- /dev/null +++ b/fred-mlambda/setup.py @@ -0,0 +1,50 @@ +import os +import json +from typing import Dict, List +from setuptools import setup, find_namespace_packages + + +CODEBASE_PATH = os.environ.get( + "CODEBASE_PATH", + default=os.path.join("src", "main"), +) + +with open("requirements.txt", "r") as file: + requirements = [line for line in file.read().splitlines() if line and not line.startswith("#")] + +version_filepath = os.path.join(CODEBASE_PATH, "fred", "mlambda", "version") +with open(version_filepath, "r") as file: + version = file.read().strip() + + +with open("README.md") as file: + readme = file.read() + + +setup( + name="fred.mlambda", + version=version, + description="FRED-MLAMBDA", + long_description=readme, + long_description_content_type='text/markdown', + url="https://fred.fhr.tools", + author="Fahera Research, Education, and Development", + author_email="fred@fahera.mx", + packages=find_namespace_packages(where=CODEBASE_PATH), + package_dir={ + "": CODEBASE_PATH + }, + package_data={ + "": [ + version_filepath, + ] + }, + entry_points={ + "console_scripts": [ + "fred-mlambda=fred.mlambda.cli.main:CLI.cli_exec", + ] + }, + install_requires=requirements, + include_package_data=True, + python_requires=">=3.11", +) diff --git a/fred-mlambda/src/main/fred/mlambda/__init__.py b/fred-mlambda/src/main/fred/mlambda/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/fred-mlambda/src/main/fred/mlambda/version b/fred-mlambda/src/main/fred/mlambda/version new file mode 100644 index 0000000..6c6aa7c --- /dev/null +++ b/fred-mlambda/src/main/fred/mlambda/version @@ -0,0 +1 @@ +0.1.0 \ No newline at end of file diff --git a/fred-mlambda/src/main/fred/mlambda/version.py b/fred-mlambda/src/main/fred/mlambda/version.py new file mode 100644 index 0000000..9687f09 --- /dev/null +++ b/fred-mlambda/src/main/fred/mlambda/version.py @@ -0,0 +1,9 @@ +import os + +from fred.version import Version + + +version = Version.from_path( + name="fred.mlambda", + dirpath=os.path.dirname(__file__) +) diff --git a/fred-mlambda/src/test/test_fred/test_mlambda/test_version.py b/fred-mlambda/src/test/test_fred/test_mlambda/test_version.py new file mode 100644 index 0000000..789c11e --- /dev/null +++ b/fred-mlambda/src/test/test_fred/test_mlambda/test_version.py @@ -0,0 +1,5 @@ +from fred.mlambda.version import version + + +def test_version(): + assert isinstance(version.value, str) diff --git a/requirements-develop.txt b/requirements-develop.txt new file mode 100644 index 0000000..a104915 --- /dev/null +++ b/requirements-develop.txt @@ -0,0 +1,12 @@ +pycodestyle==2.14.0 +pytest==8.4.1 +coverage==7.10.6 +cookiecutter==2.6.0 +mypy==1.17.1 +mypy-extensions==1.1.0 +typing_extensions==4.15.0 +typed-ast==1.5.5 +scalene==1.5.54 +ipython==9.4.0 +jupyter==1.1.1 +streamlit==1.49.1 diff --git a/tests-coverage.sh b/tests-coverage.sh new file mode 100644 index 0000000..1e76bc6 --- /dev/null +++ b/tests-coverage.sh @@ -0,0 +1 @@ +(cd ${1}; coverage report --omit="test_*","*_remote_module_non_scriptable.py") \ No newline at end of file diff --git a/tests-unit.sh b/tests-unit.sh new file mode 100644 index 0000000..d96e810 --- /dev/null +++ b/tests-unit.sh @@ -0,0 +1 @@ +(cd ${1}; coverage run -m pytest src/test) \ No newline at end of file