Commit 3987b0e0 by Arun Babu Neelicattu

command/new: support namespace package creation

With this change, names containing "." are treated as namespace
packages.

The following behaviour is now expected.

- "a.b.c" creates package name "a-b-c" with directory structure
  "a/b/c"
- "a-b-c" creates package name "a-b-c" with directory structure
  "a/b/c"
- "a.b_c" creates package name "a-b-c" with directory structure
  "a/b_c"
- "a_b_c" creates package name "a-b-c" with directory structure
  "a_b_c"
parent 85f922df
...@@ -35,8 +35,7 @@ my-package ...@@ -35,8 +35,7 @@ my-package
├── my_package ├── my_package
│ └── __init__.py │ └── __init__.py
└── tests └── tests
├── __init__.py └── __init__.py
└── test_my_package.py
``` ```
If you want to name your project differently than the folder, you can pass If you want to name your project differently than the folder, you can pass
...@@ -62,8 +61,27 @@ my-package ...@@ -62,8 +61,27 @@ my-package
│ └── my_package │ └── my_package
│ └── __init__.py │ └── __init__.py
└── tests └── tests
├── __init__.py └── __init__.py
└── test_my_package.py ```
The `--name` option is smart enough to detect namespace packages and create
the required structure for you.
```bash
poetry new --src --name my.package my-package
```
will create the following structure:
```text
my-package
├── pyproject.toml
├── src
│ └── my
│ └── package
│ └── __init__.py
└── tests
└── __init__.py
``` ```
## init ## init
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment