Skip to content

Commit

Permalink
Merge pull request #1 from ADACS-Australia/refactor/base
Browse files Browse the repository at this point in the history
Update dependencies
  • Loading branch information
gbpoole authored Jul 3, 2024
2 parents 960bb97 + b70558c commit a55da5a
Show file tree
Hide file tree
Showing 10 changed files with 147 additions and 162 deletions.
25 changes: 24 additions & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,23 @@ jobs:

steps:

# Clone the base template
- name: Clone base template
uses: actions/checkout@v3
with:
repository: 'ADACS-Australia/adacs_template_python_base'
path: __adacs_template_python_base

# Set the path where the base template will be stored and move it there
- name: Set temporary path
run: echo "TEMP_DIR=$(mktemp -d)" >> $GITHUB_ENV

- name: Move base template
run: mv __adacs_template_python_base $TEMP_DIR

- name: Set path to new base template location
run: echo "BASE_TEMPLATE_PATH=$(echo $TEMP_DIR/__adacs_template_python_base )" >> $GITHUB_ENV

# Set-up dependencies
- name: Check-out repo
uses: actions/checkout@v3
Expand Down Expand Up @@ -90,7 +107,7 @@ jobs:
# note: --config is needed to prevent ruff from using a version elsewhere in the project.
# This is important for template projects, for example.
- name: Enforce linting
run: poetry run ruff --config pyproject.toml .
run: poetry run ruff check --config pyproject.toml .

- name: Enforce formating
run: poetry run black .
Expand All @@ -101,6 +118,12 @@ jobs:
poetry check
poetry lock --check
# Set-up some dummy git credentials so the tests (which use git) will run
- name: Set-up git credentials
run: |
git config --global user.email "git@user.org"
git config --global user.name "Git, User"
# Run tests
- name: Generate build
run: poetry build
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repos:

# Some minor quality of life things
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.6.0
hooks:
- id: check-merge-conflict
- id: check-added-large-files
Expand All @@ -18,28 +18,28 @@ repos:
# Ensure that revisions for tools such as ruff, black, etc. can be
# managed by Poetry but synced here before commiting code
- repo: https://github.com/floatingpurr/sync_with_poetry
rev: 0.4.0
rev: 1.1.0
hooks:
- id: sync_with_poetry
args: ['--db','.pre-commit-db.json']

# Format code
- repo: https://github.com/psf/black
rev: 22.12.0
rev: 24.4.2
hooks:
- id: black
exclude: "{{cookiecutter.repo_name}}|hooks"

# Lint code
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.243
rev: v0.5.0
hooks:
- id: ruff
exclude: "{{cookiecutter.repo_name}}|hooks"

# Make sure the Poetry project is properly maintained
- repo: https://github.com/python-poetry/poetry
rev: 1.3.2
rev: 1.8.0
hooks:
- id: poetry-check
- id: poetry-lock
5 changes: 3 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


def format_authors(authors):
if type(authors) == list:
if type(authors) is list:
result = ""
for i_author, author in enumerate(authors):
if i_author == 0:
Expand All @@ -24,7 +24,7 @@ def format_authors(authors):
result = result + f", {author}"
else:
result = result + f", and {author}"
elif type(authors) == str:
elif type(authors) is str:
result = authors
return result

Expand Down Expand Up @@ -124,6 +124,7 @@ def format_authors(authors):
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True


# Handler for excluding modules, classes, etc from documentation
# Presently, this just passes through the default behavior
def autodoc_skip_member_handler(app, what, name, obj, skip, options):
Expand Down
6 changes: 3 additions & 3 deletions hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ def print_instructions() -> None:
# Render the file as Markdown with Rich
print()
console = Console()
console.print(Markdown(lines))
if not {{ cookiecutter.__test }}:
console.print(Markdown(lines))


if __name__ == "__main__":
Expand All @@ -131,5 +132,4 @@ def print_instructions() -> None:
# venv("{{ cookiecutter.virtual_environment }}")
# install("{{ cookiecutter.virtual_environment }}")
{% endraw %}
if not {{ cookiecutter.__test }}:
print_instructions()
print_instructions()
Loading

0 comments on commit a55da5a

Please sign in to comment.