Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up and improve CLI implementation #244

Merged
merged 35 commits into from
Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
a810bd5
Add `wv_cli.py`, add Click requirement, change entry point
formatc1702 Oct 2, 2021
1df45ab
Implement working proof of concept
formatc1702 Oct 2, 2021
19481b2
Remove unneeded code from `wireviz.py`
formatc1702 Oct 2, 2021
77f668e
Add CLI help strings
formatc1702 Oct 2, 2021
d3e99ab
Only output requested file types (closes #60)
formatc1702 Oct 2, 2021
b53ce36
Fix entry point
formatc1702 Oct 2, 2021
a5b0fbe
Split the YAML loading and parsing functions
formatc1702 Oct 2, 2021
6a08988
Implement image path resolver
formatc1702 Oct 2, 2021
b1fa2b9
Do not output `.gv` files by default
formatc1702 Oct 2, 2021
3a181f6
Fix smart file resolver for images
formatc1702 Oct 15, 2021
3c6b902
Remove obsolete comments
formatc1702 Oct 15, 2021
0cb0a4e
Add `main()` to `wireviz.py` as fallback
formatc1702 Oct 15, 2021
5b3c2b3
Add encoding info to `wv_cli.py`
formatc1702 Oct 15, 2021
a4343ae
Sort `--format` flags alphabetically
formatc1702 Oct 15, 2021
c68d641
Update README for new CLI commands
formatc1702 Oct 15, 2021
d6d1fbc
Output help string if no arguments are received
formatc1702 Oct 15, 2021
3dae1cb
Improve `REAME.md`
formatc1702 Oct 15, 2021
fb2aae5
Split file output logic and object return logic
formatc1702 Oct 15, 2021
65b8e36
Create cache of graph to avoid generating it more than once
formatc1702 Oct 15, 2021
6f8078e
Add `black` profile for `isort`
formatc1702 Oct 15, 2021
3446154
Apply `isort`
formatc1702 Oct 15, 2021
f92985a
Apply `black`
formatc1702 Oct 15, 2021
c89cf73
Apply some manual fixes, reapply `black`
formatc1702 Oct 15, 2021
58ab5ca
Mention `isort` and `black` in contribution guidelines
formatc1702 Oct 15, 2021
c702e20
Add 'black' badge to `README.md`
formatc1702 Oct 15, 2021
d7d7854
Consolidate `wireviz.parse()` to handle `Path`, `str` and `Dict` as i…
formatc1702 Oct 16, 2021
e353070
Allow specifying output directory and file name separately
formatc1702 Oct 16, 2021
8215113
Add leading underscore to local helper functions
formatc1702 Oct 16, 2021
3aa1a2e
Write docstring for `parse()` function
formatc1702 Oct 16, 2021
b46d263
Update `build_examples.py`
formatc1702 Oct 16, 2021
5aaea65
Automatically include input file directory in list to resolve image p…
formatc1702 Oct 16, 2021
08b5124
Add support for multiple prepended files
formatc1702 Oct 16, 2021
45bcc1d
Make template separator character user-configurable
formatc1702 Oct 16, 2021
d19c260
Simplify file access operations
formatc1702 Oct 16, 2021
e31ed72
Auto-assign missing harness title if reading from file
formatc1702 Oct 16, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ When contributing to this repository, please [submit a new issue](https://github
1. Create a new feature branch on top of the `dev` branch.
1. Commit your code changes to this feature branch.
1. Push the changes to your fork.
1. Please format your code using [`isort`](https://pycqa.github.io/isort/) and [`black`](https://black.readthedocs.io) before submitting.
1. Submit a new pull request, using `dev` as the base branch.
- If your code changes or extends the WireViz YAML syntax, be sure to update the [syntax description document](https://github.com/formatc1702/WireViz/blob/dev/docs/syntax.md) in your PR.
1. Please include in the PR description (and optionally also in the commit message body) a reference (# followed by issue number) to the issue where the suggested changes are discussed.
Expand Down
27 changes: 14 additions & 13 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[![PyPI - Version](https://img.shields.io/pypi/v/wireviz.svg?colorB=blue)](https://pypi.org/project/wireviz/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/wireviz.svg?)](https://pypi.org/project/wireviz/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/wireviz)](https://pypi.org/project/wireviz/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

## Summary

Expand Down Expand Up @@ -81,10 +82,11 @@ Output file:

[Source](../examples/demo02.yml) - [Bill of Materials](../examples/demo02.bom.tsv)

### Tutorial and example gallery
### Syntax, tutorial and example gallery

See the [tutorial page](../tutorial/readme.md) for sample code,
as well as the [example gallery](../examples/readme.md) to see more of what WireViz can do.
Read the [syntax description](syntax.md) to learn about WireViz' features and how to use them.

See the [tutorial page](../tutorial/readme.md) for sample code, as well as the [example gallery](../examples/readme.md) to see more of what WireViz can do.


## Usage
Expand Down Expand Up @@ -125,7 +127,7 @@ If you would like to contribute to this project, make sure you read the [contrib
$ wireviz ~/path/to/file/mywire.yml
```

This will output the following files
Depending on the options specified, this will output some or all of the following files:

```
mywire.gv GraphViz output
Expand All @@ -135,17 +137,16 @@ mywire.bom.tsv BOM (bill of materials) as tab-separated text file
mywire.html HTML page with wiring diagram and BOM embedded
```

#### Command line options

- `--prepend-file <FILE>` to prepend an additional YAML file. Useful for part libraries and templates shared among multiple cables/harnesses.
- `-o <OUTPUT>` or `--output_file <OUTPUT>` to generate output files with a name different from the input file.
- `-V` or `--version` to display the WireViz version.
- `-h` or `--help` to see a summary of the usage help text.

Wildcars in the file path are also supported to process multiple files at once, e.g.:
```
$ wireviz ~/path/to/files/*.yml
```

### Syntax description
To see how to specify the output formats, as well as additional options, run:

A description of the WireViz YAML input syntax can be found [here](syntax.md).
```
$ wireviz --help
```


### (Re-)Building the example projects
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[tool.isort]
profile = "black"
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
click
graphviz
pillow
pyyaml
Expand Down
55 changes: 29 additions & 26 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,44 @@
# -*- coding: utf-8 -*-

from pathlib import Path
from setuptools import setup, find_packages

from src.wireviz import __version__, CMD_NAME, APP_URL
from setuptools import find_packages, setup

README_PATH = Path(__file__).parent / 'docs' / 'README.md'
from src.wireviz import APP_URL, CMD_NAME, __version__

README_PATH = Path(__file__).parent / "docs" / "README.md"

setup(
name=CMD_NAME,
version=__version__,
author='Daniel Rojas',
#author_email='',
description='Easily document cables and wiring harnesses',
author="Daniel Rojas",
# author_email='',
description="Easily document cables and wiring harnesses",
long_description=open(README_PATH).read(),
long_description_content_type='text/markdown',
long_description_content_type="text/markdown",
install_requires=[
'pyyaml',
'pillow',
'graphviz',
],
license='GPLv3',
keywords='cable connector hardware harness wiring wiring-diagram wiring-harness',
"click",
"pyyaml",
"pillow",
"graphviz",
],
license="GPLv3",
keywords="cable connector hardware harness wiring wiring-diagram wiring-harness",
url=APP_URL,
package_dir={'': 'src'},
packages=find_packages('src'),
package_dir={"": "src"},
packages=find_packages("src"),
entry_points={
'console_scripts': ['wireviz=wireviz.wireviz:main'],
},
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Console',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Topic :: Utilities',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
"console_scripts": [
"wireviz=wireviz.wv_cli:wireviz",
],

},
classifiers=[
"Development Status :: 4 - Beta",
"Environment :: Console",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Topic :: Utilities",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
],
)
Loading