From b59edc543ce1fbca53f8a66ed920d5f36e0201b3 Mon Sep 17 00:00:00 2001 From: JarbasAI <33701864+JarbasAl@users.noreply.github.com> Date: Fri, 25 Feb 2022 04:33:28 +0000 Subject: [PATCH] feat/workflows (#18) authored-by: jarbasai --- .github/workflows/build_tests.yml | 16 +++ .github/workflows/dev2master.yml | 20 +++ .github/workflows/license_tests.yml | 12 +- .github/workflows/publish_alpha.yml | 72 ++++++++++ .github/workflows/publish_build.yml | 76 +++++++++++ .github/workflows/publish_major.yml | 76 +++++++++++ .github/workflows/publish_minor.yml | 76 +++++++++++ .github/workflows/pytest.yml | 97 -------------- .github/workflows/unit_tests.yml | 66 ++++++++++ .gitignore | 123 +++--------------- MANIFEST.in | 8 +- .../{version/__init__.py => version.py} | 11 -- .../requirements.txt | 0 version_bump.py => scripts/bump_alpha.py | 3 +- scripts/bump_build.py | 21 +++ scripts/bump_major.py | 27 ++++ scripts/bump_minor.py | 24 ++++ scripts/remove_alpha.py | 13 ++ setup.py | 10 +- test/test_licenses.py | 53 -------- test/{ => unittests}/__init__.py | 0 test/{ => unittests}/test_format.py | 0 test/{ => unittests}/test_format_ca.py | 0 test/{ => unittests}/test_format_cs.py | 0 test/{ => unittests}/test_format_da.py | 0 test/{ => unittests}/test_format_de.py | 0 test/{ => unittests}/test_format_en.py | 0 test/{ => unittests}/test_format_es.py | 0 test/{ => unittests}/test_format_fa.py | 0 test/{ => unittests}/test_format_fr.py | 0 test/{ => unittests}/test_format_hu.py | 0 test/{ => unittests}/test_format_it.py | 0 test/{ => unittests}/test_format_nl.py | 0 test/{ => unittests}/test_format_pl.py | 0 test/{ => unittests}/test_format_pt.py | 0 test/{ => unittests}/test_format_ru.py | 0 test/{ => unittests}/test_format_sl.py | 0 test/{ => unittests}/test_format_sv.py | 0 test/{ => unittests}/test_localizer.py | 0 test/{ => unittests}/test_parse.py | 0 test/{ => unittests}/test_parse_ca.py | 0 test/{ => unittests}/test_parse_cs.py | 0 test/{ => unittests}/test_parse_da.py | 0 test/{ => unittests}/test_parse_de.py | 0 test/{ => unittests}/test_parse_en.py | 0 test/{ => unittests}/test_parse_es.py | 0 test/{ => unittests}/test_parse_fa.py | 0 test/{ => unittests}/test_parse_fr.py | 0 test/{ => unittests}/test_parse_it.py | 0 test/{ => unittests}/test_parse_nl.py | 0 test/{ => unittests}/test_parse_pl.py | 0 test/{ => unittests}/test_parse_pt.py | 0 test/{ => unittests}/test_parse_ru.py | 0 test/{ => unittests}/test_parse_sv.py | 0 54 files changed, 522 insertions(+), 282 deletions(-) create mode 100644 .github/workflows/dev2master.yml create mode 100644 .github/workflows/publish_alpha.yml create mode 100644 .github/workflows/publish_build.yml create mode 100644 .github/workflows/publish_major.yml create mode 100644 .github/workflows/publish_minor.yml delete mode 100644 .github/workflows/pytest.yml create mode 100644 .github/workflows/unit_tests.yml rename lingua_franca/{version/__init__.py => version.py} (53%) rename requirements.txt => requirements/requirements.txt (100%) rename version_bump.py => scripts/bump_alpha.py (83%) create mode 100644 scripts/bump_build.py create mode 100644 scripts/bump_major.py create mode 100644 scripts/bump_minor.py create mode 100644 scripts/remove_alpha.py delete mode 100644 test/test_licenses.py rename test/{ => unittests}/__init__.py (100%) rename test/{ => unittests}/test_format.py (100%) rename test/{ => unittests}/test_format_ca.py (100%) rename test/{ => unittests}/test_format_cs.py (100%) rename test/{ => unittests}/test_format_da.py (100%) rename test/{ => unittests}/test_format_de.py (100%) rename test/{ => unittests}/test_format_en.py (100%) rename test/{ => unittests}/test_format_es.py (100%) rename test/{ => unittests}/test_format_fa.py (100%) rename test/{ => unittests}/test_format_fr.py (100%) rename test/{ => unittests}/test_format_hu.py (100%) rename test/{ => unittests}/test_format_it.py (100%) rename test/{ => unittests}/test_format_nl.py (100%) rename test/{ => unittests}/test_format_pl.py (100%) rename test/{ => unittests}/test_format_pt.py (100%) rename test/{ => unittests}/test_format_ru.py (100%) rename test/{ => unittests}/test_format_sl.py (100%) rename test/{ => unittests}/test_format_sv.py (100%) rename test/{ => unittests}/test_localizer.py (100%) rename test/{ => unittests}/test_parse.py (100%) rename test/{ => unittests}/test_parse_ca.py (100%) rename test/{ => unittests}/test_parse_cs.py (100%) rename test/{ => unittests}/test_parse_da.py (100%) rename test/{ => unittests}/test_parse_de.py (100%) rename test/{ => unittests}/test_parse_en.py (100%) rename test/{ => unittests}/test_parse_es.py (100%) rename test/{ => unittests}/test_parse_fa.py (100%) rename test/{ => unittests}/test_parse_fr.py (100%) rename test/{ => unittests}/test_parse_it.py (100%) rename test/{ => unittests}/test_parse_nl.py (100%) rename test/{ => unittests}/test_parse_pl.py (100%) rename test/{ => unittests}/test_parse_pt.py (100%) rename test/{ => unittests}/test_parse_ru.py (100%) rename test/{ => unittests}/test_parse_sv.py (100%) diff --git a/.github/workflows/build_tests.yml b/.github/workflows/build_tests.yml index c982751c..34fcc91f 100644 --- a/.github/workflows/build_tests.yml +++ b/.github/workflows/build_tests.yml @@ -1,6 +1,22 @@ name: Run Build Tests on: push: + branches: + - master + pull_request: + branches: + - dev + paths-ignore: + - 'lingua_franca/version.py' + - 'test/**' + - 'examples/**' + - '.github/**' + - '.gitignore' + - 'LICENSE' + - 'CHANGELOG.md' + - 'MANIFEST.in' + - 'readme.md' + - 'scripts/**' workflow_dispatch: jobs: diff --git a/.github/workflows/dev2master.yml b/.github/workflows/dev2master.yml new file mode 100644 index 00000000..cc76fee2 --- /dev/null +++ b/.github/workflows/dev2master.yml @@ -0,0 +1,20 @@ +# This workflow will generate a distribution and upload it to PyPI + +name: Push dev -> master +on: + workflow_dispatch: + +jobs: + build_and_publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. + ref: dev + - name: Push dev -> master + uses: ad-m/github-push-action@master + + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: master \ No newline at end of file diff --git a/.github/workflows/license_tests.yml b/.github/workflows/license_tests.yml index 561e7734..f13366e9 100644 --- a/.github/workflows/license_tests.yml +++ b/.github/workflows/license_tests.yml @@ -1,6 +1,14 @@ name: Run License Tests on: push: + branches: + - master + pull_request: + branches: + - dev + paths: + - 'requirements/**' + - 'setup.py' workflow_dispatch: jobs: @@ -17,10 +25,6 @@ jobs: - name: Install Build Tools run: | python -m pip install build wheel - - name: Install System Dependencies - run: | - sudo apt-get update - sudo apt install python3-dev swig libssl-dev - name: Install core repo run: | pip install . diff --git a/.github/workflows/publish_alpha.yml b/.github/workflows/publish_alpha.yml new file mode 100644 index 00000000..39359d76 --- /dev/null +++ b/.github/workflows/publish_alpha.yml @@ -0,0 +1,72 @@ +# This workflow will generate a distribution and upload it to PyPI + +name: Publish Alpha Build ...aX +on: + push: + branches: + - dev + paths-ignore: + - 'lingua_franca/version.py' + - 'test/**' + - 'examples/**' + - '.github/**' + - '.gitignore' + - 'LICENSE' + - 'CHANGELOG.md' + - 'MANIFEST.in' + - 'readme.md' + - 'scripts/**' + workflow_dispatch: + +jobs: + build_and_publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: dev + fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. + - name: Setup Python + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - name: Install Build Tools + run: | + python -m pip install build wheel + - name: Increment Version + run: | + VER=$(python setup.py --version) + python scripts/bump_alpha.py + - name: "Generate release changelog" + uses: heinrichreimer/github-changelog-generator-action@v2.3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + id: changelog + - name: Commit to dev + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Increment Version + branch: dev + - name: version + run: echo "::set-output name=version::$(python setup.py --version)" + id: version + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: V${{ steps.version.outputs.version }} + release_name: Release ${{ steps.version.outputs.version }} + body: | + Changes in this Release + ${{ steps.changelog.outputs.changelog }} + draft: false + prerelease: true + - name: Build Distribution Packages + run: | + python setup.py bdist_wheel + - name: Publish to Test PyPI + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{secrets.PYPI_TOKEN}} \ No newline at end of file diff --git a/.github/workflows/publish_build.yml b/.github/workflows/publish_build.yml new file mode 100644 index 00000000..9fdcd309 --- /dev/null +++ b/.github/workflows/publish_build.yml @@ -0,0 +1,76 @@ +# This workflow will generate a distribution and upload it to PyPI + +name: Publish Build Release ..X +on: + workflow_dispatch: + +jobs: + build_and_publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: dev + fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. + - name: Setup Python + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - name: Install Build Tools + run: | + python -m pip install build wheel + - name: Remove alpha (declare stable) + run: | + VER=$(python setup.py --version) + python scripts/remove_alpha.py + - name: "Generate release changelog" + uses: heinrichreimer/github-changelog-generator-action@v2.3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + id: changelog + - name: Commit to dev + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Declare alpha stable + branch: dev + - name: Push dev -> master + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: master + force: true + - name: version + run: echo "::set-output name=version::$(python setup.py --version)" + id: version + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: V${{ steps.version.outputs.version }} + release_name: Release ${{ steps.version.outputs.version }} + body: | + Changes in this Release + ${{ steps.changelog.outputs.changelog }} + draft: false + prerelease: false + - name: Build Distribution Packages + run: | + python setup.py bdist_wheel + - name: Prepare next Build version + run: echo "::set-output name=version::$(python setup.py --version)" + id: alpha + - name: Increment Version ${{ steps.alpha.outputs.version }}Alpha0 + run: | + VER=$(python setup.py --version) + python scripts/bump_build.py + - name: Commit to dev + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Prepare Next Version + branch: dev + - name: Publish to Test PyPI + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{secrets.PYPI_TOKEN}} \ No newline at end of file diff --git a/.github/workflows/publish_major.yml b/.github/workflows/publish_major.yml new file mode 100644 index 00000000..87cee864 --- /dev/null +++ b/.github/workflows/publish_major.yml @@ -0,0 +1,76 @@ +# This workflow will generate a distribution and upload it to PyPI + +name: Publish Major Release X.0.0 +on: + workflow_dispatch: + +jobs: + build_and_publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: dev + fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. + - name: Setup Python + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - name: Install Build Tools + run: | + python -m pip install build wheel + - name: Remove alpha (declare stable) + run: | + VER=$(python setup.py --version) + python scripts/remove_alpha.py + - name: "Generate release changelog" + uses: heinrichreimer/github-changelog-generator-action@v2.3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + id: changelog + - name: Commit to dev + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Declare alpha stable + branch: dev + - name: Push dev -> master + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: master + force: true + - name: version + run: echo "::set-output name=version::$(python setup.py --version)" + id: version + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: V${{ steps.version.outputs.version }} + release_name: Release ${{ steps.version.outputs.version }} + body: | + Changes in this Release + ${{ steps.changelog.outputs.changelog }} + draft: false + prerelease: false + - name: Build Distribution Packages + run: | + python setup.py bdist_wheel + - name: Prepare next Major version + run: echo "::set-output name=version::$(python setup.py --version)" + id: alpha + - name: Increment Version ${{ steps.alpha.outputs.version }}Alpha0 + run: | + VER=$(python setup.py --version) + python scripts/bump_major.py + - name: Commit to dev + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Prepare Next Version + branch: dev + - name: Publish to Test PyPI + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{secrets.PYPI_TOKEN}} \ No newline at end of file diff --git a/.github/workflows/publish_minor.yml b/.github/workflows/publish_minor.yml new file mode 100644 index 00000000..4e8b2312 --- /dev/null +++ b/.github/workflows/publish_minor.yml @@ -0,0 +1,76 @@ +# This workflow will generate a distribution and upload it to PyPI + +name: Publish Minor Release .X.0 +on: + workflow_dispatch: + +jobs: + build_and_publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: dev + fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. + - name: Setup Python + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - name: Install Build Tools + run: | + python -m pip install build wheel + - name: Remove alpha (declare stable) + run: | + VER=$(python setup.py --version) + python scripts/remove_alpha.py + - name: "Generate release changelog" + uses: heinrichreimer/github-changelog-generator-action@v2.3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + id: changelog + - name: Commit to dev + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Declare alpha stable + branch: dev + - name: Push dev -> master + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: master + force: true + - name: version + run: echo "::set-output name=version::$(python setup.py --version)" + id: version + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: V${{ steps.version.outputs.version }} + release_name: Release ${{ steps.version.outputs.version }} + body: | + Changes in this Release + ${{ steps.changelog.outputs.changelog }} + draft: false + prerelease: false + - name: Build Distribution Packages + run: | + python setup.py bdist_wheel + - name: Prepare next Minor version + run: echo "::set-output name=version::$(python setup.py --version)" + id: alpha + - name: Increment Version ${{ steps.alpha.outputs.version }}Alpha0 + run: | + VER=$(python setup.py --version) + python scripts/bump_minor.py + - name: Commit to dev + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Prepare Next Version + branch: dev + - name: Publish to Test PyPI + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{secrets.PYPI_TOKEN}} \ No newline at end of file diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml deleted file mode 100644 index 70583264..00000000 --- a/.github/workflows/pytest.yml +++ /dev/null @@ -1,97 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: Pytest - -on: - push: - branches: [ master, dev ] - pull_request: - branches: [ dev ] - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.6, 3.7, 3.8, 3.9] - - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install pytest - pip install -r requirements.txt - - name: Test Base - run: | - pytest test/test_format.py - pytest test/test_parse.py - pytest test/test_localizer.py - - name: Test ca - run: | - pytest test/test_format_ca.py - pytest test/test_parse_ca.py - - name: Test cs - run: | - pytest test/test_format_cs.py - pytest test/test_parse_cs.py - - name: Test da - run: | - pytest test/test_format_da.py - pytest test/test_parse_da.py - - name: Test de - run: | - pytest test/test_format_de.py - pytest test/test_parse_de.py - - name: Test en - run: | - pytest test/test_format_en.py - pytest test/test_parse_en.py - - name: Test es - run: | - pytest test/test_format_es.py - pytest test/test_parse_es.py - - name: Test fa - run: | - pytest test/test_format_fa.py - pytest test/test_parse_fa.py - - name: Test fr - run: | - pytest test/test_format_fr.py - pytest test/test_parse_fr.py - - name: Test hu - run: | - pytest test/test_format_hu.py - - name: Test it - run: | - pytest test/test_format_it.py - pytest test/test_parse_it.py - - name: Test nl - run: | - pytest test/test_format_nl.py - pytest test/test_parse_nl.py - - name: Test pl - run: | - pytest test/test_format_pl.py - pytest test/test_parse_pl.py - - name: Test pt - run: | - pytest test/test_format_pt.py - pytest test/test_parse_pt.py - - name: Test ru - run: | - pytest test/test_format_ru.py - pytest test/test_parse_ru.py - - name: Test sl - run: | - pytest test/test_format_sl.py - - name: Test sv - run: | - pytest test/test_format_sv.py - pytest test/test_parse_sv.py diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml new file mode 100644 index 00000000..96f9484b --- /dev/null +++ b/.github/workflows/unit_tests.yml @@ -0,0 +1,66 @@ +name: Run UnitTests +on: + pull_request: + branches: + - dev + paths-ignore: + - 'lingua_franca/version.py' + - 'requirements/**' + - 'examples/**' + - '.github/**' + - '.gitignore' + - 'LICENSE' + - 'CHANGELOG.md' + - 'MANIFEST.in' + - 'readme.md' + - 'scripts/**' + push: + branches: + - master + paths-ignore: + - 'lingua_franca/version.py' + - 'requirements/**' + - 'examples/**' + - '.github/**' + - '.gitignore' + - 'LICENSE' + - 'CHANGELOG.md' + - 'MANIFEST.in' + - 'readme.md' + - 'scripts/**' + workflow_dispatch: + +jobs: + unit_tests: + strategy: + max-parallel: 2 + matrix: + python-version: [ 3.7, 3.8, 3.9, "3.10" ] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install System Dependencies + run: | + sudo apt-get update + sudo apt install python3-dev + python -m pip install build wheel + - name: Install core repo + run: | + pip install . + - name: Install test dependencies + run: | + pip install pytest pytest-timeout pytest-cov + - name: Run unittests + run: | + pytest --cov=lingua_franca --cov-report xml test/unittests + # NOTE: additional pytest invocations should also add the --cov-append flag + # or they will overwrite previous invocations' coverage reports + # (for an example, see OVOS Skill Manager's workflow) + - name: Upload coverage + env: + CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}} + uses: codecov/codecov-action@v2 diff --git a/.gitignore b/.gitignore index 632a9568..9595be50 100644 --- a/.gitignore +++ b/.gitignore @@ -1,109 +1,20 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ +dev.env +.dev_opts.json +.idea +*.code-workspace +*.pyc +*.swp +*~ *.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ +build +dist .coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -.hypothesis/ +/htmlcov +.installed +.mypy_cache +.vscode +.theia +.venv/ + +# Created by unit tests .pytest_cache/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# pyenv -.python-version - -# celery beat schedule file -celerybeat-schedule - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ - -# VSCod(e/ium) -.vscode/ -vscode/ -*.code-workspace diff --git a/MANIFEST.in b/MANIFEST.in index db899dcf..d191dcef 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,5 @@ +recursive-include lingua_franca/ * +recursive-include requirements/ * +include CHANGELOG.md include LICENSE -include readme.md -include requirements.txt -recursive-include test *.py -recursive-include lingua_franca/res * \ No newline at end of file +include readme.md \ No newline at end of file diff --git a/lingua_franca/version/__init__.py b/lingua_franca/version.py similarity index 53% rename from lingua_franca/version/__init__.py rename to lingua_franca/version.py index 60854aaa..9cd66266 100644 --- a/lingua_franca/version/__init__.py +++ b/lingua_franca/version.py @@ -1,18 +1,7 @@ # The following lines are replaced during the release process. # START_VERSION_BLOCK - VERSION_MAJOR = 0 VERSION_MINOR = 4 VERSION_BUILD = 3 VERSION_ALPHA = 3 - # END_VERSION_BLOCK - - -VERSION_TUPLE = (VERSION_MAJOR, - VERSION_MINOR, - VERSION_BUILD) -VERSION_STR = '.'.join(map(str, VERSION_TUPLE)) - - - diff --git a/requirements.txt b/requirements/requirements.txt similarity index 100% rename from requirements.txt rename to requirements/requirements.txt diff --git a/version_bump.py b/scripts/bump_alpha.py similarity index 83% rename from version_bump.py rename to scripts/bump_alpha.py index 3713e885..0d8a7328 100644 --- a/version_bump.py +++ b/scripts/bump_alpha.py @@ -2,8 +2,7 @@ from os.path import join, dirname -version_file = join(dirname(__file__), "lingua_franca", "version", - "__init__.py") +version_file = join(dirname(dirname(__file__)), "lingua_franca", "version.py") version_var_name = "VERSION_ALPHA" with open(version_file, "r", encoding="utf-8") as v: diff --git a/scripts/bump_build.py b/scripts/bump_build.py new file mode 100644 index 00000000..4b1ff26d --- /dev/null +++ b/scripts/bump_build.py @@ -0,0 +1,21 @@ +import fileinput +from os.path import join, dirname + + +version_file = join(dirname(dirname(__file__)), "lingua_franca", "version.py") +version_var_name = "VERSION_BUILD" +alpha_var_name = "VERSION_ALPHA" + +with open(version_file, "r", encoding="utf-8") as v: + for line in v.readlines(): + if line.startswith(version_var_name): + version = int(line.split("=")[-1]) + new_version = int(version) + 1 + +for line in fileinput.input(version_file, inplace=True): + if line.startswith(version_var_name): + print(f"{version_var_name} = {new_version}") + elif line.startswith(alpha_var_name): + print(f"{alpha_var_name} = 0") + else: + print(line.rstrip('\n')) diff --git a/scripts/bump_major.py b/scripts/bump_major.py new file mode 100644 index 00000000..0bb76a45 --- /dev/null +++ b/scripts/bump_major.py @@ -0,0 +1,27 @@ +import fileinput +from os.path import join, dirname + + +version_file = join(dirname(dirname(__file__)), "lingua_franca", "version.py") +version_var_name = "VERSION_MAJOR" +minor_var_name = "VERSION_MINOR" +build_var_name = "VERSION_BUILD" +alpha_var_name = "VERSION_ALPHA" + +with open(version_file, "r", encoding="utf-8") as v: + for line in v.readlines(): + if line.startswith(version_var_name): + version = int(line.split("=")[-1]) + new_version = int(version) + 1 + +for line in fileinput.input(version_file, inplace=True): + if line.startswith(version_var_name): + print(f"{version_var_name} = {new_version}") + elif line.startswith(minor_var_name): + print(f"{minor_var_name} = 0") + elif line.startswith(build_var_name): + print(f"{build_var_name} = 0") + elif line.startswith(alpha_var_name): + print(f"{alpha_var_name} = 0") + else: + print(line.rstrip('\n')) diff --git a/scripts/bump_minor.py b/scripts/bump_minor.py new file mode 100644 index 00000000..e1251a12 --- /dev/null +++ b/scripts/bump_minor.py @@ -0,0 +1,24 @@ +import fileinput +from os.path import join, dirname + + +version_file = join(dirname(dirname(__file__)), "lingua_franca", "version.py") +version_var_name = "VERSION_MINOR" +build_var_name = "VERSION_BUILD" +alpha_var_name = "VERSION_ALPHA" + +with open(version_file, "r", encoding="utf-8") as v: + for line in v.readlines(): + if line.startswith(version_var_name): + version = int(line.split("=")[-1]) + new_version = int(version) + 1 + +for line in fileinput.input(version_file, inplace=True): + if line.startswith(version_var_name): + print(f"{version_var_name} = {new_version}") + elif line.startswith(build_var_name): + print(f"{build_var_name} = 0") + elif line.startswith(alpha_var_name): + print(f"{alpha_var_name} = 0") + else: + print(line.rstrip('\n')) diff --git a/scripts/remove_alpha.py b/scripts/remove_alpha.py new file mode 100644 index 00000000..dd5939e0 --- /dev/null +++ b/scripts/remove_alpha.py @@ -0,0 +1,13 @@ +import fileinput +from os.path import join, dirname + + +version_file = join(dirname(dirname(__file__)), "lingua_franca", "version.py") + +alpha_var_name = "VERSION_ALPHA" + +for line in fileinput.input(version_file, inplace=True): + if line.startswith(alpha_var_name): + print(f"{alpha_var_name} = 0") + else: + print(line.rstrip('\n')) diff --git a/setup.py b/setup.py index 15677fc2..e8c5c76f 100644 --- a/setup.py +++ b/setup.py @@ -35,9 +35,9 @@ def required(requirements_file): def get_version(): - """ Find the version of ovos-core""" + """ Find the version of the package""" version = None - version_file = os.path.join(BASEDIR, 'lingua_franca', 'version', '__init__.py') + version_file = os.path.join(BASEDIR, 'lingua_franca', 'version.py') major, minor, build, alpha = (None, None, None, None) with open(version_file) as f: for line in f: @@ -54,7 +54,7 @@ def get_version(): '# END_VERSION_BLOCK' in line): break version = f"{major}.{minor}.{build}" - if alpha: + if alpha and int(alpha) > 0: version += f"a{alpha}" return version @@ -67,13 +67,13 @@ def get_version(): setup( name='ovos-lingua-franca', version=get_version(), - packages=['lingua_franca', 'lingua_franca.lang', 'lingua_franca.version'], + packages=['lingua_franca', 'lingua_franca.lang'], cmdclass={'install': CustomInstall}, url='https://github.com/OpenVoiceOS/ovos-lingua-franca', license='Apache2.0', package_data={'': extra_files}, include_package_data=True, - install_requires=required('requirements.txt'), + install_requires=required('requirements/requirements.txt'), author='Mycroft AI / OVOS', author_email='jarbasai@mailfence.com', description='OpenVoiceOS\'s multilingual text parsing and formatting library', diff --git a/test/test_licenses.py b/test/test_licenses.py deleted file mode 100644 index b162992e..00000000 --- a/test/test_licenses.py +++ /dev/null @@ -1,53 +0,0 @@ -import unittest -from pprint import pprint - -from lichecker import LicenseChecker - -# these packages dont define license in setup.py -# manually verified and injected -license_overrides = { - "kthread": "MIT", - 'yt-dlp': "Unlicense", - 'pyxdg': 'GPL-2.0', - 'ptyprocess': 'ISC license', - 'psutil': 'BSD3' -} -# explicitly allow these packages that would fail otherwise -whitelist = [] - -# validation flags -allow_nonfree = False -allow_viral = False -allow_unknown = False -allow_unlicense = True -allow_ambiguous = False - -pkg_name = "ovos-lingua-franca" - - -class TestLicensing(unittest.TestCase): - @classmethod - def setUpClass(self): - licheck = LicenseChecker(pkg_name, - license_overrides=license_overrides, - whitelisted_packages=whitelist, - allow_ambiguous=allow_ambiguous, - allow_unlicense=allow_unlicense, - allow_unknown=allow_unknown, - allow_viral=allow_viral, - allow_nonfree=allow_nonfree) - print("Package", pkg_name) - print("Version", licheck.version) - print("License", licheck.license) - print("Transient Requirements (dependencies of dependencies)") - pprint(licheck.transient_dependencies) - self.licheck = licheck - - def test_license_compliance(self): - print("Package Versions") - pprint(self.licheck.versions) - - print("Dependency Licenses") - pprint(self.licheck.licenses) - - self.licheck.validate() diff --git a/test/__init__.py b/test/unittests/__init__.py similarity index 100% rename from test/__init__.py rename to test/unittests/__init__.py diff --git a/test/test_format.py b/test/unittests/test_format.py similarity index 100% rename from test/test_format.py rename to test/unittests/test_format.py diff --git a/test/test_format_ca.py b/test/unittests/test_format_ca.py similarity index 100% rename from test/test_format_ca.py rename to test/unittests/test_format_ca.py diff --git a/test/test_format_cs.py b/test/unittests/test_format_cs.py similarity index 100% rename from test/test_format_cs.py rename to test/unittests/test_format_cs.py diff --git a/test/test_format_da.py b/test/unittests/test_format_da.py similarity index 100% rename from test/test_format_da.py rename to test/unittests/test_format_da.py diff --git a/test/test_format_de.py b/test/unittests/test_format_de.py similarity index 100% rename from test/test_format_de.py rename to test/unittests/test_format_de.py diff --git a/test/test_format_en.py b/test/unittests/test_format_en.py similarity index 100% rename from test/test_format_en.py rename to test/unittests/test_format_en.py diff --git a/test/test_format_es.py b/test/unittests/test_format_es.py similarity index 100% rename from test/test_format_es.py rename to test/unittests/test_format_es.py diff --git a/test/test_format_fa.py b/test/unittests/test_format_fa.py similarity index 100% rename from test/test_format_fa.py rename to test/unittests/test_format_fa.py diff --git a/test/test_format_fr.py b/test/unittests/test_format_fr.py similarity index 100% rename from test/test_format_fr.py rename to test/unittests/test_format_fr.py diff --git a/test/test_format_hu.py b/test/unittests/test_format_hu.py similarity index 100% rename from test/test_format_hu.py rename to test/unittests/test_format_hu.py diff --git a/test/test_format_it.py b/test/unittests/test_format_it.py similarity index 100% rename from test/test_format_it.py rename to test/unittests/test_format_it.py diff --git a/test/test_format_nl.py b/test/unittests/test_format_nl.py similarity index 100% rename from test/test_format_nl.py rename to test/unittests/test_format_nl.py diff --git a/test/test_format_pl.py b/test/unittests/test_format_pl.py similarity index 100% rename from test/test_format_pl.py rename to test/unittests/test_format_pl.py diff --git a/test/test_format_pt.py b/test/unittests/test_format_pt.py similarity index 100% rename from test/test_format_pt.py rename to test/unittests/test_format_pt.py diff --git a/test/test_format_ru.py b/test/unittests/test_format_ru.py similarity index 100% rename from test/test_format_ru.py rename to test/unittests/test_format_ru.py diff --git a/test/test_format_sl.py b/test/unittests/test_format_sl.py similarity index 100% rename from test/test_format_sl.py rename to test/unittests/test_format_sl.py diff --git a/test/test_format_sv.py b/test/unittests/test_format_sv.py similarity index 100% rename from test/test_format_sv.py rename to test/unittests/test_format_sv.py diff --git a/test/test_localizer.py b/test/unittests/test_localizer.py similarity index 100% rename from test/test_localizer.py rename to test/unittests/test_localizer.py diff --git a/test/test_parse.py b/test/unittests/test_parse.py similarity index 100% rename from test/test_parse.py rename to test/unittests/test_parse.py diff --git a/test/test_parse_ca.py b/test/unittests/test_parse_ca.py similarity index 100% rename from test/test_parse_ca.py rename to test/unittests/test_parse_ca.py diff --git a/test/test_parse_cs.py b/test/unittests/test_parse_cs.py similarity index 100% rename from test/test_parse_cs.py rename to test/unittests/test_parse_cs.py diff --git a/test/test_parse_da.py b/test/unittests/test_parse_da.py similarity index 100% rename from test/test_parse_da.py rename to test/unittests/test_parse_da.py diff --git a/test/test_parse_de.py b/test/unittests/test_parse_de.py similarity index 100% rename from test/test_parse_de.py rename to test/unittests/test_parse_de.py diff --git a/test/test_parse_en.py b/test/unittests/test_parse_en.py similarity index 100% rename from test/test_parse_en.py rename to test/unittests/test_parse_en.py diff --git a/test/test_parse_es.py b/test/unittests/test_parse_es.py similarity index 100% rename from test/test_parse_es.py rename to test/unittests/test_parse_es.py diff --git a/test/test_parse_fa.py b/test/unittests/test_parse_fa.py similarity index 100% rename from test/test_parse_fa.py rename to test/unittests/test_parse_fa.py diff --git a/test/test_parse_fr.py b/test/unittests/test_parse_fr.py similarity index 100% rename from test/test_parse_fr.py rename to test/unittests/test_parse_fr.py diff --git a/test/test_parse_it.py b/test/unittests/test_parse_it.py similarity index 100% rename from test/test_parse_it.py rename to test/unittests/test_parse_it.py diff --git a/test/test_parse_nl.py b/test/unittests/test_parse_nl.py similarity index 100% rename from test/test_parse_nl.py rename to test/unittests/test_parse_nl.py diff --git a/test/test_parse_pl.py b/test/unittests/test_parse_pl.py similarity index 100% rename from test/test_parse_pl.py rename to test/unittests/test_parse_pl.py diff --git a/test/test_parse_pt.py b/test/unittests/test_parse_pt.py similarity index 100% rename from test/test_parse_pt.py rename to test/unittests/test_parse_pt.py diff --git a/test/test_parse_ru.py b/test/unittests/test_parse_ru.py similarity index 100% rename from test/test_parse_ru.py rename to test/unittests/test_parse_ru.py diff --git a/test/test_parse_sv.py b/test/unittests/test_parse_sv.py similarity index 100% rename from test/test_parse_sv.py rename to test/unittests/test_parse_sv.py