Pipfile to pyproject.toml for Poetry
Project description
Poetrify
Installation
Pipfile or requirements.txt(this is trial) to pyproject.toml for Poetry.
pip install poetrify
required
poetry
command (See: https://poetry.eustace.io/docs/#installatio )
Usage
$ poetrify
Poetrify version 0.3.0
USAGE
poetrify [-h] [-q] [-v [<...>]] [-V] [--ansi] [--no-ansi] [-n] <command> [<arg1>] ... [<argN>]
ARGUMENTS
<command> The command to execute
<arg> The arguments of the command
GLOBAL OPTIONS
-h (--help) Display this help message
-q (--quiet) Do not output any message
-v (--verbose) Increase the verbosity of messages: "-v" for normal output, "-vv" for more verbose output and
"-vvv" for debug
-V (--version) Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n (--no-interaction) Do not ask any interactive question
AVAILABLE COMMANDS
completions Generate completion scripts for your shell.
generate Generate pyproject.toml from the source file
help Display the manual of a command
Example structure::
$ tree .
.
├── app.py
├── LICENSE
├── Pipfile
└── Pipfile.lock
The generate
command sets the way for poetry init
$ poetrify generate
Generated init command:
poetry init --dependency=rauth --dependency=requests --dependency=requests-cache --dependency=furl --dependency=arrow --dependency=pytest --dependency=responses --dev-dependency=pytest --dev-dependency=pytest-cov --dev-dependency=pytest-flake8 --dev-dependency=responses --dev-dependency=pytest-runner --license=MIT
Execute the above command. Also, the following output is due to Poetry.
This command will guide you through creating your pyproject.toml config.
Package name [foo]:
...
Trial
Also supported to requirements.txt on a trial basis.
Please specify requirements.txt
for--src
option. The default value of this option is Pipfile.
$ poetry run pip freeze > requirements.txt
$ cat requirements.txt
aspy.yaml==1.1.1
atomicwrites==1.2.1
attrs==18.2.0
certifi==2018.11.29
cfgv==1.4.0
chardet==3.0.4
cleo==0.7.2
Click==7.0
clikit==0.2.3
coverage==4.5.2
identify==1.1.8
idna==2.8
importlib-metadata==0.8
incremental==17.5.0
Jinja2==2.10
licensename==0.4.2
MarkupSafe==1.1.0
more-itertools==5.0.0
nodeenv==1.3.3
pastel==0.1.0
pluggy==0.8.1
-e git+https://github.com/kk6/poetrify.git@63a861cba868298c896888f5104230c4a00896bb#egg=poetrify
pre-commit==1.14.2
py==1.7.0
pylev==1.3.0
pytest==3.10.1
pytest-cov==2.6.1
PyYAML==3.13
requests==2.21.0
six==1.12.0
toml==0.10.0
tomlkit==0.5.3
towncrier==18.6.0
Unidecode==1.0.23
urllib3==1.24.1
virtualenv==16.2.0
zipp==0.3.3
$ poetrify generate -d -s requirements.txt
Generated init command:
poetry init --dependency=cleo --dependency=licensename --dependency=pre-commit --dependency=pytest-cov --dependency=requests --dependency=tomlkit --dependency=towncrier --license=MIT
As you can see, poetrify extract only descendants packages from all the packages listed in requirements.txt
and pass only those to poetry. This is to prevent pyproject.toml
from becoming full of package names.
Autocompletion
Description
One can generate a completion script for poetrify
that is compatible with a given shell. The
script is output on stdout
allowing one to re-direct the output to the file of their choosing.
Where you place the file will depend on which shell, and which operating system you are using. Your particular
configuration may also determine where these scripts need to be placed.
Here are some common set ups for the three supported shells under Unix and similar operating systems (such as GNU/Linux).
BASH
bash
Completion files are commonly stored in /etc/bash_completion.d/
Run the command:
poetrify completions bash > /etc/bash_completion.d/poetrify.bash-completion
This installs the completion script. You may have to log out and log back in to your shell session for the changes to take effect.
FISH
Fish completion files are commonly stored in$HOME/.config/fish/completions
Run the command:
poetrify completions fish > ~/.config/fish/completions/poetrify.fish
This installs the completion script. You may have to log out and log back in to your shell session for the changes to take effect.
ZSH
ZSH completions are commonly stored in any directory listed in your $fpath
variable. To use these
completions, you must either add the generated script to one of those directories, or add your own to this list.
Adding a custom directory is often the safest best if you're unsure of which directory to use. First create the
directory, for this example we'll create a hidden directory inside our $HOME
directory
mkdir ~/.zfunc
Then add the following lines to your .zshrc
just before compinit
fpath+=~/.zfunc
Now you can install the completions script using the following command
poetrify completions zsh > ~/.zfunc/_poetrify
You must then either log out and log back in, or simply run
exec zsh
For the new completions to take affect.
CUSTOM LOCATIONS
Alternatively, you could save these files to the place of your choosing, such as a custom directory inside your
$HOME. Doing so will require you to add the proper directives, such as source
ing inside your login script. Consult
your shells documentation for how to add such directives.
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
Built Distribution
File details
Details for the file poetrify-0.4.2.tar.gz
.
File metadata
- Download URL: poetrify-0.4.2.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.5 CPython/3.8.0 Darwin/19.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb4e3b3e86676d833ec1c5e6059a28ddb3936903b47ac8a77ddc339edf55f39e |
|
MD5 | e9a470fd940067ef831499adddd1f000 |
|
BLAKE2b-256 | 9d55728226fcbf729a6eec89b58f54542300c48412e39dc6c73b7fcfeeac18e2 |
File details
Details for the file poetrify-0.4.2-py3-none-any.whl
.
File metadata
- Download URL: poetrify-0.4.2-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.5 CPython/3.8.0 Darwin/19.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a1ecadae722abe4f9dba9aa46ad62bef7271d182c682c8608d1742004771f3a |
|
MD5 | 4d5b671caa05c47667afe48c6b181a46 |
|
BLAKE2b-256 | 3bb33c6daec240d60de7b38e8785e7ef751124b38364aa8e64a6820628ad9583 |