Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python-poetry
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
python-poetry
Commits
1cabc09f
Unverified
Commit
1cabc09f
authored
May 21, 2018
by
Sébastien Eustace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a --src option to new
parent
669b78c7
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
1 deletions
+27
-1
CHANGELOG.md
+1
-0
poetry/console/commands/new.py
+4
-0
poetry/layouts/__init__.py
+3
-1
poetry/layouts/src.py
+19
-0
No files found.
CHANGELOG.md
View file @
1cabc09f
...
...
@@ -8,6 +8,7 @@
-
Added a new
`init`
command to generate a
`pyproject.toml`
file in existing projects.
-
Added a new setting
`settings.virtualenvs.in-project`
to make
`poetry`
create the project's virtualenv inside the project's directory.
-
Added the
`--extras`
and
`--python`
options to
`debug:resolve`
to help debug dependency resolution.
-
Added a
`--src`
option to new to create an
`src`
layout.
### Changed
...
...
poetry/console/commands/new.py
View file @
1cabc09f
...
...
@@ -8,6 +8,7 @@ class NewCommand(Command):
new
{ path : The path to create the project at. }
{ --name : Set the resulting package name. }
{ --src : Use the src layout for the project. }
"""
def
handle
(
self
):
...
...
@@ -15,6 +16,9 @@ class NewCommand(Command):
from
poetry.utils._compat
import
Path
from
poetry.vcs.git
import
GitConfig
if
self
.
option
(
'src'
):
layout_
=
layout
(
'src'
)
else
:
layout_
=
layout
(
'standard'
)
path
=
Path
.
cwd
()
/
Path
(
self
.
argument
(
'path'
))
...
...
poetry/layouts/__init__.py
View file @
1cabc09f
from
typing
import
Type
from
.layout
import
Layout
from
.src
import
SrcLayout
from
.standard
import
StandardLayout
_LAYOUTS
=
{
'standard'
:
StandardLayout
'src'
:
SrcLayout
,
'standard'
:
StandardLayout
,
}
...
...
poetry/layouts/src.py
0 → 100644
View file @
1cabc09f
# -*- coding: utf-8 -*-
from
.layout
import
Layout
DEFAULT
=
u"""__version__ = '{version}'
"""
class
SrcLayout
(
Layout
):
def
_create_default
(
self
,
path
):
package_path
=
path
/
'src'
/
self
.
_package_name
package_init
=
package_path
/
'__init__.py'
package_path
.
mkdir
(
parents
=
True
)
with
package_init
.
open
(
'w'
)
as
f
:
f
.
write
(
DEFAULT
.
format
(
version
=
self
.
_version
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment