Package: create-python-proj
Create Python ProjSet up a modern Python project by running one command.(The missingCreate React Appfor Python)Create Python projects with the best development tools and configurations.Creating a Project– How to create a new project.What's Included?- Development tools setup.Recommendations- Do these things.Create Python Project works on macOS, Windows, and Linux.If something doesn’t work, pleasefile an issue.This is the best Python workflow setup, and you deserve the best."A customer can have a car painted any colour he wants, as long as it's black."Quick Overviewpipxinstallcreate-python-proj
create-python-projcdmy-proj
poetryshell
poetryrunmy-projIf you've previously installedcreate-python-projviapipx install create-python-proj, we recommend you runpipx upgrade create-python-projto ensure that you are always using the latest version.Get Started ImmediatelyYoudon’tneed to manually install or configure tools like Poetry, flake8, or mypy.
They are preconfigured and hidden so that you can focus on the code.Create a project with the best setup, and you’re good to go.Creating a ProjectThis package automates the process of creating a new Python project managed usingPoetry. It sets up the project structure, initializes a Git repository, configures the best development tools:mypy,black,flake8,isort,pytest, and adds the best configurations for these tools.To create a new project, simply install usingpipx:pipxinstallcreate-python-projThen run the tool:create-python-projYou will be prompted for the project name and a new directory with the project structure and configurations will be created.If you don't havepipxinstalled, you can install it with:python3-mpipinstall--userpipx(pipxis a Python package runner tool for runninghttps://pypi.org/packages)create-python-projwill create a directory called my-proj inside the current folder.Inside that directory, it will generate the initial project structure and install the transitive dependencies:my-proj
├── pyproject.toml
├── poetry.lock
├── README.md
├── .gitignore
├── .flake8
├── .venv
│   └── ...local Python virtual environment
├── my-proj
│   ├── __init__.py
│   └── main.py
└── tests
    ├── __init__.py
    └── test_example.pyNo configuration or complicated folder structures, only the files you need to build your project.
Once the installation is done, you can open your project folder and activate the local virtual environment, managed by Poetry:cdmy-proj
poetryshellInside the newly created project, you can run some built-in commands:poetry run my-projRuns the starter "Hello, World!" program.pytestRuns the startertest_exampletest.exitDeactivate the local virtual environment when you are finished working with the project.What's Included?Your environment will have everything you need to build a modern Python project, with all tools already configured to work together seemlessly:Poetry: a standalone, all-in-one package and dependency management tool for Python projects that simplifies dependency installation, package building, and publishing. It uses a pyproject.toml file to define project metadata and dependencies, streamlining the entire packaging process and making it easy to manage complex dependency trees.mypy: a static type checker for Python that helps catch potential type errors and improve code readability by enforcing type annotations. It uses gradual typing to provide immediate benefits without requiring a full conversion to static typing.black: an opinionated code formatter for Python that enforces a consistent style across your codebase by automatically reformatting code to comply with the PEP 8 style guide. By focusing on deterministic formatting rules, it minimizes debates over code style and allows developers to concentrate on writing code.flake8: a Python linter that checks for style guide violations, programming errors, and potential issues in your code. It combines the functionality of PyFlakes, pycodestyle, and McCabe complexity analysis, providing a comprehensive code quality analysis tool.isort: a Python utility that automatically sorts and organizes your imports according to the PEP 8 style guide or a custom configuration. It streamlines import management and ensures a consistent import style throughout your project.pytest: a powerful and flexible testing framework for Python that simplifies the process of writing and running tests. It supports a wide range of test types, including unit tests, functional tests, and integration tests, and offers advanced features such as fixtures, parameterization, and plugins to extend its functionality.RecommendationsEnable automatically runningblackformatting,mypytype checking,flake8linting,isortimports organizing, andpyproject.tomlformatting on every save in VS Code:Install theBlack Formatter VS Code extension.Install themypy VS Code extension.Install theisort VS Code extension.Install theEven Better TOML VS Code extension.and add these configs to your usersettings.jsonfile:// PYTHON"[python]":{"editor.formatOnSave":true,"editor.defaultFormatter":"ms-python.black-formatter","editor.insertSpaces":true,"editor.tabSize":4,"editor.codeActionsOnSave":{"source.organizeImports":true}},"python.linting.enabled":true,"python.linting.flake8Enabled":true,"python.linting.flake8Path":"flake8","python.linting.mypyEnabled":true,// TOML"[toml]":{"editor.defaultFormatter":"tamasfe.even-better-toml","editor.formatOnSave":true},"evenBetterToml.formatter.allowedBlankLines":1,"evenBetterToml.formatter.columnWidth":88,ContributingContributions to Create-Python-Proj are welcome. To contribute, please follow these steps:Fork the repository on GitHub.Create a new branch with a descriptive name.Commit your changes to the new branch.Create a pull request, and describe the changes you made.Please make sure to follow the project's coding standards and add tests for any new features.LicenseCreate-Python-Proj is licensed under the MIT License. For more information, see the LICENSE file in the repository.