-
Notifications
You must be signed in to change notification settings - Fork 98
Enable building Python packages for PyPI distribution #103
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
Changes from all commits
527ca7a
4311a8e
1227830
6f77806
a4eee6b
e47a89a
9280ebe
fe5a306
717b965
399975f
cdf910c
56eb1ca
3b67fc3
58a4505
e804553
8c90040
9b5b5f2
bf5b805
7f1fb86
85a8615
5d6c5e9
c018c70
5a87e04
0cb6fc4
fe04253
2f71436
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,3 +8,4 @@ Jarek Polok <[email protected]> | |
| Neal Gompa <[email protected]> | ||
| Ralph Bean <[email protected]> | ||
| Frank Schreiner <[email protected]> | ||
| Daniel Alley <[email protected]> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -102,6 +102,31 @@ cause degradation of performance. | |
|
|
||
| Without git revision specified HEAD is used. | ||
|
|
||
| ## Build Python package | ||
|
|
||
| To create a binary "wheel" distribution, use: | ||
|
|
||
| python setup.py bdist_wheel | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should suggest the pip way instead:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are there any specific benefits? I've not seen this way before, but according to stack overflow and github issues, it can be fairly slow because it copies everything into a temp directory before doing the build.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moving forward, the idea is to build python package using a standard approach that is independent from the build backend. The fact setuptools is used in an implementation details and we should try to move away from it, ideally i think the user experience should be the same for building wheels. The other advantage is that it keeps the source tree clean of any artifact. Timing wise, here is quick comparison for this project
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair points. The only objection I have is that w/ Pip v9 (which is what is currently installed on most distributions, including the newest Fedora and Ubuntu), you would also have to install the I would probably err on the side of consistency, so if there's an analogous pip command for building sdists, we can use those. But otherwise I would probably stick with the "standard" way for now and update it later on.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
No
Agreed. |
||
|
|
||
| To create a source distribution, use: | ||
|
|
||
| python setup.py sdist | ||
|
|
||
| Installing source distributions require the installer of the package to have all of the build dependencies installed on their system, since they compile the code during installation. Binary distributions are pre-compiled, but they are likely not portable between substantially different systems, e.g. Fedora and Ubuntu. | ||
|
|
||
| Note: if you are building a bdist or installing the sdist on a system with an older version of Pip, you may need to install the ```scikit-build``` Python package first. | ||
|
|
||
| To install either of these packages, use: | ||
|
|
||
| pip install dist/{{ package name }} | ||
|
|
||
| To create an "editable" install of createrepo_c, use: | ||
|
|
||
| python setup.py develop | ||
|
|
||
| Note: To recompile the libraries and binaries, you muse re-run this command. | ||
|
|
||
|
|
||
| ## Build RPM package | ||
|
|
||
| Modify createrepo_c.spec and run: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| [build-system] | ||
| requires = ["setuptools", "wheel", "scikit-build"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| setuptools | ||
| wheel | ||
| scikit-build |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| from skbuild import setup | ||
|
|
||
|
|
||
| with open('VERSION.cmake', 'r+') as version_file: | ||
| lines = version_file.read().splitlines() | ||
| # parse out digit characters from the line, convert to int | ||
| numbers = [int("".join(filter(str.isdigit, line))) for line in lines] | ||
| # build version string | ||
| version = '{major}.{minor}.{patch}'.format( | ||
| major=numbers[0], | ||
| minor=numbers[1], | ||
| patch=numbers[2] | ||
| ) | ||
|
|
||
| setup( | ||
| name='createrepo_c', | ||
| description='C implementation of createrepo', | ||
| version=version, | ||
| license='GPLv2+', | ||
| author='RPM Software Management', | ||
| author_email='[email protected]', | ||
| url='https://github.com/rpm-software-management', | ||
| classifiers=( | ||
| 'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)', | ||
| 'Operating System :: POSIX :: Linux', | ||
| 'Programming Language :: C', | ||
| 'Topic :: System :: Software Distribution', | ||
| 'Topic :: System :: Systems Administration', | ||
| "Programming Language :: Python :: 2", | ||
| 'Programming Language :: Python :: 2.7', | ||
| 'Programming Language :: Python :: 3', | ||
| 'Programming Language :: Python :: 3.4', | ||
| 'Programming Language :: Python :: 3.5', | ||
| 'Programming Language :: Python :: 3.6', | ||
| 'Programming Language :: Python :: 3.7', | ||
| ), | ||
| packages=['createrepo_c'], | ||
| package_dir={ | ||
| 'createrepo_c': 'src/python/createrepo_c' | ||
| }, | ||
| cmake_args=[ | ||
| '-DBIN_INSTALL_DIR:PATH=src/python/createrepo_c/data/bin', | ||
| '-DBUILD_LIBCREATEREPO_C_SHARED:BOOL=OFF', | ||
| '-DCREATEREPO_C_INSTALL_DEVELOPMENT:BOOL=OFF', | ||
| '-DCREATEREPO_C_INSTALL_MANPAGES:BOOL=OFF', | ||
| '-DENABLE_BASHCOMP:BOOL=OFF', | ||
| '-DENABLE_DRPM:BOOL=OFF' | ||
| ], | ||
| cmake_languages=['C'], | ||
| entry_points={ | ||
| 'console_scripts': [ | ||
| 'createrepo_c=createrepo_c:createrepo_c', | ||
| 'mergerepo_c=createrepo_c:mergerepo_c', | ||
| 'modifyrepo_c=createrepo_c:modifyrepo_c', | ||
| 'sqliterepo_c=createrepo_c:sqliterepo_c' | ||
| ] | ||
| }, | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're being verbose for the other options, should this be named
CREATEREPO_C_INSTALL_BASHCOMPto be more consistent?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Ideally, option specific to the project should be prefixed by the project name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this could be done in a different PR along with some other stylistic changes