Giter Club home page Giter Club logo

python-package-template's Introduction

Python Packages Project Generator

Build status Dependencies Status πŸš€ Your next Python package needs a bleeding-edge project structure.

Code style: black Pre-commit Semantic Versions License Coverage Report

Your next Python package needs a bleeding-edge project structure.

TL;DR

cookiecutter gh:TezRomacH/python-package-template --checkout v1.1.1

All you need is the latest version of cookiecutter πŸ˜‰

πŸš€ Features

In this cookiecutter πŸͺ template we combine state-of-the-art libraries and best development practices for Python.

Development features

Deployment features

Open source community features

🀯 How to use it

Installation

To begin using the template consider updating cookiecutter

pip install -U cookiecutter

then go to a directory where you want to create your project and run:

cookiecutter gh:TezRomacH/python-package-template --checkout v1.1.1

Input variables

Template generator will ask you to fill some variables.

The input variables, with their default values:

Parameter Default value Description
project_name python-project Check the availability of possible name before creating the project.
project_description based on the project_name Brief description of your project.
organization based on the project_name Name of the organization. We need to generate LICENCE and to specify ownership in pyproject.toml.
license MIT One of MIT, BSD-3, GNU GPL v3.0 and Apache Software License 2.0.
minimal_python_version 3.7 Minimal Python version. One of 3.7, 3.8 and 3.9. It is used for builds, GitHub workflow and formatters (black, isort and pyupgrade).
github_name based on the organization GitHub username for hosting. Also used to set up README.md, pyproject.toml and template files for GitHub.
email based on the organization Email for CODE_OF_CONDUCT.md, SECURITY.md files and to specify the ownership of the project in pyproject.toml.
version 0.1.0 Initial version of the package. Make sure it follows the Semantic Versions specification.
line_length 88 The max length per line (used for codestyle with black and isort). NOTE: This value must be between 50 and 300.
create_example_template cli If cli is chosen generator will create simple CLI application with Typer and Rich libraries. One of cli, none

All input values will be saved in the cookiecutter-config-file.yml file so that you won't lose them. πŸ˜‰

Demo

Demo of github.com/TezRomacH/python-package-template

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 make 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 make 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 are very intuitive and easy to learn, like:

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

etc

CLI example

If you set create_example_template to be cli the template comes with a cute little CLI application example. It utilises Typer and Rich for CLI input validation and beautiful formatting in the terminal.

After installation via make install (preferred) or poetry install you can try to play with the example:

poetry run <project_name> --help
poetry run <project_name> --name Roman

Building and releasing your package

Building a new version of the application contains steps:

  • Bump the version of your package 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 a commit to GitHub.
  • Create a GitHub release.
  • And... publish πŸ™‚ poetry publish --build

Makefile usage

Makefile contains a lot of functions for faster development.

1. Download and remove Poetry

To download and install Poetry run:

make poetry-download

To uninstall

make poetry-remove

2. Install all dependencies and pre-commit hooks

Install requirements:

make install

Pre-commit hooks coulb be installed after git init via

make pre-commit-install

3. Codestyle

Automatic formatting uses pyupgrade, isort and black.

make codestyle

# or use synonym
make formatting

Codestyle checks only, without rewriting files:

make check-codestyle

Note: check-codestyle uses isort, black and darglint library

Update all dev libraries to the latest version using one comand

make update-dev-deps

4. Code security

make check-safety

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

make check-safety

5. Type checks

Run mypy static type checker

make mypy

6. Tests with coverage badges

Run pytest

make test

7. All linters

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

make lint

the same as:

make test && make check-codestyle && make mypy && make check-safety

8. Docker

make docker-build

which is equivalent to:

make docker-build VERSION=latest

Remove docker image with

make docker-remove

More information about docker.

9. Cleanup

Delete pycache files

make pycache-remove

Remove package build

make build-remove

Delete .DS_STORE files

make dsstore-remove

Remove .mypycache

make mypycache-remove

Or to remove all above run:

