galactipy
Expand your project structure from atoms of code to galactic dimensions. 🌌
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
â—‹DOI references
-
â—‹Academic publication links
-
â—‹Academic email domains
-
â—‹Institutional organization owner
-
â—‹JOSS paper metadata
-
â—‹Scientific vocabulary similarity
Low similarity (13.3%) to scientific vocabulary
Keywords
Repository
Expand your project structure from atoms of code to galactic dimensions. 🌌
Basic Info
- Host: GitHub
- Owner: manoelpqueiroz
- License: mit
- Language: Python
- Default Branch: github-mirror
- Homepage: https://gitlab.com/manoelpqueiroz/galactipy
- Size: 1.79 MB
Statistics
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 0
- Releases: 0
Topics
Metadata Files
README.md
Galactipy
TL;DR
bash
cookiecutter gl:galactipy/galactipy --checkout v0.15.0
All you need is the latest version of cookiecutter! :wink:
:rocket: Features
In this cookiecutter :cookie: template we combine state-of-the-art libraries and best development practices for Python.
Development features
- Supports
Python 3.9and higher; - Provides
minimal boilerplate code
for CLI/TUI applications
with
TyperandTextual-- or no code at all, you choose! - Uses
Poetryas the dependency manager and extends functionality withdynamic versioning,virtual environment bundling, dependencyexportandupdate resolution; see configuration inpyproject.toml; - Automatic code formatting with
ruff, with ready-to-usepre-commithooks and several rules already selected for linting; - Type checks with
mypy, security checks withsafetyandbandit; - Testing with
pytestand an option to usebehaviour-driven developmentfor managing scenarios; more details in Applying BDD to Your Project; - Code quality integrations with either
Coverallsfor more basic test coverage orCodacyfor full code analysis, both integrated into your project's workflow via CI/CD; - Predefined VS Code
settings.jsonwith quality-of-life configuration for editor, workbench, debugging and more; - Ready-to-use
.editorconfig,.dockerignoreand.gitignorefiles. You don't have to worry about those things.
Deployment features
- Predefined CI/CD build workflow with
GitLab CIandGithub Actions; - Automatic package uploads to
PyPItest 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; Dockerfilefor your package, with CI/CD workflows to publish your image to a container registry.- Semantic Versions specification with
Changelog entriesorRelease Drafter.
Project management features
- Ready-to-use Merge Request templates and several Issue templates for easy integration with GitLab and GitHub;
- Workflows to mark and close abandoned issues after a period of inactivity for both GitLab with
Triage Policiesand GitHub withStale Bot; - Option to choose between Gitmoji, Conventional Commits or a mix of both to standardise your commit titles.
Open source community features
- Files such as:
LICENCE,CONTRIBUTING.md,CODE_OF_CONDUCT.md,CITATION.cffandSECURITY.mdare generated automatically; - Loads of predefined badges to make your project stand out: project info, contributions, development practices, development tools and QA status; you can either keep them, remove as you wish or be welcome to add even more.
GitLab vs. GitHub feature comparison chart
You are free to choose whichever platform works best for you and your project. The original template by TezRomacH was created originally with GitHub in mind, which prompted the creation of a similarly fully-featured template for GitLab users as well.
However, not everything that is available for GitHub users is available to GitLab users, and vice-versa. Please mind the differences between both options.
Below is a comparison between the features available in this package depending on which platform you choose to host your project:
| Feature | GitLab | GitHub | Observations |
| :---------------------------: | :----------------: | :----------------: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Issue templates | :whitecheckmark: | :whitecheckmark: | Both options feature automatic labels, but GitHub has an extra configuration to prevent the creation of empty issues. |
| Merge/pull requests templates | :whitecheckmark: | :whitecheckmark: | |
| Project conditions checks | :whitecheckmark: | :whitecheckmark: | A basic workflow to install the package and run tests, check codestyle and safety. |
| Publication to TestPyPI | :whitecheckmark: | :whitecheckmark: | For GitHub, the workflow uses the official PyPI Publish action, while GitLab CI uses the PyPI API. |
| Publication to PyPI | :whitecheckmark: | :whitecheckmark: | For GitHub, trusted publishing is used with the PyPI Publish action, while GitLab CI uses the PyPI API. |
| Image publication | :whitecheckmark: | :whitecheckmark: | For GitHub, images are pushed to Docker Hub, while GitLab CI pushes images to the repository's Container Registry by default (and can be reconfigured). |
| Snapshot images | :whitecheckmark: | :x: | For GitLab, the Docker CI/CD component is used and allows for pushing snapshot images for testing when a Merge Request is open. |
| Dockerfile linting | :whitecheckmark: | :x: | The Docker GitLab CI/CD component includes a job for linting the Dockerfile with Hadolint. |
| Image vulnerability analysis | :whitecheckmark: | :x: | The Docker GitLab CI/CD component uses Trivy to scan the image for vulnerabilities. |
| SBOM files | :whitecheckmark: | :x: | The Docker GitLab CI/CD component generates a bill of materials with CycloneDX. |
| Stale issues | :whitecheckmark: | :whitecheckmark: | GitLab rules are more flexible, marking stale issues only for those not opened by project members. |
| Greetings workflow | :x: | :whitecheckmark: | GitHub provides workflows to automatically reply to issues and merge requests with the First Interaction action. |
| Dependabot | :x: | :whitecheckmark: | Dependabot is a feature now incorporated into GitHub Security. See here how to enable it. |
| Release drafter | :x: | :whitecheckmark: | Release Drafter is a custom workflow available on GitHub Marketplace. You may see the list of labels in release-drafter.yml. Works perfectly with Semantic Versions specification. |
| Changelog configuration | :whitecheckmark: | :x: | GitLab provides automatic changelog updates through their API. You may modify the template in changelog_config.yml. |
| Test Reports | :whitecheckmark: | :x: | JUnit XML reports are supported by GitLab to allow test reports to be displayed in pipelines and merge requests. |
| CI control over pushed tags | :whitecheckmark: | :warning: | GitLab provides full control for tags pushed to the repository using regex, while GitHub Actions is more restricted in how it filters workflows to run, and can only apply these filters at the top level, limiting workflow customization. |
:exploding_head: How to use it
Installation
To begin using the template consider updating cookiecutter.
bash
pip install -U cookiecutter
then go to a directory where you want to create your project and run:
bash
cookiecutter gl:galactipy/galactipy --checkout v0.15.0
Input variables
Cookiecutter will ask you to fill some variables in order to generate the files with everything you need already set up.
The input variables, with their default values, are as follows:
| Parameter | Default value | Description |
| :----------------------: | :-------------------------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| project_name | Python Project | A suitable name by which people will refer to, you are free to name it however you wish to. |
| repo_name | based on project_name | Name of the repository to develop the project on. Check the availability of possible names before creating the project. |
| package_name | based on project_name | PyPI-compliant Python package name. Check the availability of possible names before creating the project. |
| project_description | based on project_name | A brief description of your project. |
| author | Manoel Pereira de Queiroz | Name of the author or organisation. Used to generate LICENCE and to specify ownership in pyproject.toml. |
| scm_platform | GitLab | One of GitLab and GitHub. Depending on the choice you will have different features to work with. |
| scm_username | manoelpqueiroz | GitHub or GitLab username for hosting. Also used to set up README.md, pyproject.toml and template files for either platform. |
| email | based on scm_username | Email for CODE_OF_CONDUCT.md, SECURITY.md files and to specify the ownership of the project in pyproject.toml. |
| licence | MIT | One of MIT, BSD-3, GNU GPL v3.0, GNU AGLP v3.0, GNU LGPL v3.0, Mozilla Public License 2.0 and Apache Software License 2.0, or Not open source. |
| minimal_python_version | 3.9 | Minimal Python version. All versions since 3.9 are available to choose. It is used for builds, pipelines and formatters. |
| use_ruff | True | :smallredtriangle: Option to use ruff as the code formatter, along with a pre-commit hook. |
| line_length | 88 | The max length per line, dismiss if use_ruff is not used. NOTE: This value must be between 50 and 300. |
| docstring_style | numpy | One of numpy, pep257 or google, dismiss if use_ruff is not used. You can choose other to disable checks on your docstrings. |
| docstring_length | based on line_lenght | The max length for docstrings, dismiss if use_ruff is not used. NOTE: This value must be between 50 and 300 and lower of equal to line_lenght. |
| use_bdd | True | :smallredtriangle: Option to use behaviour-driven development for managing tests. |
| coverage_service | Coveralls | One of Coveralls for code coverage and Codacy for code quality and static analysis. |
| app_type | True | One of Integrated CLI+TUI for a straight TUI application, Hybrid CLI/TUI for a CLI application with a preset TUI command, CLI-only application with minimal app configuration and Bare repository for no sample files at all. Employs Typer and Textual as libraries.
| create_docker | True | :smallredtriangle: Option to create a Dockerfile to build an image for your project. |
:eightspokedasterisk: Input variables marked with :smallredtriangle: are boolean variables, you can dismiss those by typing either
0,false,f,no,noroff.
All input values will be saved in the cookiecutter-config-file.yml file so that you won't lose them. :wink:
Demo
More details
Your project will contain README.md file with instructions for development, deployment etc. You can read the project README.md template before.
Initial set up
Initialize poetry
By running invoke install
After you create a project, it will appear in your directory, and will display a message about how to initialize the project.
Initialize pre-commit
By running invoke pre-commit-install. Make sure to set up git first via git init.
Package example
Want to know more about Poetry? Check its documentation.
Details about Poetry
Poetry's [commands][htu6] are very intuitive and easy to learn, like: - `poetry add numpy@latest` - `poetry run pytest` - `poetry publish --build` etc.
Sample Application
Galactipy is best used
for terminal applications,
either a TUI
or a simple CLI interface.
If you choose any of the options for app_type
excluding Bare repository,
your project will embed Typer
as a dependency,
and Textual will be provided for
the Integrated CLI+TUI and Hybrid CLI/TUI options.
For any of the options providing an interface,
you can call the application
after installation
via invoke install (preferred) or poetry install:
bash
poetry run <repo_name> --help
bash
poetry run <repo_name> --version
Then you can use the structure provided with Galactipy to build your application upon the barebones codebase. :smile:
Building and releasing your package
In order to release a new version of the application, a few steps are needed.
Make sure you have a PyPI account and generate an API token, you can then register it in your repository with
bash
invoke pypi-config <API_token>
Then, you're all good to build and publish your package in one go!
bash
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! :partying_face:
If you have generated your project with the Docker option enabled, pushing a tag to your repository will also set up the automated workflows to build and publish your image to a container registry.
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][htu8] run: ```bash invoke poetry-download ``` To uninstall ```bash invoke poetry-remove ``` Alternatively, you can install it via your package manager (preferred) or any method provided by the [documentation][htu9].
2. Install all dependencies and pre-commit hooks
Install requirements with ```bash invoke install ``` And then add Poetry plugins to make development easier with ```bash invoke poetry-plugins ``` Pre-commit hooks could be installed after `git init` via ```bash invoke pre-commit-install ```
3. Codestyle
Automatic formatting uses `ruff`, and can be run with ```bash invoke codestyle # or use synonym invoke format ``` For formatting checks only, without rewriting files: ```bash invoke codestyle --check ``` Aside from the formatter, you can also use `ruff` to lint project files with several preconfigured rules defined in `pyproject.toml`: ```bash invoke check-linter ```
4. Code security
```bash 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: ```bash invoke update-dev-deps ```
5. Type checks
Run `mypy` static type checker with ```bash invoke mypy ```
6. Tests
Run `pytest` with all essential parameters predefined with ```bash invoke test ```
7. All code-related checks
Of course there is a command to ~~rule~~ run all checks in one: ```bash invoke sweep ``` The same as: ```bash invoke test check-linter codestyle mypy check-safety ```
8. Docker
Build your Docker image with the `latest` tag preconfigured with ```bash invoke docker-build ``` Remove the Docker image with ```bash invoke docker-remove ``` More information about Docker [here][htu10].
9. Cleanup
Delete pycache files: ```bash invoke pycache-remove ``` Remove package build: ```bash invoke build-remove ``` Delete .DS_STORE files: ```bash invoke dsstore-remove ``` Remove .mypycache: ```bash invoke mypycache-remove ``` Or to remove all above run: ```bash invoke cleanup ```
Applying BDD to Your Project
Behaviour-driven development is a software development paradigm in which domain language is used to describe the behaviour of the code. It sprang up from test-driven development.
If you choose to use BDD for your project, a features directory will be created under tests and pytest-bdd will be added as a dependency. You should place .feature files inside this folder to specify tests and describe scenarios using the Gherkin language:
```
tests/features/root_command.feature
Feature: Command-line interface
Scenario: Invoke with version argument
When the program is called with the --version argument
Then the program's version is displayed
And the program is terminated without errors
```
You would then use pytest-bdd to wrap each scenario referred in the feature file as a step by step validation:
```py from typer.testing import CliRunner from pythonproject.cli.rootcommand import app from pytest_bdd import scenario, when, then, parsers
runner = CliRunner()
@scenario("rootcommand.feature", "Invoke with version argument") def testappwithversion_arg(): pass
@when("the program is called with the --version argument", targetfixture="apprun")
def invokeversionarg():
return runner.invoke(app, args=["--version"])
@then("the program's version is displayed") def versiondisplay(apprun, versionstring): assert apprun.stdout == version_string
@then("the program is terminated without errors") def successfultermination(apprun): assert apprun.exitcode == 0 ```
Then you can simply use pytest as you normally would to run the test suite and check the results.
For more information on behaviour-driven development and more advanced cases, please check out the Cucumber documentation.
:dart: What's next
Well, that's up to you. :muscle:
For further setting up your project:
- Look for files and sections marked with
TODO(which must be addressed in order for your project to run properly) andUPDATEME(optional settings if you feel inclined to);- If you use VS Code, install the
Todo Treeextension to easily locate and jump to these marks, they are already configured in thesettings.jsonfile;
- If you use VS Code, install the
- 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 andREADME.mdfile 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
repo_name, change it otherwise; - It generates a Docker badge assuming you also use
scm_usernamefor Docker Hub and you will push your image underrepo_name, change it otherwise;
- It assumes your main git branch is
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:
Richmakes it easy to add beautiful formatting in the terminal. If you chose to generate a TUI or CLI example during the Cookiecutter setup,Richwill already be among your dependencies;tqdmis a fast, extensible progress bar for Python and CLI;orjson, an ultra fast JSON parsing library;Pydanticis data validation and settings management using Python type hinting;Returnsmakes you function's output meaningful, typed, and safe;Logurumakes logging (stupidly) simple;IceCreamis a little library for sweet and creamy debugging;Hydrais a framework for elegantly configuring complex applications;FastAPIis 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-badgesprovides a lot of useful resources to help you deal with badges;
- You can look at dynamic badges available at
- Add your project to
OpenSSF Best PracticesandOSSRankindexes. 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.mdfile, just waiting for you to update their URLs with your project's index in both services; :grinning:
- There are already badges for those set up in your
- 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! :sunglasses:). Popular platforms are:
Liberapay;Open Collective;Ko-fi;- If you host on GitHub, you can set a Sponsors account directly integrated into the platform;
- Of course, you can also set any kind of gateway you wish, what works best for you and your project!
- If you are unsure about the versioning logic to use, check this list with a plethora of options to choose from.
And here are a few articles which may help you:
- Open Source Guides;
- A handy guide to financial support for open source;
- GitLab CI Documentation;
- GitHub Actions Documentation;
- A Comprehensive Look at Testing in Software Development is an article that lays out why testing is crucial for development success. Eric's blog is actually a great reference, covering topics ranging from the basics to advanced techniques and best practices;
- Robust Exception Handling;
- Why Your Mock Doesn't Work;
- Managing TODOs in a codebase.
:chartwithupwards_trend: Galactipy Releases
You can see the list of available releases on the GitLab Releases page.
We follow Intended Effort Versioning specification, details can be found in our
CONTRIBUTING guide.
:map: Roadmap
Galactipy's roadmap is managed through our Milestones page, which lays out the
current development streams mapped for delivery. All official details on development,
timeline and deliverables are found through those pages. The project's milestones are
also presented in the ROADMAP file purely for informational purposes.
:shield: Licence
This project is licenced under the terms of the MIT licence. See LICENCE for more details.
:sports_medal: Acknowledgements
Firstly, there is no way this template would exist without the previous phenomenal work by Roman Tezikov and his fully-featured python-package-template. If there is anyone more deserving of a :star2: and acknowledgement, it's him! Please give a shoutout and support if possible.
The original template was inspired by several articles that might be helpful if you are starting out managing projects:
- Hypermodern Python;
- Ultimate Setup for Your Next Python Project;
- Nine simple steps for better-looking python code;
- Modern Python developer's toolkit.
And also there are some projects which can be studied as references in project management and template design:
Cookiecutter;- Audreyr's
cookiecutter-pypackage; - Cookiecutter Data Science Template:
cdst; - Full Stack FastAPI and PostgreSQL - Base Project Generator;
- The importance of layered thinking in data engineering.
Additionally, we would like to thank the teams of the following projects for either aiding us directly during our research of best practices and tools for Python development or whose documentation have inspired parts of the project:
Give them your :star:, these resources are amazing! :wink:
Galactipy Bot avatar created by Smashicons.
:pagewithcurl: Citation
We provide a CITATION.cff file to make it easier to cite this project in your
paper.
:mega: Spread the Word
Add the badge to your project! It would be really appreciated to spread the word of this template.
Here is the Markdown source for it:
markdown
[](https://kutt.it/7fYqQl)
We would be equally grateful if you could also do any of the following:
- Set the notification level to "Watch" to receive our latest updates; :bell:
- Star the project! :star2:
- Share the project with colleagues; :speaking_head:
- Write a short article on how you are using Galactipy on your projects; :pencil2:
- Share best practices, references and tools for project management with us! :beers:
Owner
- Name: Manoel Pereira de Queiroz
- Login: manoelpqueiroz
- Kind: user
- Repositories: 18
- Profile: https://github.com/manoelpqueiroz
Citation (CITATION.cff)
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!
cff-version: 1.2.0
title: Galactipy
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- given-names: Manoel
family-names: Pereira de Queiroz
email: mpq.dev@pm.me
- given-names: Roman
family-names: Tezikov
email: tez.romach@gmail.com
- given-names: Simon
family-names: Otziger
email: 3603495+volemont@users.noreply.github.com
- given-names: Alexandre
family-names: Bassel
email: 11035784+abassel@users.noreply.github.com
- given-names: Chen
family-names: Shijiang
email: chenshijiang@evision.ai
- given-names: Sebastian
family-names: Thurm
email: 65230277+N720720@users.noreply.github.com
- given-names: Vsevolod
family-names: Poletaev
email: poletaev.va@gmail.com
- given-names: Mou
family-names: Chenghao
email: mouchenghao@gmail.com
- given-names: Peter
family-names: Kogan
email: kogan.peter@gmail.com
- given-names: Philipp
family-names: Tempel
email: git@philipptempel.me
- given-names: John
family-names: Hagen
email: johnthagen@users.noreply.github.com
repository-code: 'https://www.gitlab.com/galactipy/galactipy'
repository: 'https://github.com/galactipy/galactipy'
abstract: >-
Full-fledged template for Python projects. Combines
state-of-the-art libraries and best development practices
for Python.
keywords:
- python
- cookiecutter
- template
- packages
- best-practices
- poetry
- codestyle
- formatters
- python-packages
- semantic-versions
license: MIT
commit: 26e8abffc6648d88f3845ed73192f2f79bab55ff
version: v0.15.0
date-released: '2025-04-29'
GitHub Events
Total
- Delete event: 6
- Push event: 63
- Create event: 21
Last Year
- Delete event: 6
- Push event: 63
- Create event: 21
Dependencies
- python {{ build
- cookiecutter ^2.3.0
- python ^3.8