distutils

how to use distutils to create executable .zip file?

巧了我就是萌 提交于 2019-12-09 17:58:09
问题 Python 2.6 and beyond has the ability to directly execute a .zip file if the zip file contains a __main__.py file at the top of the zip archive. I'm wanting to leverage this feature to provide preview releases of a tool I'm developing that won't require users to install anything beyond copying the .zip file to their disk. Is there a standard way to create such a zip file? I'm looking for a solution that works with python 2.6 and python 2.7. Ideally I would like to use distutils, since I

How does setuptools decide which files to keep for sdist/bdist?

大憨熊 提交于 2019-12-08 21:42:32
问题 I'm working on a Python package that uses namespace_packages and find_packages() like so in setup.py: from setuptools import setup, find_packages setup(name="package", version="1.3.3.7", package=find_packages(), namespace_packages=['package'], ...) It isn't in source control because it is a bundle of upstream components. There is no MANIFEST. When I run python setup.py sdist I get a tarball of most of the files under the package/ directory but any directories that don't contain .py files are

Compile cython code with “python compile.py” and no “build” command-line parameter

谁说我不能喝 提交于 2019-12-08 19:31:28
I have a compile.py script: from distutils.core import setup from Cython.Build import cythonize setup(ext_modules = cythonize("module1.pyx")) that compiles my Cython code. The drawback is that I have to call it with a command-line parameter build : python compile.py build Instead, I would like to be able to call this compile.py directly from Sublime Text, as usual, with CTRL + B . To do that, it should work from: python compile.py Question: how to modify the above script so that it can be run with python compile.py ? Method #1 : Use script_args like this: setup(ext_modules=cythonize("module1

Why does `setup.py develop` not work?

强颜欢笑 提交于 2019-12-08 18:38:07
问题 I would like to install my Python module in development mode. As I have seen in many examples python setup.py develop is supposed to do that. But the develop command does not exist for my setup.py file: from distutils.core import setup from distutils.extension import Extension from Cython.Build import cythonize from Cython.Distutils import build_ext import os src = ["_NetworKit.pyx"] # list of source files modules = [Extension("_NetworKit", src, language = "c++", extra_compile_args=["-fopenmp

Creating a Python package for a C extension-only module which is pre-built

允我心安 提交于 2019-12-08 15:46:32
问题 I want to create a package for a project that does not contain any .py source files, but is completely implemented as a Python C extension (resulting in an .so ). Additionally, assume that the .so is already built by a separate build process (say CMake). I know that setuptools/distutils minimally requires a directory structure: mymodule __init__.py But what I really want is for mymodule to be provided by a C extension (say mymodule.so ) such that after installing the package, import mymodule

How to overwrite pypi package when doing upload from command line?

怎甘沉沦 提交于 2019-12-08 14:32:00
问题 I want to automate the upload process bug in some cases the python setup.py upload fails because pypi server already have the save version uploaded. How can I force it to upload, from the script (i know I can remove the old variant using the web interface). 回答1: Here's an actual answer, not just me adding more pontification in the comments. Found this thread: https://www.reddit.com/r/Python/comments/35xr2q/howto_overwrite_package_when_reupload_to_pypi/ That refers to this: http://comments

Can I use an alternative build system for my Python extension module (written in C++)?

橙三吉。 提交于 2019-12-08 08:21:49
问题 While distutils works alright, I'm not entirely comfortable with it, and I also have performance problems with no apparent solution. Is it possible to integrate Premake or cmake in my setup.py script so that python setup.py build calls them and then places the output where install expects it? 回答1: I figured out a way, it's not pretty but it works. Here is a summation of my setup.py script file - it should be fairly self explanatory: import shutil import os from distutils.core import setup

Compile cython code with “python compile.py” and no “build” command-line parameter

南笙酒味 提交于 2019-12-08 08:21:25
问题 I have a compile.py script: from distutils.core import setup from Cython.Build import cythonize setup(ext_modules = cythonize("module1.pyx")) that compiles my Cython code. The drawback is that I have to call it with a command-line parameter build : python compile.py build Instead, I would like to be able to call this compile.py directly from Sublime Text, as usual, with CTRL + B . To do that, it should work from: python compile.py Question: how to modify the above script so that it can be run

How do I distribute precompiled extension modules for Windows on pypi for multiple versions of Python?

空扰寡人 提交于 2019-12-08 06:44:33
问题 I would like to distribute a precompiled C extension module for Python 2.6 and Python 2.7 for 32- and 64-bit versions of Python. How should I build and distribute that on pypi? Should I just use bdist_egg? Can I retain compatibility with pip? I notice ordinary bdist just creates a .zip that does not include the Python version, although the internal folder structure does. Can this .zip just contain e.g. a Python26 and Python27 subdirectory? 回答1: You generally need to run bdist_something with

How do I distribute precompiled extension modules for Windows on pypi for multiple versions of Python?

两盒软妹~` 提交于 2019-12-08 03:02:28
I would like to distribute a precompiled C extension module for Python 2.6 and Python 2.7 for 32- and 64-bit versions of Python. How should I build and distribute that on pypi? Should I just use bdist_egg? Can I retain compatibility with pip? I notice ordinary bdist just creates a .zip that does not include the Python version, although the internal folder structure does. Can this .zip just contain e.g. a Python26 and Python27 subdirectory? You generally need to run bdist_something with each version of Python you need to support. bdist_egg does indeed work with PIP afaik (you can easily test it