Skip to main content

A tool to initialize a python project with all basic files and configurations

Project description

PYPROJECT_INIT, the python project initializer

This is a simple python project initializer. It creates any file and directory structure needed for a python project, depending on the options you provide.

ROADMAP

  • add function for creating the chosen license file
  • add function for creating the chosen gitignore file
  • add function for creating the chosen README file
  • modify each os.system() call to use the subprocess module
  • wrap the whole thing in a class
  • simplify entry point
  • add tests
  • add documentation
  • add pyproject.toml file
  • wrap the whole thing in a package
  • publish the package on pypi
  • add a command line interface
  • test it vanilla
  • Change options setuppy and setupcfg to setup
  • Change options pyproject to make setup a flag. If setup is true, then create setup.py and setup.cfg. If setup is false, then create pyproject.toml
  • Cut the code into smaller functions if possible

DESCRIPTION

This package is a simple python project initializer. It creates a directory structure and files for a python project, depending on the options you provide. It can create a directory structure for a simple python project, a python package, or a python package with a CLI. It embeds:

  • a license file, default containing the MIT license but can be changed to any other license that is available on the choosealicense.com website
  • a gitignore file, default containing the standard python gitignore fields
  • a README file, default containing a simple template that you can modify
  • a pyproject.toml file, default containing the standard fields for a python package. This file is only created if you choose to create a python package or a python app.
  • a setup.cfg file, default containing the standard fields for a python package. This file is only created if you choose to create a python package or a python app.
  • a setup.py file, default containing the standard fields for a python package. This file is only created if you choose to create a python package or a python app.
  • a directory structure, default containing a simple python package with a simple module and a simple test module. This directory structure is only created if you choose to create a python package or a python app. The directory structure is composed of a package directory, a test directory, every __init__.py file needed, and a simple module and a simple test module.
  • If needed, this package can also create a simple Dockerfile that you can use to containerize your python app.

[!NOTE] The pyproject.toml,setup.cfg, and setup.py files are optional and cannot be created together. If you choose to use a pyproject.toml project file (which is the new standard for python projects), the other two files will not be created. If you choose to use a setup.cfg file, the setup.py file will be created and not the pyproject.toml file.

INSTALLATION

You can either clone the repository and install the package from the source code, or you can install it from pypi.

pip install pyproject-init

[!NOTE] Note that the new recommended way to use and install packages is to use virtual environments, so you might want to create one before installing the package.

USAGE

The package provide a command line interface with 2 main commands: lib and app. The lib command is used to create a simple python package, and the app command is used to create a python package with a CLI. Each of the commands has same options and arguments. Please refer to the help message or the documentation for more information.

pyproject-init lib --help
pyproject-init app --help

EXAMPLES

Here are some examples of how to use the package.

Create a simple python package

pyproject-init lib my_package

This will create a directory structure and files for a simple python package. The directory structure will look like this:

my_package/
    my_package/
        __init__.py
    tests/
        __init__.py
        test_my_package.py
    LICENSE
    .gitignore
    README.md
    pyproject.toml
    setup.cfg
    setup.py

Create a python package with git initialized

This command line will create a simple python package and initialize a git repository in the directory.

pyproject-init lib my_package --git

Create a python package with a Dockerfile

This command line will create a simple python package and a Dockerfile in the directory.

pyproject-init lib my_package --docker

Create a python package with a different license

This command line will create a simple python package with a different license. The license must be available on the choosealicense.com website.

pyproject-init lib my_package --license gpl-3.0

Create a python package with pyproject.toml

This command line will create a simple python package with a pyproject.toml file instead of the setup.cfg and setup.py files.

pyproject-init lib my_package --pyproject

Create a python package with

CONTRIBUTING

If you want to contribute to this project, you can either open an issue or a pull request. Please refer to the CONTRIBUTING.md file for more information.

LICENSE

This project is licensed under the MIT license. Please refer to the LICENSE file for more information.

AUTHOR

This project was created by Quentin Haenn. You can contact me at quentin.haenn.pro@gmail.com.

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

pyproject_init-1.1.0.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

pyproject_init-1.1.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file pyproject_init-1.1.0.tar.gz.

File metadata

  • Download URL: pyproject_init-1.1.0.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for pyproject_init-1.1.0.tar.gz
Algorithm Hash digest
SHA256 5ac0506c862fd1649c1f64b482c77428473a7df9ef77a1295f899685f0d261a0
MD5 c140f1f350be8792936c4e478a48087e
BLAKE2b-256 0e8d64694fb9465e76a4a4a385c12452dc9e2a424cb8e4570a423e4c3b0404e3

See more details on using hashes here.

File details

Details for the file pyproject_init-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pyproject_init-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 502a609913987241990ee13835cd94c0947d0d87c7243d53ba8aff0f271bc915
MD5 becfcccc9f7f2179a9f4538b989d686e
BLAKE2b-256 3f7ddf30362ae103c9aa1b83c4e23702c8d2a76221ede71756484143304ad198

See more details on using hashes here.

Supported by

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