Skip to main content

Set up a modern Python project by running one command.

Project description

Create Python Proj

Logo

Set up a modern Python project by running one command.
(The missing Create React App for Python)

Create Python projects with the best development tools and configurations.

Create Python Project works on macOS, Windows, and Linux.
If something doesn’t work, please file 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 Overview

pipx install create-python-proj
create-python-proj
cd my-proj
poetry shell
poetry run my-proj

If you've previously installed create-python-proj via pipx install create-python-proj, we recommend you run pipx upgrade create-python-proj to ensure that you are always using the latest version.

Get Started Immediately

You don’t need 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 Project

This package automates the process of creating a new Python project managed using Poetry. 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 using pipx:

pipx install create-python-proj

Then run the tool:

create-python-proj

You will be prompted for the project name and a new directory with the project structure and configurations will be created.

If you don't have pipx installed, you can install it with:

python3 -m pip install --user pipx

(pipx is a Python package runner tool for running https://pypi.org/ packages)

create-python-proj will 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.py

No 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:

cd my-proj
poetry shell

Inside the newly created project, you can run some built-in commands:

poetry run my-proj

Runs the starter "Hello, World!" program.

pytest

Runs the starter test_example test.

exit

Deactivate 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.

Recommendations

Enable automatically running black formatting, mypy type checking, flake8 linting, isort imports organizing, and pyproject.toml formatting on every save in VS Code:

and add these configs to your user settings.json file:

// 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,

Contributing

Contributions to Create-Python-Proj are welcome. To contribute, please follow these steps:

  1. Fork the repository on GitHub.
  2. Create a new branch with a descriptive name.
  3. Commit your changes to the new branch.
  4. 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.

License

Create-Python-Proj is licensed under the MIT License. For more information, see the LICENSE file in the repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

create_python_proj-1.0.6.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

create_python_proj-1.0.6-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file create_python_proj-1.0.6.tar.gz.

File metadata

  • Download URL: create_python_proj-1.0.6.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.1 CPython/3.11.2 Darwin/22.3.0

File hashes

Hashes for create_python_proj-1.0.6.tar.gz
Algorithm Hash digest
SHA256 ee48aee1e45a2a4de9b79394281f1ec9e4f7d9cef92cafea1d953ebb0c34f004
MD5 e9c3f7d9f1540d982878a45a5d446d30
BLAKE2b-256 d30926a049b3b39be64db826bd59b83f24f6ed563d76e8519e9a38284762ddd6

See more details on using hashes here.

File details

Details for the file create_python_proj-1.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for create_python_proj-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 8cafa69243331dd3c0f125d6f7b699a8f66194b855f27e22ce196fda0c872742
MD5 c74299607f47cfb847c804faab869fce
BLAKE2b-256 35b6ba02ef2d0a0016b25a9e8a4cad7a00b5829cd72a927b959adab6c14c7430

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page