Giter Club home page Giter Club logo

pipoe's Introduction

pipoe

The objective of this project is to make creating OpenEmbedded python recipes just a bit easier. pipoe will take either a single package name or a requirements file and recursively generate bitbake recipes for every pypi package listed. It is not guaranteed that it will work for every package. Additionally, many recipes will still require additional modification after generation (patches, overrides, appends, etc.). In those cases it is recommended that the user add these modifications in a bbappend file.

Install

> pip3 install pipoe

Licenses

Licensing within OE is typically pretty strict. pipoe contains a license map which will attempt to map a packages license to one that will be accepted by the OE framework. If a license string is found which cannot be mapped, the user will be prompted to enter a valid license name. This mapping will be saved and the updated map will be saved to ./licenses.py if the --licenses flag is provided. It is recommended that this file be PR'ed to this repository when generally useful changes are made.

Extras

pipoe supports generating "extra" recipes based on the extra feature declarations in the packages requires_dist field (i.e. urllib3[secure]). These recipes are generated as packagegroups which rdepend on the base package.

Versions

By default pipoe will generate a recipe for the newest version of a package. Supplying the --version argument will override this behavior. Additionally, pipoe will automatically parse versions from requirements files.

Example

> pipoe --help
usage: pipoe [-h] [--package PACKAGE] [--version VERSION]
             [--requirements REQUIREMENTS] [--extras] [--outdir OUTDIR]
             [--python {python,python3}] [--licenses]
             [--default-license DEFAULT_LICENSE]

optional arguments:
  -h, --help            show this help message and exit
  --package PACKAGE, -p PACKAGE
                        The package to process.
  --version VERSION, -v VERSION
                        The package version.
  --requirements REQUIREMENTS, -r REQUIREMENTS
                        The pypi requirements file.
  --extras, -e          Generate recipes for extras.
  --outdir OUTDIR, -o OUTDIR
                        The recipe directory.
  --python {python,python3}, -y {python,python3}
                        The python version to use.
  --licenses, -l        Output an updated license map upon completion.
  --default-license DEFAULT_LICENSE, -d DEFAULT_LICENSE
                        The default license to use when the package license
                        cannot be mapped.
  --pypi, -s            Use oe pypi class for recipe
> pipoe -p requests
Gathering info:
  requests
  | chardet
  | idna
  | urllib3
  | certifi
Generating recipes:
  python-requests_2.21.0.bb
  python-chardet_3.0.4.bb
  python-idna_2.8.bb
  python-urllib3_1.24.1.bb
  python-certifi_2018.11.29.bb

License mappings are available in: ./licenses.py
PREFERRED_VERSIONS are available in: ./python-versions.inc

pipoe's People

Contributors

jraygauthier avatar monopolis avatar nfjones avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pipoe's Issues

Optionally not install a package's dependencies

I would like to submit a PR to optionally not chase a package's dependencies.

My use case is that I'm using a Lock file that pins exact versions. We don't want multiple versions of packages generated.

Would such a change be supported?

Thank you.

Missing files in sdist

It appears that the manifest is missing at least one file necessary to build
from the sdist for version 2019.11. You're in good company, about 5% of other
projects updated in the last year are also missing files.

+ /tmp/venv/bin/pip3 wheel --no-binary pipoe -w /tmp/ext pipoe==2019.11
Looking in indexes: http://10.10.0.139:9191/root/pypi/+simple/
Collecting pipoe==2019.11
  Downloading http://10.10.0.139:9191/root/pypi/%2Bf/7c9/1c8440ed8390c/pipoe-2019.11.tar.gz (8.9 kB)
    ERROR: Command errored out with exit status 1:
     command: /tmp/venv/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-wheel-d2cva9aw/pipoe/setup.py'"'"'; __file__='"'"'/tmp/pip-wheel-d2cva9aw/pipoe/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-wheel-d2cva9aw/pipoe/pip-egg-info
         cwd: /tmp/pip-wheel-d2cva9aw/pipoe/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-wheel-d2cva9aw/pipoe/setup.py", line 13, in <module>
        with open("requirements.txt", "r") as infile:
    FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

pipoe fails if project does not have a setup.py

Steps to reproduce:

$ pipoe -p typing-extensions
Gathering info:
  typing-extensions
Failed to translate license:
Please enter a valid license name: Python Software Foundation License
   [ERROR] Failed to gather typing-extensions ([Errno 2] No such file or directory: '/tmp/tmp2wy9_lkw/typing-extensions_4.5.0.tar.gz.d/typing_extensions-4.5.0/setup.py')