make cleanup

🎯 What's next

Well, that's up to you πŸ’ͺ🏻. I can only recommend the packages and articles that helped me.

  • Typer is great for creating CLI applications.
  • Rich makes it easy to add beautiful formatting in the terminal.
  • Pydantic – data validation and settings management using Python type hinting.
  • Loguru makes logging (stupidly) simple.
  • tqdm – fast, extensible progress bar for Python and CLI.
  • IceCream is a little library for sweet and creamy debugging.
  • orjson – ultra fast JSON parsing library.
  • Returns makes you function's output meaningful, typed, and safe!
  • Hydra is a framework for elegantly configuring complex applications.
  • FastAPI is a type-driven asynchronous web framework.

Articles:

πŸ“ˆ 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

πŸ§ͺ TODOs

This template will continue to develop and follow the bleeding edge new tools and best practices to improve the Python development experience.

Here is a list of things that have yet to be implemented:

πŸ›‘ License

License

This project is licensed under the terms of the MIT license. See LICENSE for more details.

πŸ… Acknowledgements

This template was inspired by several great articles:

and repositories:

Give them your ⭐️, these resources are amazing! πŸ˜‰

πŸ“ƒ Citation

@misc{python-package-template,
  author = {Roman Tezikov},
  title = {Python Packages Project Generator},
  year = {2020},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/TezRomacH/python-package-template}}
}

Markdown source for the badge πŸš€ Your next Python package needs a bleeding-edge project structure.

[![πŸš€ Your next Python package needs a bleeding-edge project structure.](https://img.shields.io/badge/python--package--template-%F0%9F%9A%80-brightgreen)](https://github.com/TezRomacH/python-package-template)

python-package-template's People

Contributors

abassel avatar chenghaomou avatar dectinc avatar dependabot-preview[bot] avatar dependabot[bot] avatar hexfaker avatar johnthagen avatar n720720 avatar philipptempel avatar pksol avatar tezromach avatar volemont avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-package-template's Issues

Documentation ready package

πŸš€ Feature Request

A documentation generator as part of this package. Would be nice to have a discussion on which generator to you; I default to ReadTheDocs, but I'm sure there are more modern generators nowadays? Would be happy to implement this feature.

πŸ”ˆ Motivation

I figured as part of a modern package stack you should have a documentation portal as the package grows.

πŸ›° Alternatives

Reading through the source code, googling, git

πŸ“Ž Additional context

A few doc generators that came to mind

  • ReadTheDocs
  • Docusaurus
  • GitBook
  • Sphinx

Support GitLab as an alternative to GitHub

πŸš€ Feature Request

Allow the user to specify the "flavor" of the git repository (and CI) as one of the parameters.

πŸ”ˆ Motivation

Many Python developers use GitLab (or other git repositories like BitBucket for that matter). Using the template as is, requires several manual changes to be applied later:

  1. Delete the GitHub actions and create and populate the .gitlab-ci.yml
  2. Update links in the readme and other documentation

Dependabot couldn't find a <anything>.yml for this project

Dependabot couldn't find a .yml for this project.

Dependabot requires a .yml to evaluate your project's current Github_actions dependencies. It had expected to find one at the path: /{{ cookiecutter.project_name.lower().replace(' ', '_').replace('-', '_') }}/.github/workflows/<anything>.yml.

If this isn't a Github_actions project, or if it is a library, you may wish to disable updates for it in the .dependabot/config.yml file in this repo.

View the update logs.

please add gitlab support

πŸš€ Feature Request

please support gitlab CI/CD

πŸ”ˆ Motivation

My company uses gitlab

πŸ›° Alternatives

I cannot move to github

πŸ“Ž Additional context

I think it is just changing the github actions to gitlab pipelines

Sharing another fork of the template

Hello everyone,

I wanted to echo what Undertone0809 mentioned in issue #856, regarding Romain's fantastic template. It's an invaluable resource, especially for newcomers looking to expand their coding skills beyond just a programming language. These tools require a different approach and introduce new mental models to complement traditional coding.

I've decided to fork the project and make some enhancements to the original template, focusing on aspects that I found significant. In line with what I've mentioned, working on this fork for the past two months has been a tremendous learning experience, shedding light on aspects of software development I had yet to explore. I deeply appreciate the outstanding work Romain has done so far – kudos to him!

During this time, I've made a few timid improvements, primarily on the backend, along with a few feature additions:

  • Added support for GitLab development;
  • Updated the configuration to adhere to Cookiecutter v2.0 standards, with improved prompts and options.
  • Deprecated darglint in favor of pydocstyle and pydoclint since the former is no longer maintained.
  • Adapted the project to the current Poetry notation for dev dependencies in pyproject.toml and the standalone install URL.
  • Adjusted dependencies to be compatible with Python versions from 3.8 through 3.11.
  • Included additional references in the README.md and improved post-generation instructions.
  • Added extra hooks to ensure consistent template generation.

I won't be opening a pull request here, as my primary platform of choice is GitLab. The project will be maintained there (you can access it here), but I'll keep a mirror on GitHub.

@TezRomacH, feel free to incorporate any aspects from my version of the template into python-package-template. None of this would be possible without your work.

In the spirit of open source, I invite everyone to check out my fork and collaborate in making it even better. I've already established the initial milestones I'd like to achieve, so please have a look if you're interested. Your feedback would be greatly appreciated.

No module named 'chardet'

πŸ› Bug Report

I followed the installation instruction but get

ModuleNotFoundError: No module named 'chardet'

when I try to run

poetry run <project_name> --help

Full stack trace:

Traceback (most recent call last):
  File "/home/tom/.local/bin/poetry", line 5, in <module>
    from poetry.console import main
  File "/home/tom/.local/share/pypoetry/venv/lib/python3.8/site-packages/poetry/console/__init__.py", line 1, in <module>
    from .application import Application
  File "/home/tom/.local/share/pypoetry/venv/lib/python3.8/site-packages/poetry/console/application.py", line 7, in <module>
    from .commands.about import AboutCommand
  File "/home/tom/.local/share/pypoetry/venv/lib/python3.8/site-packages/poetry/console/commands/__init__.py", line 4, in <module>
    from .check import CheckCommand
  File "/home/tom/.local/share/pypoetry/venv/lib/python3.8/site-packages/poetry/console/commands/check.py", line 2, in <module>
    from poetry.factory import Factory
  File "/home/tom/.local/share/pypoetry/venv/lib/python3.8/site-packages/poetry/factory.py", line 16, in <module>
    from .packages.locker import Locker
  File "/home/tom/.local/share/pypoetry/venv/lib/python3.8/site-packages/poetry/packages/__init__.py", line 2, in <module>
    from .locker import Locker
  File "/home/tom/.local/share/pypoetry/venv/lib/python3.8/site-packages/poetry/packages/locker.py", line 38, in <module>
    from poetry.utils.extras import get_extra_package_names
  File "/home/tom/.local/share/pypoetry/venv/lib/python3.8/site-packages/poetry/utils/extras.py", line 7, in <module>
    from poetry.utils.helpers import canonicalize_name
  File "/home/tom/.local/share/pypoetry/venv/lib/python3.8/site-packages/poetry/utils/helpers.py", line 11, in <module>
    import requests
  File "/home/tom/.local/lib/python3.8/site-packages/requests/__init__.py", line 44, in <module>
    import chardet
ModuleNotFoundError: No module named 'chardet'

πŸ”¬ How To Reproduce

Steps to reproduce the behavior:

  1. make install
  2. make pre-commit-install

Environment

            .-/+oossssoo+/-.               tom@desktop-20-3 
        `:+ssssssssssssssssss+:`           ---------------- 
      -+ssssssssssssssssssyyssss+-         OS: Ubuntu 20.04.3 LTS x86_64 
    .ossssssssssssssssssdMMMNysssso.       Host: MS-7B00 1.0 
   /ssssssssssshdmmNNmmyNMMMMhssssss/      Kernel: 5.11.0-44-generic 
  +ssssssssshmydMMMMMMMNddddyssssssss+     Uptime: 135 days, 23 hours, 36 mins 
 /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Packages: 3579 (dpkg), 28 (snap) 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Shell: bash 5.0.17 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+
ossyNMMMNyMMhsssssssssssssshmmmhssssssso
ossyNMMMNyMMhsssssssssssssshmmmhssssssso
+sssshhhyNMMNyssssssssssssyNMMMysssssss+
.ssssssssdMMMNhsssssssssshNMMMdssssssss.
 /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/
  +sssssssssdmydMMMMMMMMddddyssssssss+
   /ssssssssssshdmNNNNmyNMMMMhssssss/
    .ossssssssssssssssssdMMMNysssso.
      -+sssssssssssssssssyyyssss+-
        `:+ssssssssssssssssss+:`
            .-/+oossssoo+/-.

python --version

Python 3.8.10

πŸ“ˆ Expected behavior

No error

`master` and `main` branch

πŸ› Bug Report

Your template is using master branch. This affect how your README.md works. But, in the tutorial to upload, you use main branch.

git add .
git commit -m ":tada: Initial commit"
git branch -M main
git remote add origin https://github.com/USER/REPO.git
git push -u origin main

This will make banners and links in README.md no longer working and can't find the correct url.

πŸ”¬ How To Reproduce

Steps to reproduce the behavior:

  1. Simply use the cookie cutter.

πŸ“ˆ Expected behavior

Either use master in the tutorial section of README.md, change your branch to main, or dynamically change master to main.

install-poetry.py has changed the canonical URL and request that users change references to it

πŸ› Bug Report

The location of Poetry's installation script has been changed and generates

πŸ”¬ How To Reproduce

Steps to reproduce the behavior:

  1. Run the poetry-download target in the makefile
  2. Note the output has a deprecation warning at the very top.

Code sample

$ make poetry-download                                                                
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python -                       
The canonical source for Poetry's installation script is now https://install.python-poetry.org. Please update your usage to
 reflect this.                                                                                                             
Retrieving Poetry metadata                                                                                                 
                                                                                                                           
# Welcome to Poetry!
...

Environment

  • OS: [e.g. Linux / Windows / macOS] Linux
  • Python version, get it with: 3.10.6
$ python --version
Python 3.10.6

Screenshots

πŸ“ˆ Expected behavior

πŸ“Ž Additional context

failed to make an editable install

πŸ› Bug Report

failed to make an editable install

πŸ”¬ How To Reproduce

Steps to reproduce the behavior:

  1. system-wide it's Anaconda 3.8. there exists poetry, but it's not used as shown below
  2. create an project using all default settings (named python-project)
  3. in the project folder, create a setup.py as follows:
from setuptools import find_packages, setup

setup(
    name="python_project",
    version='0.0.1',

    author='author',

    packages=find_packages(where='python_project'),
    package_dir={'': 'python_project'}
)
  1. in system-wide python & in project folder, run pip install -e ./
  2. getting error:
ERROR: Command errored out with exit status 1:
     command: 'C:\Users\xxx\anaconda3\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\path-to\\python-project\\setup.py'"'"'; __file__='"'"'C:\\path-to\\python-pro
ject\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps
         cwd: C:\path-to\python-project\
    Complete output (3 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ModuleNotFoundError: No module named 'setuptools'
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\xxx\anaconda3\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\path-to\\python-project\\setup.py'"'"'; __file__='"'"
'C:\\path-to\\python-project\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"
'"'))' develop --no-deps Check the logs for full command output.
  1. delete pyproject.toml as well as related .pre-commit-config.yaml and .github;
  2. run pip install -e ./ again and it succeeds.

Code sample

NA

Environment

  • OS: Win10 x64
  • Python version, get it with: Anaconda x64 3.8.8

Screenshots

NA

πŸ“ˆ Expected behavior

to create an editable install by just adding a setup.py file.

πŸ“Ž Additional context

For my specific project, an editable install fits better as it involves pywin32.

I found a "fix" as follows:

  • comment out the build-backend = "poetry.core.masonry.api" line in pyproject.toml;
  • make an editable install with pip install -e . --no-use-pep517

License of output files?

Checklist

  • I've searched the project's issues.

❓ Question

What is the license of the output of this template? I see that this project itself is MIT-licensed; does that imply that the output of the template is MIT licensed?

πŸ“Ž Additional context

For "many" programs this is fairly straightforward ("The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software." fairly clearly applies to the software, not to outputs thereof) - but I note that this template includes many files from the repository verbatim in the output, which makes things somewhat less clear. Hence this question.

tests coverage reporting

πŸš€ Feature Request

Tests coverage reporting.

πŸ”ˆ Motivation

I found it in your ToDos. I implemented it for my own package pycvcqv using pytest-cov, coverage-badge, and, pytest-html .

πŸ›° Alternatives

To implement such a solution:

  1. first, edit your pyproject.toml:
[tool.poetry.dev-dependencies]
coverage = "*"
coverage-badge = "*"
pytest-html = "*"
pytest-cov = "*"

[tool.coverage.run]
source = ['package_name', 'tests_folder']

[coverage.paths]

source = 'package_name'

[coverage.run]
branch = true

[coverage.report]
fail_under = 50
show_missing = true
  1. next, mkdir assets/images/.
  2. Then, add these lines to Makefile:
.PHONY: coverage
coverage:
	poetry run pytest --cov-report html --cov packagename tests/
	poetry run coverage-badge -o assets/images/coverage.svg -f
  1. Then, run these lines:
make install
make test && make coverage && make check-codestyle && make mypy && make check-safety
  1. Finally, add this to the README.md:
[![coverage report](assets/images/coverage.svg)]

You, will have something like coverage report.

πŸ“Ž Additional context

More importantly, you can open htmlcov/index.html in your browser and observe the covered/uncovered codes.

image

image

Migrate pytest configuration to pyproject.toml

πŸš€ Feature Request

Pytest supports configuration via pyproject.toml. Migrate its configuration from setup.cfg to pyproject.toml.

πŸ”ˆ Motivation

pyproject.toml is becoming the standard configuration location for Python package. Doing this takes one step closer to removing the need for the setup.cfg file and simplify the overall project.

πŸ›° Alternatives

πŸ“Ž Additional context

break readme

Π£ тСбя Ρ€ΠΈΠ΄ΠΌΠΈ сломался)
ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅

