-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
…ypescript_Thomas-Garnder
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Python Tox | ||
|
||
on: | ||
push: | ||
branches: | ||
# Run on our main branch | ||
- main | ||
paths: | ||
- example-python/** | ||
pull_request: | ||
# Run for any pull requests | ||
paths: | ||
- example-python/** | ||
jobs: | ||
tox: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
# Run on Python versions that are stable and not EOL | ||
python-version: ["3.10", "3.11", "3.12", "3.13"] | ||
tox-job: ["test", "build", "lint", "type"] | ||
steps: | ||
- uses: actions/checkout@v4 # Checkout the current branch/merge state | ||
- name: Set up Python ${{ matrix.python-version }} # Get Python ready to use | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies # Get Tox and Poetry ready | ||
working-directory: ./example-python | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install tox tox-gh-actions | ||
curl -sSL https://install.python-poetry.org | python - | ||
tox depends --recreate | ||
# Run Tox jobs | ||
- name: Tox (${{ matrix.tox-job }}) | ||
working-directory: ./example-python | ||
run: | | ||
poetry config virtualenvs.create false | ||
poetry install --no-root --with ${{ matrix.tox-job }} | ||
tox -e ${{ matrix.tox-job }} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
|
||
# Distribution / packaging | ||
build/ | ||
dist/ | ||
public/ | ||
*.egg-info/ | ||
.eggs/ | ||
docs/source/generated | ||
|
||
# Test artifacts= | ||
|
||
.coverage | ||
coverage.xml | ||
coverage_reports | ||
junit.xml | ||
|
||
# Developer Environments | ||
venv/ | ||
.tox/ | ||
.env | ||
secrets.env |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
FROM python:3.12 AS base | ||
ENV POETRY_HOME=/opt/poetry | ||
ENV PATH="/opt/poetry/bin:${PATH}" | ||
|
||
RUN mkdir -p /opt/poetry/project /opt/poetry/bin | ||
RUN curl -sSL https://install.python-poetry.org | python - | ||
|
||
COPY pyproject.toml poetry*.lock README.md /opt/poetry/project/ | ||
RUN \ | ||
cd /opt/poetry/project && \ | ||
poetry config virtualenvs.create false && \ | ||
if [ ! -f poetry.lock ]; then poetry lock; fi && \ | ||
poetry install --no-root && \ | ||
poetry env info | ||
|
||
RUN useradd -ms /bin/bash developer | ||
USER developer | ||
WORKDIR /home/developer | ||
|
||
|
||
FROM base as dev | ||
USER root | ||
RUN cd /opt/poetry/project && poetry install --no-root --with build,lint,test | ||
USER developer |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
"""Example Python package.""" | ||
|
||
from . import main | ||
from .example import hello | ||
|
||
__all__: list[str] = ["main", "hello"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"""Example importable module.""" | ||
|
||
__all__: list[str] = ["hello"] | ||
|
||
|
||
def hello() -> str: | ||
"""Return a Hello World string that can be printed. | ||
Returns: | ||
A printable string with the content of "Hello World!". | ||
""" | ||
return "Hello World!" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
"""An example application entry-point module.""" | ||
|
||
from .example import hello | ||
|
||
__all__: list[str] = ["main"] | ||
|
||
|
||
def main() -> None: | ||
"""Print a Hello World message to the console. | ||
Obtains a Hello World string and prints it. | ||
Note the use of "Google-style" docstrings: | ||
https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html | ||
""" | ||
message = hello() | ||
print(message) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |