python-template-project 0.1.18__tar.gz → 0.1.20__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- python_template_project-0.1.20/.github/rename_project.sh +78 -0
- python_template_project-0.1.20/.github/template.yml +2 -0
- python_template_project-0.1.20/.github/workflows/build-macos.yml +41 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/.github/workflows/build.yml +0 -4
- python_template_project-0.1.20/.github/workflows/rename_project.yml +62 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/HISTORY.md +26 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/Makefile +31 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/PKG-INFO +1 -1
- {python_template_project-0.1.18 → python_template_project-0.1.20}/README.md +2 -2
- python_template_project-0.1.20/docs/develop/naming_convention.md +46 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/mkdocs.yml +1 -1
- python_template_project-0.1.18/scripts/show-filelist.ps1 → python_template_project-0.1.20/scripts/show_filelist.ps1 +1 -1
- python_template_project-0.1.18/scripts/show-tree.ps1 → python_template_project-0.1.20/scripts/show_tree.ps1 +1 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/scripts/update_readme.py +2 -2
- {python_template_project-0.1.18 → python_template_project-0.1.20}/src/python_template_project/_version.py +2 -2
- {python_template_project-0.1.18 → python_template_project-0.1.20}/src/python_template_project/cli/cli.py +1 -1
- {python_template_project-0.1.18 → python_template_project-0.1.20}/src/python_template_project/config/config.py +1 -1
- {python_template_project-0.1.18 → python_template_project-0.1.20}/src/python_template_project/gui/gui.py +2 -2
- {python_template_project-0.1.18 → python_template_project-0.1.20}/src/python_template_project.egg-info/PKG-INFO +1 -1
- {python_template_project-0.1.18 → python_template_project-0.1.20}/src/python_template_project.egg-info/SOURCES.txt +6 -3
- python_template_project-0.1.20/template.yml.url +6 -0
- python_template_project-0.1.18/.github/rename_project.sh +0 -37
- python_template_project-0.1.18/.github/workflows/build-macos.yml +0 -93
- python_template_project-0.1.18/.github/workflows/rename_project.yml +0 -42
- {python_template_project-0.1.18 → python_template_project-0.1.20}/.github/FUNDING.yml +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/.github/actions/setup-environment/action.yml +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/.github/dependabot.yml +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/.github/init.sh +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/.github/release_message.sh +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/.github/workflows/main.yml +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/.github/workflows/release.yml +0 -0
- /python_template_project-0.1.18/.github/workflows/update-readme.yml → /python_template_project-0.1.20/.github/workflows/update_readme.yml +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/.gitignore +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/.idea/runConfigurations/config_generate.xml +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/.idea/runConfigurations/module_cli.xml +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/.idea/runConfigurations/module_gui.xml +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/.pre-commit-config.yaml +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/.readthedocs.yaml +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/LICENSE +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/config.yaml +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/docs/.nav.yml +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/docs/_static/img/favicon.png +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/docs/_static/img/logo.png +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/docs/css/custom.css +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/docs/develop/01_getting_started_dev.md +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/docs/develop/contributing.md +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/docs/develop/make_windows.md +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/docs/develop/pypi_release.md +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/docs/getting-started/install.md +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/docs/getting-started/virtual-environment.md +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/docs/index.md +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/docs/usage/cli.md +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/docs/usage/config.md +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/examples/kuhkopfsteig.gpx +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/examples/rother_lilienstein.gpx +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/examples/teneriffa.gpx +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/pyproject.toml +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/setup.cfg +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/src/__init__.py +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/src/firewall_handler.py +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/src/main.py +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/src/python_template_project/__init__.py +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/src/python_template_project/__main__.py +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/src/python_template_project/cli/__init__.py +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/src/python_template_project/cli/__main__.py +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/src/python_template_project/config/__init__.py +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/src/python_template_project/core/__init__.py +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/src/python_template_project/core/base.py +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/src/python_template_project/core/logging.py +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/src/python_template_project/gui/__init__.py +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/src/python_template_project/gui/__main__.py +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/src/python_template_project.egg-info/dependency_links.txt +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/src/python_template_project.egg-info/entry_points.txt +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/src/python_template_project.egg-info/requires.txt +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/src/python_template_project.egg-info/top_level.txt +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/tests/__init__.py +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/tests/test_generic_cli.py +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/tests/test_gpx.py +0 -0
- {python_template_project-0.1.18 → python_template_project-0.1.20}/uv.lock +0 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# Hilfsfunktion für Fehlermeldungen und Beenden
|
|
4
|
+
function die { echo "$*" >&2; exit 1; }
|
|
5
|
+
|
|
6
|
+
# parse args
|
|
7
|
+
while getopts a:p:n:d: flag
|
|
8
|
+
do
|
|
9
|
+
case "${flag}" in
|
|
10
|
+
a) author=${OPTARG};;
|
|
11
|
+
p) package_name=${OPTARG};; # The new internal Python package name (snake_case)
|
|
12
|
+
n) project_name=${OPTARG};; # The new external project name (kebab-case)
|
|
13
|
+
d) description=${OPTARG};;
|
|
14
|
+
*) die "Unknown Flag: $flag";;
|
|
15
|
+
esac
|
|
16
|
+
done
|
|
17
|
+
|
|
18
|
+
# Check whether all required arguments have been passed
|
|
19
|
+
[[ -z "$author" ]] && die "Missing Argument: -a (author)"
|
|
20
|
+
[[ -z "$package_name" ]] && die "Missing Argument: -p (package_name)"
|
|
21
|
+
[[ -z "$project_name" ]] && die "Missing Argument: -n (project_name)"
|
|
22
|
+
[[ -z "$description" ]] && die "Missing Argument: -d (description)"
|
|
23
|
+
|
|
24
|
+
echo "Author: $author";
|
|
25
|
+
echo "New Python Package Name (internal): $package_name";
|
|
26
|
+
echo "New Project Name (external/PyPI): $project_name";
|
|
27
|
+
echo "Description: $description";
|
|
28
|
+
|
|
29
|
+
echo "Renaming project content..."
|
|
30
|
+
|
|
31
|
+
# Old identifiers
|
|
32
|
+
original_author="pamagister"
|
|
33
|
+
original_project_name="python-template-project"
|
|
34
|
+
original_package_name="python_template_project"
|
|
35
|
+
original_description="Feature-rich Python project template designed for robustness and ease of use."
|
|
36
|
+
|
|
37
|
+
# Customize all file contents first
|
|
38
|
+
# Use 'git ls-files' to edit only versioned files
|
|
39
|
+
# Note the order: Replace more specific with more specific first,
|
|
40
|
+
# then more general ones.
|
|
41
|
+
# Important: Escape special characters in the variables if they could occur in the replacements.
|
|
42
|
+
# Here the variables are relatively safe as they only contain alphanumeric characters and hyphens/underscores.
|
|
43
|
+
|
|
44
|
+
for filename in $(git ls-files)
|
|
45
|
+
do
|
|
46
|
+
# Skip files in the .github/ directory
|
|
47
|
+
if [[ "$filename" == ".github"* ]]; then
|
|
48
|
+
echo "Skipping .github file: $filename"
|
|
49
|
+
continue
|
|
50
|
+
fi
|
|
51
|
+
# Replace the old internal package name with the new internal package name
|
|
52
|
+
sed -i "s/$original_package_name/$package_name/g" "$filename"
|
|
53
|
+
# Replace the old external project name with the new external project name
|
|
54
|
+
sed -i "s/$original_project_name/$project_name/g" "$filename"
|
|
55
|
+
# Replace the old author
|
|
56
|
+
sed -i "s/$original_author/$author/g" "$filename"
|
|
57
|
+
# Replace the old description with the new one
|
|
58
|
+
sed -i "s/$original_description/$description/g" "$filename"
|
|
59
|
+
echo "Processed: $filename"
|
|
60
|
+
done
|
|
61
|
+
|
|
62
|
+
# Then rename the directory
|
|
63
|
+
# Check if the directory exists before renaming it
|
|
64
|
+
OLD_PACKAGE_DIR="src/$original_package_name"
|
|
65
|
+
NEW_PACKAGE_DIR="src/$package_name"
|
|
66
|
+
|
|
67
|
+
if [ -d "$OLD_PACKAGE_DIR" ]; then
|
|
68
|
+
echo "Renaming directory: $OLD_PACKAGE_DIR to $NEW_PACKAGE_DIR"
|
|
69
|
+
mv "$OLD_PACKAGE_DIR" "$NEW_PACKAGE_DIR"
|
|
70
|
+
else
|
|
71
|
+
echo "Warning: Directory $OLD_PACKAGE_DIR not found. Skipping directory rename."
|
|
72
|
+
fi
|
|
73
|
+
|
|
74
|
+
# Remove the template.yml to indicate that the template has been applied
|
|
75
|
+
echo "Removing .github/template.yml"
|
|
76
|
+
rm -f .github/template.yml
|
|
77
|
+
|
|
78
|
+
echo "Project renaming complete!"
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: Build macOS App
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- '*' # Triggers for tags like 0.1 or v0.1.3
|
|
7
|
+
workflow_dispatch: # Allows manual triggering
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
strategy:
|
|
12
|
+
fail-fast: false
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: [ 3.11 ]
|
|
15
|
+
os: [ macos-latest ]
|
|
16
|
+
runs-on: ${{ matrix.os }}
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- name: Checkout repository
|
|
20
|
+
uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Set up Python
|
|
23
|
+
uses: actions/setup-python@v5
|
|
24
|
+
with:
|
|
25
|
+
python-version: '3.11'
|
|
26
|
+
|
|
27
|
+
- name: Setup Environment # Composite Action
|
|
28
|
+
uses: ./.github/actions/setup-environment
|
|
29
|
+
with:
|
|
30
|
+
python-version: ${{ matrix.python-version }}
|
|
31
|
+
|
|
32
|
+
- name: Build Unified Executable and App Bundle with PyInstaller
|
|
33
|
+
run: make build-macos
|
|
34
|
+
|
|
35
|
+
- name: Upload ZIP to GitHub Release
|
|
36
|
+
uses: softprops/action-gh-release@v2
|
|
37
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
38
|
+
with:
|
|
39
|
+
files: package-macOS.zip
|
|
40
|
+
env:
|
|
41
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
{python_template_project-0.1.18 → python_template_project-0.1.20}/.github/workflows/build.yml
RENAMED
|
@@ -33,10 +33,6 @@ jobs:
|
|
|
33
33
|
|
|
34
34
|
- name: Prepare ZIP file for release
|
|
35
35
|
run: |
|
|
36
|
-
mkdir release
|
|
37
|
-
copy dist\python-template-project.exe release\
|
|
38
|
-
copy config.yaml release\
|
|
39
|
-
copy README.md release\
|
|
40
36
|
echo " - Double-click to start GUI" >> release\USAGE.txt
|
|
41
37
|
echo " - Run from command line for CLI options" >> release\USAGE.txt
|
|
42
38
|
powershell Compress-Archive -Path release\* -DestinationPath installer-win.zip
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
name: Rename the project from template
|
|
2
|
+
|
|
3
|
+
on: [workflow_dispatch]
|
|
4
|
+
|
|
5
|
+
permissions: write-all
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
rename-project:
|
|
9
|
+
if: ${{ !contains (github.repository, 'python-template-project') }}
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v3
|
|
13
|
+
with:
|
|
14
|
+
# by default, it uses a depth of 1
|
|
15
|
+
# this fetches all history so that we can read each commit
|
|
16
|
+
fetch-depth: 0
|
|
17
|
+
ref: ${{ github.head_ref }}
|
|
18
|
+
|
|
19
|
+
# The repository name (e.g. "my-new-repo" or "my_new_repo")
|
|
20
|
+
- run: echo "NEW_REPO_BASE_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV
|
|
21
|
+
shell: bash
|
|
22
|
+
|
|
23
|
+
# The name for internal Python packages (always with underscores)
|
|
24
|
+
- run: echo "NEW_PACKAGE_NAME=$(echo '${{ env.NEW_REPO_BASE_NAME }}' | tr '-' '_')" >> $GITHUB_ENV
|
|
25
|
+
shell: bash
|
|
26
|
+
|
|
27
|
+
# The name for external designations (remains as in the repo name)
|
|
28
|
+
- run: echo "NEW_PROJECT_NAME=$(echo '${{ env.NEW_REPO_BASE_NAME }}' | tr '_' '-')" >> $GITHUB_ENV
|
|
29
|
+
shell: bash
|
|
30
|
+
|
|
31
|
+
- run: echo "REPOSITORY_OWNER=$(echo '${{ github.repository }}' | awk -F '/' '{print $1}')" >> $GITHUB_ENV
|
|
32
|
+
shell: bash
|
|
33
|
+
|
|
34
|
+
- name: Check if this is still a template
|
|
35
|
+
id: is_template
|
|
36
|
+
# Check whether the template.yml still exists
|
|
37
|
+
run: echo "::set-output name=is_template::$(test -f .github/template.yml && echo 'true' || echo 'false')"
|
|
38
|
+
|
|
39
|
+
- name: Rename the project
|
|
40
|
+
# Execute only if the template.yml exists (indicator for template repo)
|
|
41
|
+
if: steps.is_template.outputs.is_template == 'true'
|
|
42
|
+
run: |
|
|
43
|
+
echo "Renaming the project with author: ${{ env.REPOSITORY_OWNER }}, package name: ${{ env.NEW_PACKAGE_NAME }}, project name: ${{ env.NEW_PROJECT_NAME }}"
|
|
44
|
+
.github/rename_project.sh \
|
|
45
|
+
-a "${{ env.REPOSITORY_OWNER }}" \
|
|
46
|
+
-p "${{ env.NEW_PACKAGE_NAME }}" \
|
|
47
|
+
-n "${{ env.NEW_PROJECT_NAME }}" \
|
|
48
|
+
-d "Feature-rich Python project template for ${{ env.NEW_PROJECT_NAME }}." # Customized description
|
|
49
|
+
|
|
50
|
+
- name: Configure Git # it is good practiceto configure git bot
|
|
51
|
+
run: |
|
|
52
|
+
git config user.name "github-actions[bot]"
|
|
53
|
+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
54
|
+
# 'git config --global credential.helper store'
|
|
55
|
+
shell: bash
|
|
56
|
+
|
|
57
|
+
- name: Commit and Push Changes
|
|
58
|
+
run: |
|
|
59
|
+
git add .
|
|
60
|
+
git commit -m "✅ Project renamed from template."
|
|
61
|
+
git push --force
|
|
62
|
+
shell: bash
|
|
@@ -4,6 +4,32 @@ Changelog
|
|
|
4
4
|
|
|
5
5
|
(unreleased)
|
|
6
6
|
------------
|
|
7
|
+
- Feat #31: move project specific namings into makefile so that it can
|
|
8
|
+
be renamed. [Paul Magister]
|
|
9
|
+
- Feat #31: try this renaming automation. [Paul Magister]
|
|
10
|
+
- Feat #31: improve renaming automation: has to be triggered manually,
|
|
11
|
+
keep kebab-case if project is named like this. [Paul Magister]
|
|
12
|
+
- Feat #31: improve renaming automation: has to be triggered manually,
|
|
13
|
+
keep kebab-case if project is named like this. [Paul Magister]
|
|
14
|
+
- Feat #31: improve renaming automation: has to be triggered manually,
|
|
15
|
+
keep kebab-case if project is named like this. [Paul Magister]
|
|
16
|
+
- Feat #31: consistent naming. [Paul Magister]
|
|
17
|
+
- Feat #31: fix rename_project.yml: use correct git auto commit. [Paul
|
|
18
|
+
Magister]
|
|
19
|
+
- Feat #31: fix rename_project.yml: use correct git auto commit. [Paul
|
|
20
|
+
Magister]
|
|
21
|
+
- Feat #30: fix link issue by modifying link in README.md. [Paul
|
|
22
|
+
Magister]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
0.1.18 (2025-06-20)
|
|
26
|
+
-------------------
|
|
27
|
+
- Feat #30: do not track _version.py. [Paul Magister]
|
|
28
|
+
- Feat #30: fix version. [Paul Magister]
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
0.1.17 (2025-06-20)
|
|
32
|
+
-------------------
|
|
7
33
|
- Feat #30: fix link issue by modifying link in README.md. [Paul
|
|
8
34
|
Magister]
|
|
9
35
|
|
|
@@ -59,6 +59,37 @@ test: lint ## Run tests and generate coverage report.
|
|
|
59
59
|
build-win: ## Build the Windows executable.
|
|
60
60
|
echo "Building unified CLI/GUI application"
|
|
61
61
|
uv run pyinstaller --onefile src/main.py --name python-template-project --add-data "config.yaml;." --hidden-import python_template_project.cli.cli --hidden-import python_template_project.gui.gui
|
|
62
|
+
rm -rf release
|
|
63
|
+
mkdir release
|
|
64
|
+
cp dist/python-template-project.exe release
|
|
65
|
+
cp config.yaml release
|
|
66
|
+
cp README.md release
|
|
67
|
+
|
|
68
|
+
.PHONY: build-macos
|
|
69
|
+
build-macos: ## Build the macOS executable.
|
|
70
|
+
echo "Building unified CLI/GUI application as executable"
|
|
71
|
+
uv run pyinstaller --onefile src/main.py --name python-template-project --add-data "config.yaml:." --hidden-import python_template_project.cli.cli --hidden-import python_template_project.gui.gui
|
|
72
|
+
|
|
73
|
+
echo "Building unified CLI/GUI application as .app bundle"
|
|
74
|
+
# --windowed is important to hide the console for GUI mode
|
|
75
|
+
# The name "TemplateApp" becomes the name of the .app
|
|
76
|
+
uv run pyinstaller --windowed --name "TemplateApp" src/main.py --add-data "config.yaml:." --hidden-import python_template_project.cli.cli --hidden-import python_template_project.gui.gui
|
|
77
|
+
|
|
78
|
+
# Prepare ZIP file for release
|
|
79
|
+
rm -rf release
|
|
80
|
+
mkdir release
|
|
81
|
+
echo "Copy the CLI/GUI executable"
|
|
82
|
+
cp dist/python-template-project release/
|
|
83
|
+
echo "Copy the .app bundle (directory) recursively"
|
|
84
|
+
cp -R "dist/TemplateApp.app" release/
|
|
85
|
+
echo "Copy configuration and documentation"
|
|
86
|
+
cp config.yaml release/
|
|
87
|
+
cp README.md release/
|
|
88
|
+
echo "Create usage instructions"
|
|
89
|
+
|
|
90
|
+
echo "Create the ZIP archive from the contents of the release folder"
|
|
91
|
+
cd release
|
|
92
|
+
zip -r ../package-macOS.zip .
|
|
62
93
|
|
|
63
94
|
.PHONY: watch
|
|
64
95
|
watch: ## Run tests on every change.
|
|
@@ -18,7 +18,7 @@ This template provides a solid foundation for your next Python project, incorpor
|
|
|
18
18
|
|
|
19
19
|
Download from [PyPI](https://pypi.org/).
|
|
20
20
|
|
|
21
|
-
💾 For more installation options see [install](getting-started/install.md).
|
|
21
|
+
💾 For more installation options see [install](docs/getting-started/install.md).
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
24
|
pip install python-template-project
|
|
@@ -32,7 +32,7 @@ python-template-project-gui
|
|
|
32
32
|
|
|
33
33
|
## How to use this template
|
|
34
34
|
|
|
35
|
-
🐍 For details, see the [Getting Started](develop/01_getting_started_dev.md) guide.
|
|
35
|
+
🐍 For details, see the [Getting Started](docs/develop/01_getting_started_dev.md) guide.
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
## Feature overview
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Naming Conventions in Python Projects
|
|
2
|
+
|
|
3
|
+
In Python projects, it's crucial to use consistent naming conventions to ensure code readability and maintainability. The choice between underscores (`_`) and hyphens (`-`) largely depends on the context.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Underscores (`_`) – Snake_case
|
|
8
|
+
|
|
9
|
+
Primarily use underscores **within your Python code** for multi-word names. This is known as `snake_case`.
|
|
10
|
+
|
|
11
|
+
* **Python Package Names (Internal):** The importable name of your Python package (e.g., the folder under `src/`) should use underscores.
|
|
12
|
+
* **Example:** `src/my_python_package` is imported as `import my_python_package`.
|
|
13
|
+
* **Module Names (.py files):** Python file names that are modules should also use underscores.
|
|
14
|
+
* **Example:** `my_module.py`, `data_processing.py`.
|
|
15
|
+
* **Variables, Functions, and Methods:** Within your code, these names should follow `snake_case`.
|
|
16
|
+
* **Example:** `my_variable`, `calculate_total()`, `_private_function()`.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Hyphens (`-`) – Kebab-case
|
|
21
|
+
|
|
22
|
+
Primarily use hyphens **outside of your Python code** for filesystem, URL, and human-readable names. This is often referred to as `kebab-case`.
|
|
23
|
+
|
|
24
|
+
* **PyPI Package Name (Project Name):** The name under which your project is published on PyPI and installed with `pip install` should use hyphens.
|
|
25
|
+
* **Example:** In `pyproject.toml`: `name = "my-python-project"`. Installation: `pip install my-python-project`.
|
|
26
|
+
* **Main Project Folder / Repository Name:** The root folder of your project in the file system.
|
|
27
|
+
* **Example:** `my-python-project/`.
|
|
28
|
+
* **Documentation Folders and Files (MkDocs, ReadTheDocs):** Folders and Markdown files within your documentation.
|
|
29
|
+
* **Example:** `docs/getting-started/installation-guide.md`.
|
|
30
|
+
* **Command-Line Tools / Scripts:** Names for executable scripts you define in your `pyproject.toml` under `[project.scripts]`.
|
|
31
|
+
* **Example:** `my-cli-tool = "my_python_package.cli:main"`.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Summary of Recommendations
|
|
36
|
+
|
|
37
|
+
| Context | Recommended Convention | Example |
|
|
38
|
+
| :---------------------------- | :--------------------- |:---------------------------------|
|
|
39
|
+
| **Internal Python Name** | Underscores (`_`) | `my_python_package` |
|
|
40
|
+
| **PyPI / Project Name** | Hyphens (`-`) | `my-python-package` |
|
|
41
|
+
| **Module Filename** | Underscores (`_`) | `my_module.py` |
|
|
42
|
+
| **Repository/Root Folder** | Hyphens (`-`) | `my-python-project/` |
|
|
43
|
+
| **Docs Folders/Files** | Hyphens (`-`) | `getting-started/cli-usage.md` |
|
|
44
|
+
| **CLI Commands** | Hyphens (`-`) | `my-cli-tool` |
|
|
45
|
+
|
|
46
|
+
Consistently applying these rules significantly improves the clarity and professionalism of your Python project.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
site_name: python-template-project
|
|
2
2
|
site_url: !ENV READTHEDOCS_CANONICAL_URL
|
|
3
3
|
site_description: A feature-rich Python project template with with auto-generated CLI, GUI and parameterized configuration.
|
|
4
|
-
repo_url: https://github.com/pamagister/python-template-
|
|
4
|
+
repo_url: https://github.com/pamagister/python-template-project
|
|
5
5
|
repo_name: GitHub
|
|
6
6
|
|
|
7
7
|
# See also:
|
|
@@ -2,7 +2,7 @@ $basePath = (Get-Location).Path
|
|
|
2
2
|
|
|
3
3
|
Get-ChildItem -Recurse -Force |
|
|
4
4
|
Where-Object {
|
|
5
|
-
$_.FullName -notmatch '\.pytest_cache|\.git|\.ruff|\.venv|\.github|\\build|\.idea|\\htmlcov|\\__pycache__|\\__main__|\\__init__|\\site|\.pyc$'
|
|
5
|
+
$_.FullName -notmatch '\.pytest_cache|\.git|\.ruff|\.venv|\.github|\\build|\\dist|\.idea|\\htmlcov|\\__pycache__|\\__main__|\\__init__|\\site|\.pyc$'
|
|
6
6
|
} |
|
|
7
7
|
ForEach-Object {
|
|
8
8
|
$relativePath = $_.FullName.Substring($basePath.Length)
|
|
@@ -27,6 +27,7 @@ function Show-Tree {
|
|
|
27
27
|
$_.FullName -notmatch [regex]::Escape($basePath.FullName) + '\\\.venv' -and
|
|
28
28
|
$_.FullName -notmatch [regex]::Escape($basePath.FullName) + '\\\.github' -and
|
|
29
29
|
$_.FullName -notmatch [regex]::Escape($basePath.FullName) + '\\build' -and
|
|
30
|
+
$_.FullName -notmatch [regex]::Escape($basePath.FullName) + '\\dist' -and
|
|
30
31
|
$_.FullName -notmatch [regex]::Escape($basePath.FullName) + '\\\.idea' -and
|
|
31
32
|
$_.FullName -notmatch [regex]::Escape($basePath.FullName) + '\\htmlcov' -and
|
|
32
33
|
$_.FullName -notmatch [regex]::Escape($basePath.FullName) + '\\__pycache__' -and
|
|
@@ -13,8 +13,8 @@ source_content = src.read_text(encoding="utf-8")
|
|
|
13
13
|
# Schreibe den Inhalt in die Zieldatei, ebenfalls mit UTF-8 Kodierung
|
|
14
14
|
dst.write_text(
|
|
15
15
|
prefix
|
|
16
|
-
+ source_content.replace("](getting-started
|
|
17
|
-
"](develop
|
|
16
|
+
+ source_content.replace(r"](getting-started/", r"](docs/getting-started/").replace(
|
|
17
|
+
r"](develop/", r"](docs/develop/"
|
|
18
18
|
),
|
|
19
19
|
encoding="utf-8",
|
|
20
20
|
)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Auto-generated CLI interface for
|
|
1
|
+
"""Auto-generated CLI interface for python-template-project project.
|
|
2
2
|
|
|
3
3
|
This file was generated from config.py parameter definitions.
|
|
4
4
|
Do not modify manually - regenerate using ConfigParameterManager CLI generation methods.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Central configuration management for
|
|
1
|
+
"""Central configuration management for python-template-project project.
|
|
2
2
|
|
|
3
3
|
This module provides a single source of truth for all configuration parameters
|
|
4
4
|
organized in categories (CLI, App, GUI). It can generate config files, CLI modules,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"""GUI interface for
|
|
1
|
+
"""GUI interface for python-template-project using tkinter with integrated logging.
|
|
2
2
|
|
|
3
|
-
This module provides a graphical user interface for the
|
|
3
|
+
This module provides a graphical user interface for the python-template-project
|
|
4
4
|
with settings dialog, file management, and centralized logging capabilities.
|
|
5
5
|
|
|
6
6
|
run gui: python -m python_template_project.gui
|
|
@@ -8,6 +8,7 @@ README.md
|
|
|
8
8
|
config.yaml
|
|
9
9
|
mkdocs.yml
|
|
10
10
|
pyproject.toml
|
|
11
|
+
template.yml.url
|
|
11
12
|
uv.lock
|
|
12
13
|
.github/FUNDING.yml
|
|
13
14
|
.github/PULL_REQUEST_TEMPLATE.md
|
|
@@ -15,6 +16,7 @@ uv.lock
|
|
|
15
16
|
.github/init.sh
|
|
16
17
|
.github/release_message.sh
|
|
17
18
|
.github/rename_project.sh
|
|
19
|
+
.github/template.yml
|
|
18
20
|
.github/ISSUE_TEMPLATE/bug_report.md
|
|
19
21
|
.github/ISSUE_TEMPLATE/feature_request.md
|
|
20
22
|
.github/actions/setup-environment/action.yml
|
|
@@ -23,7 +25,7 @@ uv.lock
|
|
|
23
25
|
.github/workflows/main.yml
|
|
24
26
|
.github/workflows/release.yml
|
|
25
27
|
.github/workflows/rename_project.yml
|
|
26
|
-
.github/workflows/
|
|
28
|
+
.github/workflows/update_readme.yml
|
|
27
29
|
.idea/runConfigurations/config_generate.xml
|
|
28
30
|
.idea/runConfigurations/module_cli.xml
|
|
29
31
|
.idea/runConfigurations/module_gui.xml
|
|
@@ -35,6 +37,7 @@ docs/css/custom.css
|
|
|
35
37
|
docs/develop/01_getting_started_dev.md
|
|
36
38
|
docs/develop/contributing.md
|
|
37
39
|
docs/develop/make_windows.md
|
|
40
|
+
docs/develop/naming_convention.md
|
|
38
41
|
docs/develop/pypi_release.md
|
|
39
42
|
docs/getting-started/install.md
|
|
40
43
|
docs/getting-started/virtual-environment.md
|
|
@@ -43,8 +46,8 @@ docs/usage/config.md
|
|
|
43
46
|
examples/kuhkopfsteig.gpx
|
|
44
47
|
examples/rother_lilienstein.gpx
|
|
45
48
|
examples/teneriffa.gpx
|
|
46
|
-
scripts/
|
|
47
|
-
scripts/
|
|
49
|
+
scripts/show_filelist.ps1
|
|
50
|
+
scripts/show_tree.ps1
|
|
48
51
|
scripts/update_readme.py
|
|
49
52
|
src/__init__.py
|
|
50
53
|
src/firewall_handler.py
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
[InternetShortcut]
|
|
2
|
+
URL=https://github.com/rochacbruno/python-project-template/blob/main/.github/template.yml
|
|
3
|
+
IDList=
|
|
4
|
+
HotKey=0
|
|
5
|
+
IconFile=C:\Users\Paul\AppData\Local\Mozilla\Firefox\Profiles\jj8fhpdr.default-release\shortcutCache\iX6zsxzCjY5rSdyFmonOJ3IrDWVfwNmM4B3++fG0dXw=.ico
|
|
6
|
+
IconIndex=0
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
while getopts a:n:u:d: flag
|
|
3
|
-
do
|
|
4
|
-
case "${flag}" in
|
|
5
|
-
a) author=${OPTARG};;
|
|
6
|
-
n) name=${OPTARG};;
|
|
7
|
-
u) urlname=${OPTARG};;
|
|
8
|
-
d) description=${OPTARG};;
|
|
9
|
-
esac
|
|
10
|
-
done
|
|
11
|
-
|
|
12
|
-
echo "Author: $author";
|
|
13
|
-
echo "Project Name: $name";
|
|
14
|
-
echo "Project URL name: $urlname";
|
|
15
|
-
echo "Description: $description";
|
|
16
|
-
|
|
17
|
-
echo "Renaming project..."
|
|
18
|
-
|
|
19
|
-
original_author="pamagister"
|
|
20
|
-
original_name="python-template-project"
|
|
21
|
-
original_package_name="python_template_project"
|
|
22
|
-
original_urlname="python-template-project"
|
|
23
|
-
original_description="Awesome python-template-project created by pamagister"
|
|
24
|
-
# for filename in $(find . -name "*.*")
|
|
25
|
-
for filename in $(git ls-files)
|
|
26
|
-
do
|
|
27
|
-
sed -i "s/$original_author/$author/g" $filename
|
|
28
|
-
sed -i "s/$original_package_name/$name/g" $filename
|
|
29
|
-
sed -i "s/$original_urlname/$urlname/g" $filename
|
|
30
|
-
sed -i "s/$original_description/$description/g" $filename
|
|
31
|
-
echo "Renamed $filename"
|
|
32
|
-
done
|
|
33
|
-
|
|
34
|
-
mv original_name $name
|
|
35
|
-
|
|
36
|
-
# This command runs only once on GHA!
|
|
37
|
-
rm -rf .github/template.yml
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
name: Build macOS App
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
tags:
|
|
6
|
-
- '*' # Triggers for tags like 0.1 or v0.1.3
|
|
7
|
-
workflow_dispatch: # Allows manual triggering
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
build:
|
|
11
|
-
strategy:
|
|
12
|
-
fail-fast: false
|
|
13
|
-
matrix:
|
|
14
|
-
python-version: [ 3.11 ]
|
|
15
|
-
os: [ macos-latest ]
|
|
16
|
-
runs-on: ${{ matrix.os }}
|
|
17
|
-
|
|
18
|
-
steps:
|
|
19
|
-
- name: Checkout repository
|
|
20
|
-
uses: actions/checkout@v4
|
|
21
|
-
|
|
22
|
-
- name: Set up Python
|
|
23
|
-
uses: actions/setup-python@v5
|
|
24
|
-
with:
|
|
25
|
-
python-version: '3.11'
|
|
26
|
-
|
|
27
|
-
- name: Setup Environment # Composite Action
|
|
28
|
-
uses: ./.github/actions/setup-environment
|
|
29
|
-
with:
|
|
30
|
-
python-version: ${{ matrix.python-version }}
|
|
31
|
-
|
|
32
|
-
- name: Build Unified Executable and App Bundle with PyInstaller
|
|
33
|
-
run: |
|
|
34
|
-
echo "Building unified CLI/GUI application as executable"
|
|
35
|
-
uv run pyinstaller --onefile src/main.py --name python-template-project --add-data "config.yaml:." --hidden-import python_template_project.cli.cli --hidden-import python_template_project.gui.gui
|
|
36
|
-
|
|
37
|
-
echo "Building unified CLI/GUI application as .app bundle"
|
|
38
|
-
# --windowed is important to hide the console for GUI mode
|
|
39
|
-
# The name "Python Template Project" becomes the name of the .app
|
|
40
|
-
uv run pyinstaller --windowed --name "Python Template Project" src/main.py --add-data "config.yaml:." --hidden-import python_template_project.cli.cli --hidden-import python_template_project.gui.gui
|
|
41
|
-
|
|
42
|
-
- name: Prepare ZIP file for release
|
|
43
|
-
run: |
|
|
44
|
-
mkdir release
|
|
45
|
-
echo "Copy the CLI/GUI executable"
|
|
46
|
-
cp dist/python-template-project release/
|
|
47
|
-
echo "Copy the .app bundle (directory) recursively"
|
|
48
|
-
cp -R "dist/Python Template Project.app" release/
|
|
49
|
-
echo "Copy configuration and documentation"
|
|
50
|
-
cp config.yaml release/
|
|
51
|
-
cp README.md release/
|
|
52
|
-
echo "Create usage instructions"
|
|
53
|
-
cat > release/USAGE.txt << 'EOF'
|
|
54
|
-
# Python Template Project - macOS Distribution
|
|
55
|
-
|
|
56
|
-
This package contains:
|
|
57
|
-
|
|
58
|
-
1. **python-template-project** (Terminal executable)
|
|
59
|
-
- Run from Terminal for CLI interface
|
|
60
|
-
- Double-click will open Terminal and show menu
|
|
61
|
-
|
|
62
|
-
2. **Python Template Project.app** (macOS App Bundle)
|
|
63
|
-
- Double-click to launch GUI interface
|
|
64
|
-
- Can also be launched from Terminal: open "Python Template Project.app"
|
|
65
|
-
|
|
66
|
-
## Usage Examples:
|
|
67
|
-
|
|
68
|
-
### Command Line:
|
|
69
|
-
```bash
|
|
70
|
-
# Interactive mode (shows CLI/GUI selection)
|
|
71
|
-
./python-template-project
|
|
72
|
-
|
|
73
|
-
# Direct CLI mode with arguments
|
|
74
|
-
./python-template-project --help
|
|
75
|
-
./python-template-project [your-cli-args]
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### GUI Mode:
|
|
79
|
-
- Double-click "Python Template Project.app"
|
|
80
|
-
- Or run: open "Python Template Project.app"
|
|
81
|
-
|
|
82
|
-
EOF
|
|
83
|
-
echo "Create the ZIP archive from the contents of the release folder"
|
|
84
|
-
cd release
|
|
85
|
-
zip -r ../package-macOS.zip .
|
|
86
|
-
|
|
87
|
-
- name: Upload ZIP to GitHub Release
|
|
88
|
-
uses: softprops/action-gh-release@v2
|
|
89
|
-
if: startsWith(github.ref, 'refs/tags/')
|
|
90
|
-
with:
|
|
91
|
-
files: package-macOS.zip
|
|
92
|
-
env:
|
|
93
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
name: Rename the project from template
|
|
2
|
-
|
|
3
|
-
on: [push]
|
|
4
|
-
|
|
5
|
-
permissions: write-all
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
rename-project:
|
|
9
|
-
if: ${{ !contains (github.repository, '/python-template-project') }}
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
steps:
|
|
12
|
-
- uses: actions/checkout@v3
|
|
13
|
-
with:
|
|
14
|
-
# by default, it uses a depth of 1
|
|
15
|
-
# this fetches all history so that we can read each commit
|
|
16
|
-
fetch-depth: 0
|
|
17
|
-
ref: ${{ github.head_ref }}
|
|
18
|
-
|
|
19
|
-
- run: echo "REPOSITORY_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}' | tr '-' '_' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
|
|
20
|
-
shell: bash
|
|
21
|
-
|
|
22
|
-
- run: echo "REPOSITORY_URLNAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV
|
|
23
|
-
shell: bash
|
|
24
|
-
|
|
25
|
-
- run: echo "REPOSITORY_OWNER=$(echo '${{ github.repository }}' | awk -F '/' '{print $1}')" >> $GITHUB_ENV
|
|
26
|
-
shell: bash
|
|
27
|
-
|
|
28
|
-
- name: Is this still a template
|
|
29
|
-
id: is_template
|
|
30
|
-
run: echo "::set-output name=is_template::$(ls .github/template.yml &> /dev/null && echo true || echo false)"
|
|
31
|
-
|
|
32
|
-
- name: Rename the project
|
|
33
|
-
if: steps.is_template.outputs.is_template == 'true'
|
|
34
|
-
run: |
|
|
35
|
-
echo "Renaming the project with -a(author) ${{ env.REPOSITORY_OWNER }} -n(name) ${{ env.REPOSITORY_NAME }} -u(urlname) ${{ env.REPOSITORY_URLNAME }}"
|
|
36
|
-
.github/rename_project.sh -a ${{ env.REPOSITORY_OWNER }} -n ${{ env.REPOSITORY_NAME }} -u ${{ env.REPOSITORY_URLNAME }} -d "Awesome ${{ env.REPOSITORY_NAME }} created by ${{ env.REPOSITORY_OWNER }}"
|
|
37
|
-
|
|
38
|
-
- uses: pamagister/git-auto-commit-action@v4
|
|
39
|
-
with:
|
|
40
|
-
commit_message: "✅ Ready to clone and code."
|
|
41
|
-
# commit_options: '--amend --no-edit'
|
|
42
|
-
push_options: --force
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_template_project-0.1.18 → python_template_project-0.1.20}/.github/PULL_REQUEST_TEMPLATE.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_template_project-0.1.18 → python_template_project-0.1.20}/.github/release_message.sh
RENAMED
|
File without changes
|
{python_template_project-0.1.18 → python_template_project-0.1.20}/.github/workflows/main.yml
RENAMED
|
File without changes
|
{python_template_project-0.1.18 → python_template_project-0.1.20}/.github/workflows/release.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_template_project-0.1.18 → python_template_project-0.1.20}/docs/_static/img/favicon.png
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_template_project-0.1.18 → python_template_project-0.1.20}/docs/develop/contributing.md
RENAMED
|
File without changes
|
{python_template_project-0.1.18 → python_template_project-0.1.20}/docs/develop/make_windows.md
RENAMED
|
File without changes
|
{python_template_project-0.1.18 → python_template_project-0.1.20}/docs/develop/pypi_release.md
RENAMED
|
File without changes
|
{python_template_project-0.1.18 → python_template_project-0.1.20}/docs/getting-started/install.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_template_project-0.1.18 → python_template_project-0.1.20}/examples/rother_lilienstein.gpx
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|