Your .dependabot/config.yml contained invalid details

Dependabot encountered the following error when parsing your .dependabot/config.yml:

The property '#/' did not contain a required property of 'update_configs'
The property '#/' contains additional properties ["updates"] outside of the schema when none are allowed
The property '#/version' value 2 did not match one of the following values: 1

Please update the config file to conform with Dependabot's specification using our docs and online validator.

A new python-package-template for continuous maintenance

For Python beginners, the TezRomacH/python-package-template is an excellent resource to learn various aspects, such as using Poetry for package management and Black for code formatting. This project integrates many convenient components for everyone's use, which I greatly appreciate. However, it seems that due to certain reasons, the original project's author no longer has the bandwidth to maintain it. Over time, as new features and updates continue to emerge, without ongoing maintenance, the project may struggle to keep pace with the rapidly evolving technology landscape.

With this in mind, I've forked the TezRomacH/python-package-template and created a new repository with the intention of providing continuous maintenance and delivering a better Python Package Template for the community. I welcome everyone to try it out and provide feedback!

Project Repository: https://github.com/Undertone0809/python-package-template

I've already made several fixes and improvements, and I'll continue to enhance this project and address any outstanding issues. To enhance maintainability and user experience, here are some plans for my future development:

  • Windows Compatibility: Enhancing compatibility with Windows in makefiles. #624

  • Better lint: Use ruff to replace black isort.

  • New Package Features: Incorporating the latest features from related packaging tools. #766 #695

  • Package Management: Providing more solutions for Python package version management to enhance compatibility with different Python versions.

  • Documentation Support (e.g., Docusaurus): #852

  • Optimizing Docs: Improving documentation and offering more solutions to common questions. #602

  • And More Support: Expanding the project's capabilities. #788

