pynit/README.md

89 lines
2.8 KiB
Markdown
Raw Permalink Normal View History

2022-12-02 19:57:24 +01:00
# pynit
2022-12-07 20:53:56 +01:00
2022-12-07 23:40:07 +01:00
[![License](https://img.shields.io/crates/l/pynit)](https://gitea.antoine-langlois.net/DataHearth/pynit/src/branch/main/LICENSE)
2023-06-28 12:05:10 +02:00
[![Version](https://img.shields.io/crates/v/pynit)](https://crates.io/crates/pynit)
2022-12-07 23:40:07 +01:00
---
`pynit` speeds up the process of creating a new python project. It can initialise the project with `git`,
2022-12-07 20:53:56 +01:00
a virtual environment (using the `venv` module) and creating a [basic folder structure](https://setuptools.pypa.io/en/latest/userguide/package_discovery.html) if wanted.
## Usage
```bash
Small CLI tool to initialize a python project
Usage: pynit [OPTIONS] <COMMAND>
Commands:
new
init
help Print this message or the help of the given subcommand(s)
Options:
-v, --verbose Output will be more verbose
-c, --complete Initialize with minimal fields for "pyproject.toml"
--git Initialize folder with a git repository
--venv <VENV> Initialize a new virtual environment with given name in initialized directory
--layout <LAYOUT> Define a layout for your project (https://setuptools.pypa.io/en/latest/userguide/package_discovery.html) [possible values: src, flat]
-h, --help Print help information
-V, --version Print version information
```
2 subcommands are available: `new` and `init`. Each of them have the same flags (defined globally).
### Global flags
#### --verbose
Adding this flag will make the `STDOUT` more verbose.
NOTE: the flag doesn't do anything currently as logging is not yet implemented.
#### -c/--complete
`--complete` allows you to control how much questions will be asked during the initialisation of the `pyproject.toml`. By default, only required fields will be asked: `build-sytem` section, `project.name` and `project.version`.
#### --git
Initialise a git repository
#### --venv
Add a virtual environment to your python project with a given `name`.
#### --layout
Add a default popular folder structure to your project.
Two options are available: `flat` and `src`.
For more information, check out [this setuptools section](https://setuptools.pypa.io/en/latest/userguide/package_discovery.html).
### new
`new` acts like `cargo new`. It take one argument which is the project name. Project name will be the folder name and used as default when asking questions to create a basic `pyproject.toml`.
The directory must NOT exist before creating the project.
#### Examples
```bash
$ pynit --git --venv .env --layout flat new my_project
$ exa -a --tree --level=2 my_project
my_project
├── .env
│ ├── ...
├── .git
│ ├── ...
├── .gitignore
├── my_project
│ └── __init__.py
└── pyproject.toml
```
### init
Like `new`, `init` does the same thing. Except it'll initiase the current directory.
NOTE: if a `.gitignore` and/or a `pyproject.toml` is present, they'll be truncated.