I have a C++ library project. This project is build by conan. Also I have a Python wrapper for the first project. The python project is built by setuptools.
How can setuptools pull the native library from conan repo to include in into the wheel (*.whl) file?
Or is it possible to make a wheel file using conan?
I've found this solution: https://blog.conan.io/2016/12/12/Conan-python-package-manager.html
But in this solution conan does not create a wheel file to distribute the package.
Related
In order to stage python project within our corporation I need to make an installable distribution.
This should include:
An egg or whl for my project
An egg or whl for every dependency of the project
(optionally) produce a requirements.txt file listing all the installable components for this release
Is there an easy plug in, (e.g. an alternative to bdist_wheel) that will not only compile one wheel but also that project's components?
Obviously I can script this, but I was hoping that there might be a short-cut that builds the package + dependencies in fewer steps.
This needs to work on Python 2.7 on Windows + Linux.
You will need to create a setup.py file for your package. Make sure you have the latest setuptools and pip installed. Then run the following:
python setup.py bdist_wheel
This will create a wheel file for your package. This assumes you don't have C/C++ headers, DLLs, etc. If you do, then you'll probably have a lot more work to do.
To get dependencies, you will want to create a requirements.txt file and run the following:
pip wheel -r requirements.txt
If your package isn't on PyPI, then you'll have to manually copy your package's wheel file into the wheel folder that this command creates. For more information see the following excellent article:
http://lucumr.pocoo.org/2014/1/27/python-on-wheels/
With the latest pip and wheel, you can simply run
pip wheel .
within your project folder, even if your application isn't on PyPi. All wheels will be stored in the current directory (.).
To change the output directory (to for example, ./wheels), you may use the -w / --wheel-dir option:
pip wheel . -w wheels
All the options available are listed at the pip documentation.
With poetry you can define your dependencies and metadata about your project in a file in the root of your project, called pyproject.toml:
[tool.poetry]
name = "my-project"
version = "0.1.0"
description = "some longer description"
authors = ["Some Author <some#author.io>"]
[tool.poetry.dependencies]
python = "*"
[tool.poetry.dev-dependencies]
pytest = "^3.4"
To build your project as a wheel, execute poetry build
$ poetry build
Building my-project (0.1.0)
- Building sdist
- Built my-project-0.1.0.tar.gz
- Building wheel
- Built my-project-0.1.0-py3-none-any.whl
a dist/ folder is created with a wheel for your project.
Use Case:
I'm developing a PyQt5-based GUI application that I want to deploy using setuptools (setup.py)
The package includes .ui and .qrc files that need to be compiled before running the application
The application should work out of the box, no matter if installing from a .whl file, or from source by using python setup.py install or pip install -e . in editable mode
Question:
What is the right strategy to compile those resource files?
During installation? (When/how exactly?)
When running it the first time? (But then the installed PyPI package would need to add files to itself in-place, is this allowed/desired?)
Hi I have a built up Python 2.7 environment with Ubuntu 19.10.
I would like to build a whl package for pandas.
I pip installed the pandas but do not know how to pack it into whl package.
May I ask what I should do to pack it.
Thanks
You cannot pack back an installed wheel. Either you download a ready-made wheel with pip download or build from sources: python setup.py bdist_wheel (need to download the sources first).
Super newb question here..
What does pip install actually do?
Assuming the pypi package is a tarball...
Does it just download the tar.gz, unpack it and run setup.py?
Does it add the downloaded package to the site_packages folder?
I want to create a pip installable pkg using pypiserver so my colleagues can download my pkg in a painless way, but am a little unsure exactly what to include beyond the actual .py scripts.
Any guidance would be appreciated
The tar.gz file is a source archive whereas the .whl file is a built
distribution. Newer pip versions preferentially install built
distributions, but will fall back to source archives if needed. You
should always upload a source archive and provide built archives for
the platforms your project is compatible with. In this case, our
example package is compatible with Python on any platform so only one
built distribution is needed.
See: https://packaging.python.org/tutorials/packaging-projects/
You would typically not manually create the source archive and wheel, but use setuptools and wheel to do so for you.
Nowadays, many packages are wheels. While installing these wheels using pip, pip will:
[...] unpack the archive in your current site packages directory and install any console scripts contained in the wheel.
See: https://wheel.readthedocs.io/en/stable/user_guide.html#installing-wheels
I am installing dependencies of my package through setup.py file. If the package is not present in PyPI like oracle-bmcs-python-sdk , then how I can integrate it in my setup.py file. Currently we have public link of oracle bmc sdk:
https://docs.us-phoenix-1.oraclecloud.com/tools/ruby/latest/download/oracle-bmcs-ruby-sdk.zip
Now using only above link how can I install oraclebmc sdk from setup.py file ?
I have tried adding it in dependency_links but it doesn't work.
The BMCS Python SDK is now on PyPI, so adding it to your setup.py script should be the same as how you'd add any other Python package on PyPI.