Skip to content

Commit

Permalink
switches to poetry, upgrades tools and versions
Browse files Browse the repository at this point in the history
  • Loading branch information
ntlhui committed Sep 10, 2024
1 parent 8361c47 commit e0fc09a
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 36 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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')
24 changes: 10 additions & 14 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/*
path: htmlcov/*
8 changes: 7 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
name: Semantic Release

on:
push:
workflow_run:
workflows:
- Pylint
- PyTest
branches:
- main
types:
- completed

jobs:
release:
Expand All @@ -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 }}
1 change: 1 addition & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"ms-toolsai.jupyter",
"njpwerner.autodocstring",
"ms-python.isort",
"ms-python.autopep8"
]
}
8 changes: 6 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
38 changes: 24 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = '[email protected]'},
"UCSD Engineers for Exploration <[email protected]>"
]
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"
Expand Down

0 comments on commit e0fc09a

Please sign in to comment.