From e0fc09afc4835c1c7dac4e38ff0b683689fe5207 Mon Sep 17 00:00:00 2001 From: Nathan Hui Date: Mon, 9 Sep 2024 17:42:38 -0700 Subject: [PATCH] switches to poetry, upgrades tools and versions --- .github/workflows/pylint.yml | 11 +++++----- .github/workflows/pytest.yml | 24 +++++++++------------- .github/workflows/release.yml | 8 +++++++- .vscode/extensions.json | 1 + .vscode/settings.json | 8 ++++++-- pyproject.toml | 38 ++++++++++++++++++++++------------- 6 files changed, 54 insertions(+), 36 deletions(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 0ad87c3..e1eda02 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -7,17 +7,18 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10"] + python-version: ["3.10", "3.11", "3.12"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - python -m pip install --upgrade pip - pip install pylint + python -m pip install --upgrade pip poetry + poetry config virtualenvs.create false + poetry install - name: Analysing the code with pylint run: | pylint $(git ls-files '*.py') \ No newline at end of file diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index ada2b5c..9a54a21 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -5,29 +5,25 @@ on: [push, workflow_dispatch] jobs: build: runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + - uses: actions/checkout@v4 + - name: Set up Python 3.12 + uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} + python-version: '3.12' - name: Install dependencies run: | - python -m pip install --upgrade pip - pip install pytest coverage - pip install . + python -m pip install --upgrade pip poetry + poetry config virtualenvs.create false + poetry install - name: Test run: | - coverage run -m pytest tests/ + coverage run -m pytest tests - name: Generate Report run: | coverage html - name: Upload report - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: coverage-report - path: | - htmlcov/* \ No newline at end of file + path: htmlcov/* \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3349c8a..ddbbe7c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,14 @@ name: Semantic Release on: - push: + workflow_run: + workflows: + - Pylint + - PyTest branches: - main + types: + - completed jobs: release: @@ -21,4 +26,5 @@ jobs: - name: Python Semantic Release uses: python-semantic-release/python-semantic-release@master with: + # This might need to be changed to the E4E Releaser PAT github_token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json index ee6ba6c..bddf977 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -5,5 +5,6 @@ "ms-toolsai.jupyter", "njpwerner.autodocstring", "ms-python.isort", + "ms-python.autopep8" ] } \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 45321e7..d362e12 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,8 +3,12 @@ "tests" ], "python.testing.unittestEnabled": false, - "python.linting.pylintEnabled": true, "editor.rulers": [ 100 - ] + ], + "python.testing.pytestEnabled": true, + "editor.formatOnPaste": true, + "editor.formatOnSave": true, + "editor.formatOnSaveMode": "modifications", + "editor.formatOnType": true } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index f9464d2..152e4a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,26 +1,36 @@ [build-system] -requires = ['setuptools'] -build-backend = 'setuptools.build_meta' +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" -[project] -name = 'example_package' +[tool.poetry] +name = "example_package" +version = "0.1.0" +description = "" authors = [ - {name = 'UCSD Engineers for Exploration', email = 'e4e@ucsd.edu'}, + "UCSD Engineers for Exploration " ] -description = '' -readme = 'REAME.md' -requires-python = '>=3.8' -keywords = [] -license = {file = 'LICENSE'} -dependencies = [ -] -dynamic = ['version'] +license = "UCSD" +readme = "README.md" +repository = 'https://github.com/UCSD-E4E/python-repo-example' + +[tool.poetry.dependencies] +python = "^3.12" -[project.scripts] +[tool.poetry.group.dev.dependencies] +pylint = "^3.2.7" +pytest = "^8.3.2" +jupyter = "^1.1.1" +autopep8 = "^2.3.1" +coverage = "^7.6.1" + +[tool.poetry.scripts] ExamplePythonConsoleScript = 'example_package.example_module:exampleEntryPoint' [tool.semantic_release] version_variables = ["example_package/__init__.py:__version__"] +version_toml = [ + "pyproject.toml:tool.poetry.version", +] assets = [] commit_message = "{version}\n\nAutomatically generated by python-semantic-release" commit_parser = "angular"