Generating recipes:

PREFERRED_VERSIONS are available in: ./python-versions.inc

typing-extensions is using pyproject.toml
https://github.com/python/typing_extensions/blob/main/pyproject.toml

Note how typing-extensions does not have a setup.py file

$ ls /tmp/tmphn_ez3lq/typing-extensions_4.5.0.tar.gz.d/typing_extensions-4.5.0
CHANGELOG.md  LICENSE  PKG-INFO  pyproject.toml  README.md  src

Handle "extra" dependencies

Some packages provide "extra" packages. genpybb should be able to parse those and generate recipes for them.

Ignore PEP 496 environment markers in requirements.txt

I used poetry to export my requirements.txt file and it adds stuff to the package version like this:

flask==1.1.2; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0")
gevent==21.1.2; python_version >= "3.4" and python_full_version < "3.0.0" or python_version >= "3.4" and python_full_version >= "3.5.0"
greenlet==1.0.0; python_version >= "3.4" and python_full_version < "3.0.0" and platform_python_implementation == "CPython" or python_version >= "3.4" and python_full_version >= "3.5.0" and platform_python_implementation == "CPython"
gunicorn==20.0.4; python_version >= "3.4"

which makes the tool fail with fun errors like [ERROR] Failed to gather gevent (URL can't contain control characters. '/pypi/gevent/21.1.2; python_version >= "3.4" and python_full_version < "3.0.0" or python_version >= "3.4" and python_full_version >= "3.5.0"/json' (found at least ' '))

version flag is not working

when I specify the version I want, even if it is the latest one, pipoe always fail with (No sdist package can be found error)

I can run the command without specifying the version, but for libraries that depend on specific version is problematic.
For example, I can't install awsiotsdk, even without specifying the version, because it depends explicitly on awscrt v.0.14.0:

awsiotsdk
  | awscrt==0.14.0
  |  [ERROR] Failed to gather awscrt (No sdist package can be found.)

python3-versions.inc always overwriten

I think project is dead but anyway:
Asume in python3-versions.inc should be always add latest package with latest version.
But it's always overwriten with latest package gattered with pipoe.
Is that by design?

Automatically place recipes in their own folders

If I run

$ pipoe -y python3 -p halo
Gathering info:
  halo
  | log-symbols
  |-- colorama
  | spinners
  | termcolor
  | six
Generating recipes:
  python3-halo_0.0.31.bb
  python3-log-symbols_0.0.14.bb
  python3-colorama_0.4.4.bb
  python3-spinners_0.0.24.bb
  python3-termcolor_1.1.0.bb
  python3-six_1.16.0.bb

PREFERRED_VERSIONS are available in: ./python3-versions.inc

pipoe generates a bunch of recipes - however I now have to manually put each of them into their own folder to be recognised by bitbake.

It would be nice if pipoe had an option to do this automatically!

pipoe utils in python 3

I´m try to create the bb file for utils 1.0.1, https://pypi.org/project/utils/#modal-close

when run the command:
pipoe -p utils --python python3

The following info is shown:

Gathering info:
utils
Failed to translate license:
Please enter a valid license name:

I´m enter :
LGPLv3+

the following message is show:

[ERROR] Failed to gather utils (No sdist package can be found.)
Generating recipes:

PREFERRED_VERSIONS are available in: ./python3-versions.inc

(I'm Sorry if mistake any step)

pipoe cannot gather the requests package.

This is a great tool but unfortunately when trying to generate a set of recipes that includes requests as a dependency, I encounter an error. This can be reproduced by running for the requests package on its own:

build@hostname:~$ pipoe --python python3 -p requests
Gathering info:
  requests
   [ERROR] Failed to gather requests (
win-inet-pton; sys_platform == "win32" and python_version == "2.7" and extra == 'socks'
                                                                    ^
Parse error at line 1, column 68: expected EOF. trail: [wsp]
)
Generating recipes:

PREFERRED_VERSIONS are available in: ./python3-versions.inc

It looks like the parser imported from pep508_parser raises an exception when it encounters the requires_dist value 'win-inet-pton; sys_platform == "win32" and python_version == "2.7" and extra == \'socks\''.

Exception handling could be added around

d = parse_requires_dist(dep)

to ensure that the script completes and adds the other dependencies, I'm not familiar with pep508 to know whether the parser should be fixed as well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.