ftpsolutions / python-third-party-license-file-generator

A tool that walks your Python project's requirements and gathers the third party licenses for you
MIT License
13 stars 5 forks source link

Support of pyproject.toml? #15

Closed fhg-isi closed 3 months ago

fhg-isi commented 10 months ago

How to generate THIRDPARTYLICENSES file from pyproject.toml instead of requirements.txt?

initialed85 commented 10 months ago

I don’t think it supports it I’m afraid- you could maybe write some hacky to create a requirements.txt from your pyprojects.toml and see if that worked.

Otherwise we’d gladly welcome a pull request adding this feature!

fhg-isi commented 10 months ago

Thank you for the reply. Instead of generating requirements.txt from pyproject.toml I generate it now from the imports using pipreqs --force . Here is the corresponding github workflow:

name: back_end_third_party_license_file_generation
on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - name: setup python
      uses: actions/setup-python@v3
      with:
        python-version: 3.11
    - name: install dependencies
      run: |
        cd back_end
        pip install .[license]
    - name: generate temp requirements.txt
      run: |
        cd back_end
        pipreqs --force .
    - name: show python path
      run: |
        which python3
    - name: third party license file generation
      run: |
        cd back_end
        python3 -m third_party_license_file_generator -r requirements.txt -o THIRDPARTY.md -p /opt/hostedtoolcache/Python/3.11.7/x64/bin/python3
    - name: delete temp requirements.txt file
      run: |
        cd back_end
        rm requirements.txt
    - name: push changes
      # also see https://github.com/stefanzweifel/git-auto-commit-action
      uses: stefanzweifel/git-auto-commit-action@v4
      with:
        commit_message: updated third party license file \#1
lowaa commented 3 months ago

@fhg-isi This one has now been fixed and is available in PyPI

@initialed85 Thanks for fielding the question all those months ago :)