Skip to content

Commit

Permalink
feat: poetry add entrypoint to the module (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianScheidegger authored Oct 30, 2024
1 parent 82c723e commit dcdf6ea
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ poetry add https://github.com/SchweizerischeBundesbahnen/python-requirements-ins
```
## Execute
```bash
python -m python_requirements_inspector.main inputs.json
poetry run inspect-requirements path/to/input/json
```
## Outputs will be returned in outputs.json
## Outputs will be returned in /tmp/output_*.json
```json
[
{"id": "requirements1",
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ tox = "^4.12.1"
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
inspect-requirements = "python_requirements_inspector.main:run"

[tool.ruff]
line-length = 240
fix = true
Expand Down
9 changes: 6 additions & 3 deletions python_requirements_inspector/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def main(json_path: str) -> str:
return output_file.name


if __name__ == "__main__":
def run() -> None:
# Set up the command-line argument parser
parser = argparse.ArgumentParser(description="Analyses workitem data provided by a json file.")
parser.add_argument("jsonfile", type=str, help="path to the json file")
Expand All @@ -50,5 +50,8 @@ def main(json_path: str) -> str:
args = parser.parse_args()
json_file_path = args.jsonfile

output_file_path = main(json_file_path)
print(output_file_path)
print(main(json_file_path))


if __name__ == "__main__":
run()

0 comments on commit dcdf6ea

Please sign in to comment.