Skip to content

manoelpqueiroz/python-project

Repository files navigation

Python Project

Python support PyPI Release Repository Releases Docker Licence Expand your project structure from atoms of code to galactic dimensions.

Contributions Welcome Open issues Merge Requests

Poetry Bandit Pre-commit Editorconfig Code style: Ruff isort Docstrings

Semantic versions Pipelines

Awesome python-project is a Python cli/package created with https://gitlab.com/manoelpqueiroz/galactipy

Very first steps

Initialize your code

  1. Initialize git inside your repo:
cd python-project && git init
  1. If you don't have Poetry installed run:
invoke poetry-download

This installs Poetry as a standalone application. If you prefer, install it through your distribution's package manager.

  1. Initialize Poetry and install pre-commit hooks:
invoke install
invoke pre-commit-install
  1. Run the codestyle:
invoke codestyle
  1. Upload initial code to GitHub:
git add .
git commit -m ":tada: Initial commit"
git branch -M main
git remote add origin https://github.com/manoelpqueiroz/python-project.git
git push -u origin main

Set up bots- Set up Dependabot to ensure you have the latest dependencies;

  • Set up Stale bot for automatic issue closing.

Poetry

Want to know more about Poetry? Check its documentation.

Details about Poetry

Poetry's commands are very intuitive and easy to learn, like:

  • poetry add numpy@latest
  • poetry run pytest
  • poetry publish --build

etc.

Building and releasing your package

In order to release a new version of the application, a few steps are needed.

First, the new version to be published must be set. Unless you are to publish your package's first version, which Galactipy already sets for you, you should use:

poetry version <version>

You can pass the new version explicitly, or a rule such as major, minor, or patch. For more details, refer to the Semantic Versions standard.

Make sure you have a PyPI account and generate an API token, you can then register it in your repository with

invoke pypi-config <API_token>

Then, you're all good to build and publish your package in one go!

invoke publish

You should also push a tag to GitLab or GitHub and create a Release for your application on the platform to ensure users can check the latest version contents.

Of course, you can also rely solely on the CI tools provided by Galactipy to handle building, publishing and releasing automatically, with minimal configuration required! πŸ₯³

🎯 What's next

Well, that's up to you. πŸ’ͺ

For further setting up your project:

  • Look for files and sections marked with UPDATEME, these should be updated according to the needs and characteristics of your project;

    • If you use VS Code, install the Todo Tree extension to easily locate and jump to these marks, they are already configured in your settings.json file;
  • Make sure to create your desired Issue labels on your platform before you start tracking them so it ensures you will be able to filter them from the get-go;

  • Make changes to your CI configurations to better suit your needs.

  • In order to reduce user prompts and keep things effective, the template generates files with a few assumptions:

    • It assumes your main git branch is master. If you wish to use another branch name for development, be aware of changes you will have to make in the Issue and Merge Request templates and README.md file so links won't break when you push them to your repo;
    • It generates a PyPI badge assuming you will be able to publish your project under python-project, change it otherwise;
    • It generates a Docker badge assuming you also use manoelpqueiroz for Docker Hub and you will push your image under python-project, change it otherwise;

If you want to put your project on steroids, here are a few Python tools which can help you depending on what you want to achieve with your application:

  • Typer is great for creating CLI applications;
  • Rich makes it easy to add beautiful formatting in the terminal;
  • tqdm is a fast, extensible progress bar for Python and CLI;
  • Python Prompt Toolkit allows you to create more advanced terminal applications, such as a text editor or even your own shell;
  • orjson, an ultra fast JSON parsing library;
  • Pydantic is data validation and settings management using Python type hinting;
  • Returns makes you function's output meaningful, typed, and safe;
  • Loguru makes logging (stupidly) simple;
  • IceCream is a little library for sweet and creamy debugging;
  • Hydra is a framework for elegantly configuring complex applications;
  • FastAPI is a type-driven asynchronous web framework.

For taking development and exposition of your project to the next level:

  • Try out some more badges, not only it looks good, but it also helps people better understand some intricate details on how your project works:
    • You can look at dynamic badges available at Shields.io;
    • There is a myriad of standardised static badges at Simple Badges;
    • awesome-badges provides a lot of useful resources to help you deal with badges;
  • Setup a code coverage service for your tests, popular options include:
  • Add your project to [OpenSSF Best Practices][wno1] and [OSSRank][wno2] indexes. If you have greater ambitions for your project and/or expects it to scale at some point, it's worth considering adding it to these trackers;
    • There are already badges for those set up in your README.md file, just waiting for you to update their URLs with your project's index in both services :beaming_face_with_smiling_eyes:
  • Setup a sponsorship page and allow users and organisations who appreciate your project to help raise for its development (and add a badge in the process! 😎). Popular platforms are:

