Skip to content

kobozo/poetry-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Poetry Template Project

This repository serves as a template for starting new Python projects with Poetry, pre-configured with code quality tools and pre-commit hooks.

Getting Started

Follow these steps to set up your project:

1. Fork or Use This Repository as a Template

  1. Fork the Repository:

    • Go to the repository page.
    • Click the "Fork" button on the top right to create a copy of the repository under your GitHub account.
  2. Use as a Template:

    • Go to the repository page.
    • Click the "Use this template" button.
    • Follow the prompts to create a new repository based on this template.

2. Change Project Name and Author

  1. Open pyproject.toml in the root directory.
  2. Update the [tool.poetry] section with your project's details:
    [tool.poetry]
    name = "your_project_name"
    version = "0.1.0"
    description = "A short description of your project"
    authors = ["Your Name <[email protected]>"]

3. Install Poetry

If you haven't installed Poetry yet, follow the instructions here.

4. Install Dependencies

Navigate to the project directory and install the dependencies:

poetry install

This will create a virtual environment and install the necessary packages.

5. Set Up Pre-commit Hooks

To ensure code quality and consistency, follow these steps to install and configure pre-commit hooks:

poetry run pre-commit install

6. Update Packages to the Latest Version

To update the packages to their latest versions:

poetry update

This will update all dependencies in your pyproject.toml file to their latest compatible versions.

Configuration

Default Python Version

The default Python version is set to 3.11 in the pre-commit configuration. If you need to change this, update the default_language_version in the .pre-commit-config.yaml file.

Pre-commit Hooks

The pre-commit hooks configured in this template include:

You can customize these hooks by editing the .pre-commit-config.yaml file.

Manually Run Pre-commit Hooks

To manually run all the pre-commit hooks on your codebase, use:

poetry run pre-commit run

This command runs the pre-commit hooks on the files that have been changed since the last commit.

To run the pre-commit hooks on all files in the repository, use:

poetry run pre-commit run --all-files

This command is useful when you want to apply the hooks to the entire codebase, ensuring all files meet the defined code quality and formatting standards.

Running Unit Tests

To run unit tests:

poetry run pytest

Contributing

Feel free to open issues or submit pull requests if you have suggestions for improvements or if you encounter any bugs.

License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.

About

A Template Repository For Poetry Projects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages