Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
# EditorConfig is awesome: https://EditorConfig.org
# https://EditorConfig.org

# Top-most EditorConfig file
root = true

# Global settings (applicable to all files unless overridden)
[*]
charset = utf-8 # Default character encoding
end_of_line = lf # Use LF for line endings (Unix-style)
indent_style = space # Use spaces for indentation
indent_size = 4 # Default indentation size
insert_final_newline = true # Make sure files end with a newline
trim_trailing_whitespace = true # Remove trailing whitespace
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

[*.py]
[*.{py,pyi}]
max_line_length = 100

# Markdown files
[*.md]
max_line_length = 120
max_line_length = 150
trim_trailing_whitespace = false

# Bash scripts
[*.sh]
indent_size = 2

# YAML files
[*.{yml,yaml}]
indent_size = 2
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,4 @@

# Exclude files from language stats (GitHub Linguist)
*.ipynb linguist-vendored
Makefile linguist-vendored
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [ habedi ]
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1.

**Expected behavior**
A clear and concise description of what you expected to happen.

**Logs**
If applicable, add logs to help explain your problem.

**Additional context**
Add any other context about the problem here.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Discussions
url: https://github.com/habedi/template-python-library/discussions
about: Please ask and answer general questions here
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
30 changes: 9 additions & 21 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@ name: Build and Deploy Docs

on:
workflow_dispatch:
push:
branches:
- main
tags:
- "v*"

permissions:
contents: read
pages: write
id-token: write
contents: write

# Only allow one deployment at a time running
concurrency:
group: "pages"
cancel-in-progress: false
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
deploy:
publish-docs:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
Expand All @@ -28,21 +30,7 @@ jobs:
with:
python-version: '3.11'

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install Dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
make setup
make install
Expand Down
18 changes: 14 additions & 4 deletions .github/workflows/lints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,31 @@ name: Run Linter Checks

on:
workflow_dispatch:
pull_request:
branches:
- main
paths-ignore:
- '**.md'
- 'docs/**'
push:
tags:
- 'v*'
branches:
- main

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
lint:
runs-on: ubuntu-latest

strategy:
matrix:
# Define the Python versions check against
python-version: [ "3.10", "3.11", "3.12", "3.13" ]
python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ]

steps:
- name: Checkout Repository
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ on:
permissions:
contents: read

jobs:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# Run tests before publishing
jobs:
call_tests:
uses: ./.github/workflows/tests.yml

# Try to publish if only tests pass
publish_to_pypi:
publish-to-pypi:
runs-on: ubuntu-latest
needs: call_tests

Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,29 @@ on:
workflow_dispatch:
workflow_call:
pull_request:
branches:
- main
paths-ignore:
- '**.md'
- 'docs/**'
push:
branches:
- main
- develop
tags:
- "v*"

permissions:
contents: read

jobs:
build:
test:
runs-on: ubuntu-latest

strategy:
matrix:
# Define the Python versions to test against
python-version: [ "3.10", "3.11", "3.12", "3.13" ]
python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ]

steps:
- name: Checkout Repository
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,4 @@ site/

# Miscellaneous files and directories to ignore
# Add any additional file patterns a directory names that should be ignored down here
.env
44 changes: 42 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,50 @@
default_stages: [ pre-push ]
fail_fast: false
exclude: '(^external/|^docs/)'

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
args: [ --markdown-linebreak-ext=md ]
- id: end-of-file-fixer
- id: mixed-line-ending
- id: check-merge-conflict
- id: check-added-large-files
- id: detect-private-key
- id: check-yaml
- id: check-toml
- id: check-added-large-files
- id: check-merge-conflict
- id: check-json
- id: check-docstring-first
- id: pretty-format-json
args: [ --autofix, --no-sort-keys ]

- repo: local
hooks:
- id: format
name: Format Code
entry: make format
language: system
pass_filenames: false
stages: [ pre-commit ]

- id: lint
name: Run Linter Checks
entry: make lint
language: system
pass_filenames: false
stages: [ pre-commit ]

- id: typecheck
name: Run Typechecks
entry: make typecheck
language: system
pass_filenames: false
stages: [ pre-commit ]

- id: test
name: Run Tests
entry: make test
language: system
pass_filenames: false
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Code of Conduct
## Code of Conduct

We adhere to the [Python Software Foundation Code of Conduct](https://policies.python.org/python.org/code-of-conduct).
28 changes: 14 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,62 +1,62 @@
# Contribution Guidelines
## Contribution Guidelines

Thank you for considering contributing to this project!
Contributions are always welcome and appreciated.

## How to Contribute
### How to Contribute

Please check the [issue tracker](https://github.com/habedi/template-python-library/issues) to see if there is an issue
you
would like to work on or if it has already been resolved.

### Reporting Bugs
#### Reporting Bugs

1. Open an issue on the [issue tracker](https://github.com/habedi/template-python-library/issues).
2. Include information such as steps to reproduce the observed behavior and relevant logs or screenshots.

### Suggesting Features
#### Suggesting Features

1. Open an issue on the [issue tracker](https://github.com/habedi/template-python-library/issues).
2. Provide details about the feature, its purpose, and potential implementation ideas.

## Submitting Pull Requests
### Submitting Pull Requests

- Make sure all tests pass before submitting a pull request.
- Write a clear description of the changes you made and the reasons behind them.

> [!IMPORTANT]
> It's assumed that by submitting a pull request, you agree to license your contributions under the project's license.

## Development Workflow
### Development Workflow

### Prerequisites
#### Prerequisites

Install GNU Make if it's not already installed on your system.

```shell
# For Debian-based systems like Debian, Ubuntu, etc.
## For Debian-based systems like Debian, Ubuntu, etc.
sudo apt-get install make
```

- Use the `make setup` command to install the development dependencies.
- Use the `make install` command to install the Python dependencies.

### Code Style
#### Code Style

- Use the `make format` command to format the code.

### Running Tests
#### Running Tests

- Use the `make test` command to run the tests.

### Running Linter Checks
#### Running Linter Checks

- Use the `make lint` command to run the linter checks.

### See Available Commands
#### See Available Commands

- Run `make help` to see all available commands for managing different tasks.

## Code of Conduct
### Code of Conduct

We adhere to the [Python Software Foundation Code of Conduct](https://policies.python.org/python.org/code-of-conduct).
We adhere to the project's [Code of Conduct](CODE_OF_CONDUCT.md).
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2025 Hassan Abedi
Copyright (c) 2026 Hassan Abedi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading
Loading