And here are a few articles which may help you:

πŸš€ Features

Development features

Deployment features

  • Issue and Pull Request templates for easy integration with GitHub;
  • Predefined CI/CD build workflow for Github Actions;
  • Automatic package uploads to PyPI test and production repositories;
  • Everything is already set up for security checks, codestyle checks, code formatting, testing, linting, docker builds etc with Invoke. More details in Invoke Usage;
  • Dockerfile for your package;- Always up-to-date dependencies with Dependabot. You will only need to enable it;
  • Automatic drafts of new releases with Release Drafter. You may see the list of labels in release-drafter.yml. Works perfectly with Semantic Versions specification.

Open source community features

  • Ready-to-use Pull Request templates and several Issue templates;
  • Files such as: LICENCE, CONTRIBUTING.md, CODE_OF_CONDUCT.md, and SECURITY.md are generated automatically;
  • Loads of predefined badges to make your project stand out, you can either keep them, remove as you wish or be welcome to add even more;
  • Stale bot closes abandoned issues after a period of inactivity. Configuration is here;
  • Semantic Versions specification with Release Drafter.

Installation

pip install -U python-project

or install with Poetry:

poetry add python-project

Then you can run

python-project --help

or with Poetry:

poetry run python-project --help

Invoke usage

invoke contains a lot of functions for faster development.

1. Download or remove Poetry

To download and install Poetry as a standalone application run:

invoke poetry-download

To uninstall

invoke poetry-remove

Alternatively, you can install it via your package manager (preferred) or any method provided by the documentation.

2. Install all dependencies and pre-commit hooks

Install requirements with

invoke install

And then add Poetry plugins to make development easier with

invoke poetry-plugins

Pre-commit hooks could be installed after git init via

invoke pre-commit-install

3. Codestyle

Automatic formatting uses ruff, and can be run with

invoke codestyle

# or use synonym
invoke format

For formatting checks only, without rewriting files:

invoke codestyle --check

Aside from the formatter, you can also use ruff to lint project files with several preconfigured rules defined in pyproject.toml:

invoke check-linter

4. Code security

invoke check-safety

This command launches Poetry integrity checks as well as identifies security issues with Safety and Bandit.

Update all dev libraries to the latest version using one command:

invoke update-dev-deps

5. Type checks

Run mypy static type checker with

invoke mypy

6. Tests

Run pytest with all essential parameters predefined with

invoke test

7. All code-related checks

Of course there is a command to rule run all linters in one:

invoke sweep

The same as:

invoke test check-linter codestyle mypy check-safety

8. Docker

Build your Docker image with the latest tag preconfigured with

invoke docker-build

Remove docker image with

invoke docker-remove

More information about Docker here.

9. Cleanup

Delete pycache files:

invoke pycache-remove

Remove package build:

invoke build-remove

Delete .DS_STORE files:

invoke dsstore-remove

Remove .mypycache:

invoke mypycache-remove

Or to remove all above run:

invoke cleanup

πŸ“ˆ Releases

You can see the list of available releases on the GitHub Releases page.

We follow Semantic Versions specification.

We use Release Drafter. As pull requests are merged, a draft release is kept up-to-date listing the changes, ready to publish when you’re ready. With the categories option, you can categorize pull requests in release notes using labels.

List of labels and corresponding titles

Label Title in Releases
enhancement, feature πŸš€ Features
bug, refactoring, bugfix, fix πŸ”§ Fixes & Refactoring
build, ci, testing πŸ“¦ Build System & CI/CD
breaking πŸ’₯ Breaking Changes
documentation πŸ“ Documentation
dependencies ⬆️ Dependencies updates

You can update it in release-drafter.yml.

GitHub creates the bug, enhancement, and documentation labels for you. Dependabot creates the dependencies label. Create the remaining labels on the Issues tab of your GitHub repository, when you need them.

πŸ›‘οΈ Licence

Licence

This project is licenced under the terms of the MIT licence. See LICENCE for more details.

πŸ“ƒ Citation

@misc{Python Project,
  author = {Manoel Pereira de Queiroz},
  title = {Awesome `python-project` is a Python cli/package created with https://gitlab.com/manoelpqueiroz/galactipy},
  year = {2025},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/manoelpqueiroz/python-project}}
}

Credits Expand your project structure from atoms of code to galactic dimensions.

This project was generated with galactipy.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published