Skip to main content

A project template to use for new Python Github repositories with best practices.

Project description

A project template for Python

use-this-repo-badge Code Quality pre-commit security: bandit latest release

Introduction: This repository provides a comprehensive project template for GitHub repositories. It's designed to streamline the setup process, ensuring best practices and essential components are included. By using this template, you can ensure a consistent and professional structure for your projects, making them more accessible and maintainable.

Usage

Create a new repository from this template

  1. Click here to create a new repository with this template.
  2. Select and Add a license.

Initialize and install pre-commit hooks

  1. Install pre-commit. (skip this step if you already have pre-commit installed)
  2. Run pre-commit install to install the pre-commit hooks.
  3. Run make pre-commit to run the pre-commit hooks on all files.

Setup GitHub Branch Protection

  1. Go to Settings > Branches > Branch protection rules > Add rule
  2. Add the following rules:
    • main
      • Require a pull request before merging
      • Require status checks to pass before merging
      • Require branches to be up-to-date before merging
      • Add linting status checks ( and others if you created them )
      • Do not allow bypassing the above settings
    • dev
      • Require a pull request before merging
      • Require status checks to pass before merging
      • Add linting status checks ( and others if you created them )

Why Branch Protection?: Branch protection ensures that changes to important branches undergo a review process. This maintains code quality and prevents potential issues from being merged.

Branching Strategy

  • main: The main branch. This branch is protected and cannot be pushed directly. (PRs must be made to dev instead of main)
  • dev: The development branch. This branch is protected and cannot be pushed directly. (PRs must be made to this branch)
  • feature/*: The 'feature/*' branches are used to develop new features for the upcoming or a distant future release. These branches are branched off from 'dev' and must merge back into dev.
  • release/*: The 'release/*' branches are used to prepare the next release. They allow for last-minute changes and minor bug fixes. These branches are branched off from 'dev' and must merge back into main and dev.
  • hotfix/*: The 'hotfix/*' branches are used to develop fixes for the current release. These branches are branched off from main and must merge back into main.

How to create a python package with this template? (WIP)

  1. Create a new repository from this template. ( see Create a new repository from this template)
  2. Place your package code in the src directory.
  3. Update the pyproject.toml file with your package details.
  4. Set up your PyPI account and create a new API token. (see PyPI Help #api-token)
    1. Go to PyPI and create an account, if you don't have one already.
    2. Generate a PyPI API token. (see PyPI Help #api-token), this gives you something similar to this:
    3. run poetry config pypi-token.pypi <your-api-token> to set the API token.
  5. run poetry build to build the package.
  6. run poetry publish to publish the package to PyPI.

Contributing

Contributions are always welcome! Whether it's bug reports, feature requests, or pull requests, all contributions are appreciated. For more details, see CONTRIBUTING.md.

License

This project is licensed under some License. For more details, see LICENSE.

Code of Conduct

We believe in fostering an inclusive and respectful community. For guidelines and reporting information, see CODE_OF_CONDUCT.md.

Security

Your security is paramount. If you discover any security-related issues, please follow the guidelines in SECURITY.md.

Founding

For information about the project's founding and backers, see FOUNDING.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page