I'm also looking forward to like-minded individuals joining this project to collectively make it even better.

Add tests

Is your feature request related to a problem? Please describe.
We need to add test cases. And the test template folder

Describe the solution you'd like
Pytest

Describe alternatives you've considered

Additional context

Build action fails as darglint checks the .venv folder made in previous step

πŸ› Bug Report

The GitHub Action build is calling Make which runs darglint against the root folder including .venv

πŸ”¬ How To Reproduce

Steps to reproduce the behavior:

  1. Create a new project with this template using python 3.9 and push to remote origin

Or to reproduce locally

$ python3 -m venv .venv
$ make check-codestyle

Code sample

n/a

Environment

Python 3.9.4

Screenshots

image

image

πŸ“ˆ Expected behavior

Needs to exclude .venv or maybe darglint first then create .venv

πŸ“Ž Additional context

Support windows natively

πŸš€ Feature Request

Support windows natively.

πŸ”ˆ Motivation

Windows by default does not support make.exe.

πŸ›° Alternatives

#41

Support new python minor versions

πŸ› Bug Report

Newer python versions like 3.10 and 3.11 should be supported.

πŸ”¬ How To Reproduce

Steps to reproduce the behavior:

  1. Note that in files like cookiecutter.json, there is no mention of 3.10 or 3.11

