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
e592fba9
Commit
e592fba9
authored
May 04, 2018
by
Konstantin Molchanov
Committed by
Sébastien Eustace
May 04, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add username and password options to publish command. (#83)
parent
1eef2c7f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
19 deletions
+27
-19
README.md
+7
-5
docs/docs/cli.md
+2
-1
poetry/console/commands/publish.py
+8
-2
poetry/masonry/publishing/publisher.py
+10
-11
No files found.
README.md
View file @
e592fba9
...
...
@@ -34,11 +34,11 @@ python get-poetry.py --version 0.7.0
```
Using
`pip`
to install
`poetry`
is also possible.
```
bash
pip install
--user
poetry
```
```
Be aware, however, that it will also install poetry's dependencies
which might cause conflicts.
...
...
@@ -83,7 +83,7 @@ poetry completions fish > ~/.config/fish/completions/pyproject.fish
poetry completions zsh
>
~/.zfunc/_poetry
```
*Note:*
you may need to restart your shell in order for the changes to take
*Note:*
you may need to restart your shell in order for the changes to take
effect.
For
`zsh`
, you must then add the following line in your
`~/.zshrc`
before
...
...
@@ -225,7 +225,7 @@ You either have to use `sync` or `clean` to fix that.
#### Too limited in scope
Finally, the
`Pipfile`
is just a replacement from
`requirements.txt`
and, in the end, you will still need to
Finally, the
`Pipfile`
is just a replacement from
`requirements.txt`
and, in the end, you will still need to
populate your
`setup.py`
file (or
`setup.cfg`
) with the exact same dependencies you declared in your
`Pipfile`
.
So, in the end, you will still need to manage a few configuration files to properly setup your project.
...
...
@@ -410,6 +410,8 @@ poetry publish
*
`-r|--repository`
: The repository to register the package to (default:
`pypi`
).
Should match a repository name set by the
[
`config`
](
#config
)
command.
*
`--username (-u)`
: The username to access the repository.
*
`--password (-p)`
: The password to access the repository.
### `config`
...
...
docs/docs/cli.md
View file @
e592fba9
...
...
@@ -201,7 +201,8 @@ poetry publish
*
`--repository (-r)`
: The repository to register the package to (default:
`pypi`
).
Should match a repository name set by the
[
`config`
](
#config
)
command.
*
`--username (-u)`
: The username to access the repository.
*
`--password (-p)`
: The password to access the repository.
## config
...
...
poetry/console/commands/publish.py
View file @
e592fba9
...
...
@@ -7,11 +7,13 @@ class PublishCommand(Command):
publish
{ --r|repository= : The repository to publish the package to. }
{ --u|username= : The username to access the repository. }
{ --p|password= : The password to access the repository. }
{ --no-build : Do not build the package before publishing. }
"""
help
=
"""The publish command builds and uploads the package to a remote repository.
By default, it will upload to PyPI but if you pass the --repository option it will
upload to it instead.
...
...
@@ -29,4 +31,8 @@ the config command.
self
.
line
(
''
)
publisher
=
Publisher
(
self
.
poetry
,
self
.
output
)
publisher
.
publish
(
self
.
option
(
'repository'
))
publisher
.
publish
(
self
.
option
(
'repository'
),
self
.
option
(
'username'
),
self
.
option
(
'password'
)
)
poetry/masonry/publishing/publisher.py
View file @
e592fba9
...
...
@@ -17,7 +17,7 @@ class Publisher:
self
.
_io
=
io
self
.
_uploader
=
Uploader
(
poetry
,
io
)
def
publish
(
self
,
repository_name
):
def
publish
(
self
,
repository_name
,
username
,
password
):
if
repository_name
:
self
.
_io
.
writeln
(
'Publishing <info>{}</info> (<comment>{}</comment>) '
...
...
@@ -62,18 +62,17 @@ class Publisher:
url
=
config
[
'repositories'
][
repository_name
][
'url'
]
username
=
None
password
=
None
auth_file
=
Path
(
CONFIG_DIR
)
/
'auth.toml'
if
auth_file
.
exists
():
with
auth_file
.
open
()
as
f
:
auth_config
=
toml
.
loads
(
f
.
read
())
if
not
(
username
and
password
):
auth_file
=
Path
(
CONFIG_DIR
)
/
'auth.toml'
if
auth_file
.
exists
():
with
auth_file
.
open
()
as
f
:
auth_config
=
toml
.
loads
(
f
.
read
())
if
'http-basic'
in
auth_config
and
repository_name
in
auth_config
[
'http-basic'
]:
config
=
auth_config
[
'http-basic'
][
repository_name
]
if
'http-basic'
in
auth_config
and
repository_name
in
auth_config
[
'http-basic'
]:
config
=
auth_config
[
'http-basic'
][
repository_name
]
username
=
config
.
get
(
'username'
)
password
=
config
.
get
(
'password'
)
username
=
config
.
get
(
'username'
)
password
=
config
.
get
(
'password'
)
# Requesting missing credentials
if
not
username
:
...
...
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