Docs: add 'Publishing a Python Script on GitHub' section with step-by-step instructions.

This commit is contained in:
Mike Geppert 2025-08-08 22:42:36 -05:00
parent 5784a0b414
commit 3f78ff0bd7

View File

@ -257,4 +257,50 @@ The script generates several output files:
## License
This project is licensed under the MIT License - see the LICENSE file for details.
This project is licensed under the MIT License - see the LICENSE file for details.
## Publishing a Python Script on GitHub
This project already uses git. If you are asking generally “what has to happen to publish a Python script on GitHub?”, here is a concise checklist you can follow for this or any Python script.
Prerequisites:
- A GitHub account
- Git installed locally (git --version)
Basic steps (new project):
1. Create/prepare your project directory
- Include: README.md, your .py files, optional LICENSE, optional requirements.txt
2. Initialize git and make the first commit
- git init
- git add .
- git commit -m "Initial commit"
- Optionally set the default branch to main: git branch -M main
3. Create a new, empty repository on GitHub
- In your browser: New repository → name it (e.g., TasmotaManager) → Create repository (do not add README if you already have one locally)
4. Add the GitHub remote and push
- git remote add origin https://github.com/<your-username>/<your-repo>.git
- git push -u origin main
If you already have a local git repo (like this one):
- Ensure your latest work is committed: git add -A && git commit -m "Your message"
- Optionally rename your current branch to main: git branch -M main
- Create the GitHub repo (empty) via the web UI
- Add remote and push:
- git remote add origin https://github.com/<your-username>/<your-repo>.git
- git push -u origin main
Recommended extras:
- .gitignore for Python (to avoid committing virtualenvs, __pycache__, etc.)
- See GitHubs Python template: https://github.com/github/gitignore/blob/main/Python.gitignore
- Save it as .gitignore at the project root, then commit it
- LICENSE file so others know how they can use your code (MIT, Apache-2.0, etc.)
- requirements.txt if your script uses external packages (pip freeze > requirements.txt or hand-curate)
- A brief Usage section in README with example commands
Optional but useful:
- Create a release tag once you reach a stable point:
- git tag -a v1.0.0 -m "First stable release"
- git push origin v1.0.0
- Enable GitHub Actions for basic CI (tests/linters). Example starter workflow: https://github.com/actions/starter-workflows/blob/main/ci/python-package.yml
Thats all that has to happen to publish a Python script on GitHub: have a local git repository, connect it to a new GitHub repository (remote), and push your commits. After that, you can collaborate, open issues/PRs, and manage releases directly on GitHub.