Code sample

Environment

  • OS: [e.g. Linux / Windows / macOS]
  • Python version, get it with:
python --version

Screenshots

πŸ“ˆ Expected behavior

I should be able to specify a version of 3.10 so that when I run pyupgrade, it will properly use the --py310-plus argument for example.

πŸ“Ž Additional context

RuntimeError when commit

πŸ› Bug Report

I got the error RuntimeError: failed to find interpreter for Builtin discover of python_spec='python3.7', when try to first commit.

πŸ”¬ How To Reproduce

Steps to reproduce the behavior:

  1. cookiecutter gh:TezRomacH/python-package-template
  2. Follow instructions
  3. After git add, git commit and get the error.

Code sample

git commit -m ":tada: Initial commit"
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/home/dbinary/.cache/pypoetry/virtualenvs/smplnotes-P5WiIkN--py3.8/bin/python', '-mvirtualenv', '/home/dbinary/.cache/pre-commit/repobgj1aqa4/py_env-python3.7', '-p', 'python3.7')
return code: 1
expected return code: 0
stdout:
    RuntimeError: failed to find interpreter for Builtin discover of python_spec='python3.7'
    
stderr: (none)
Check the log at /home/dbinary/.cache/pre-commit/pre-commit.log

Environment

  • OS: Arch Linux
  • Python 3.8.2

πŸ“ˆ Expected behavior

Make a commit without errors.

pre-commit.log

Failed to create a project - tag name expected

πŸ› Bug Report

I failed to create a project using the cookie cutter, tried several times, and got the same error:

Traceback (most recent call last):
  File "/home/peter/.local/bin/cookiecutter", line 8, in <module>
    sys.exit(main())
  File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/peter/.local/lib/python3.8/site-packages/cookiecutter/cli.py", line 140, in main
    cookiecutter(
  File "/home/peter/.local/lib/python3.8/site-packages/cookiecutter/main.py", line 101, in cookiecutter
    result = generate_files(
  File "/home/peter/.local/lib/python3.8/site-packages/cookiecutter/generate.py", line 352, in generate_files
    generate_file(
  File "/home/peter/.local/lib/python3.8/site-packages/cookiecutter/generate.py", line 169, in generate_file
    tmpl = env.get_template(infile_fwd_slashes)
  File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 830, in get_template
    return self._load_template(name, self.make_globals(globals))
  File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 804, in _load_template
    template = self.loader.load(self, name, globals)
  File "/usr/lib/python3/dist-packages/jinja2/loaders.py", line 125, in load
    code = environment.compile(source, name, filename)
  File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 591, in compile
    self.handle_exception(exc_info, source_hint=source_hint)
  File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib/python3/dist-packages/jinja2/_compat.py", line 37, in reraise
    raise value.with_traceback(tb)
  File "./pyproject.toml", line 45, in <module>
  File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 497, in _parse
    return Parser(self, source, name, encode_filename(filename)).parse()
  File "/usr/lib/python3/dist-packages/jinja2/parser.py", line 901, in parse
    result = nodes.Template(self.subparse(), lineno=1)
  File "/usr/lib/python3/dist-packages/jinja2/parser.py", line 883, in subparse
    rv = self.parse_statement()
  File "/usr/lib/python3/dist-packages/jinja2/parser.py", line 125, in parse_statement
    self.fail('tag name expected', token.lineno)
  File "/usr/lib/python3/dist-packages/jinja2/parser.py", line 59, in fail
    raise exc(msg, lineno, self.name, self.filename)
jinja2.exceptions.TemplateSyntaxError: tag name expected
  File "./pyproject.toml", line 45
    {%+ if cookiecutter.create_example_template == 'cli' %}

πŸ”¬ How To Reproduce

  1. Run cookiecutter gh:TezRomacH/python-package-template --checkout v1.1.0
  2. Then select:
  3. You've downloaded /home/peter/.cookiecutters/python-package-template before. Is it okay to delete and re-download it? [yes]: (yes)
  4. project_name [python-project]: flac-converter
  5. project_description [Awesome flac-converter is a Python cli/package created with https://github.com/TezRomacH/python-package-template]: (default)
  6. organization [flac-converter]: pksol
  7. license: default MIT
  8. minimal_python_version: - 3.7
  9. github_name [pksol]: (default)
  10. email [[email protected]]: [email protected]
  11. version [0.1.0]: (default)
  12. line_length [88]: (default)
  13. create cli (default)
  14. Then the above exception happens

Environment

  • OS: Linux - Ubuntu
  • Python version: 3.8.10

πŸ“ˆ Expected behavior

The project is created.

Dependabot couldn't find a Pipfile for this project

Dependabot couldn't find a Pipfile for this project.

Dependabot requires a Pipfile to evaluate your project's current Python dependencies. It had expected to find one at the path: /{{ cookiecutter.project_name.lower().replace(' ', '_').replace('-', '_') }}/Pipfile.

If this isn't a Python project, or if it is a library, you may wish to disable updates for it in the .dependabot/config.yml file in this repo.

View the update logs.

make install runs forever

πŸ› Bug Report

After creating the cookie-cutter the make install command runs forever

πŸ”¬ How To Reproduce

Steps to reproduce the behavior:

  1. Follow the documentation

Code sample

Environment

  • OS: macOS
  • Python version: Python 3.7.8

Screenshots

image

πŸ“ˆ Expected behavior

πŸ“Ž Additional context

Maybe switch from Makefile to Invoke?

πŸš€ Feature Request

Great work here @TezRomacH . I'm looking forward to seeing this project evolve!

This is honestly less of a feature request, more of a response to your cry for help comment on your Makefile.

##! Please tell me how to use for loops to create variables in Makefile :(
##! If you have better idea, please PR me in https://github.com/TezRomacH/python-package-template

Are you familiar with Invoke? It's a Python alternative to GNU Make, which might help you with your Makefile troubles (for loops, flags). I just wanted to bring it to your attention to see if it could make your life easier.

πŸ”ˆ Motivation

To save you from using Make.

πŸ›° Alternatives

Make is still useful and a good choice because (almost) every machine has it already installed and is a well-known standard.

Thanks for the cool project!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.