python-packaging

How do I list the files inside a python wheel?

南笙酒味 提交于 2020-06-24 06:01:20
问题 I'm poking around the various options to setup.py for including non-python files, and they're somewhat less than intuitive. I'd like to be able to check the package generated by bdist_wheel to see what's actually in it--not so much to make sure that it will work (that's what tests are for) but to see the effects of the options I've set. How do I list the files contained in a .whl ? 回答1: You can take the wheel file change the extension to .zip and then extract the contents like any other zip

How do I list the files inside a python wheel?

一笑奈何 提交于 2020-06-24 06:00:03
问题 I'm poking around the various options to setup.py for including non-python files, and they're somewhat less than intuitive. I'd like to be able to check the package generated by bdist_wheel to see what's actually in it--not so much to make sure that it will work (that's what tests are for) but to see the effects of the options I've set. How do I list the files contained in a .whl ? 回答1: You can take the wheel file change the extension to .zip and then extract the contents like any other zip

PyAudio package not installing

笑着哭i 提交于 2020-06-07 05:56:44
问题 Trying to install the PyAudio package using pip is showing an error, while other packages are installing normally. I am using python 3.7. Why is this error happening? C:\Users\Himanshu>pip install PyAudio Collecting PyAudio Using cached https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz Installing collected packages: PyAudio Running setup.py install for PyAudio ... error Complete output from command c:\users

python - setup.py sdist bdist_wheel

生来就可爱ヽ(ⅴ<●) 提交于 2020-05-14 14:41:25
问题 I decided to create a small little module named "NsmPY". Once I had finished the code behind the module (available on GitHub), I got to work trying to upload this new module to PyPi. However, when I ran the necessary command python3 setup.py sdist bdist_wheel , the program spat out an error: running sdist running egg_info writing nsmpy.egg-info\PKG-INFO writing dependency_links to nsmpy.egg-info\dependency_links.txt writing top-level names to nsmpy.egg-info\top_level.txt reading manifest file

How do I get the current 'package' name? (setup.py)

放肆的年华 提交于 2020-03-22 08:05:59
问题 How do I get the current topmost package, i.e., the name defined in setup.py? Here is my tree : . |-- README.md |-- the_project_name_for_this_pkg | |-- __init__.py | |-- __main__.py | |-- _config | | `-- foo.conf | |-- _data | | `-- logging.yml | `-- tests | |-- __init__.py | `-- test_foo.py <--- # executing from here |-- requirements.txt `-- setup.py 4 directories, 9 files The only solution I've gotten to work so far is this: import os import sys os.path.basename(sys.path[1]) But this is

How do I get the current 'package' name? (setup.py)

落花浮王杯 提交于 2020-03-22 08:03:10
问题 How do I get the current topmost package, i.e., the name defined in setup.py? Here is my tree : . |-- README.md |-- the_project_name_for_this_pkg | |-- __init__.py | |-- __main__.py | |-- _config | | `-- foo.conf | |-- _data | | `-- logging.yml | `-- tests | |-- __init__.py | `-- test_foo.py <--- # executing from here |-- requirements.txt `-- setup.py 4 directories, 9 files The only solution I've gotten to work so far is this: import os import sys os.path.basename(sys.path[1]) But this is

Python packaging of weakly dependent projects

五迷三道 提交于 2020-03-15 05:51:36
问题 I am trying to figure out a good way to package and deploy a number of python packages I created. Eventually, I would like to use some package repository for deployment or create some sort of setup script. The structure of my project is as follows: I have two subprojects A and B that both use tools from another self-created package C . The tools in C are for internal use only and not of bigger interest to a general audience. However, A and B shall be deployed. I want that users can install A

Python packaging of weakly dependent projects

旧巷老猫 提交于 2020-03-15 05:51:06
问题 I am trying to figure out a good way to package and deploy a number of python packages I created. Eventually, I would like to use some package repository for deployment or create some sort of setup script. The structure of my project is as follows: I have two subprojects A and B that both use tools from another self-created package C . The tools in C are for internal use only and not of bigger interest to a general audience. However, A and B shall be deployed. I want that users can install A

How to import a module from a different folder?

倾然丶 夕夏残阳落幕 提交于 2020-03-14 07:52:46
问题 I have a project which I want to structure like this: myproject __init__.py api __init__.py api.py backend __init__.py backend.py models __init__.py some_model.py Now, I want to import the module some_model.py in both api.py and backend.py . How do I properly do this? I tried: from models import some_model but that fails with ModuleNotFoundError: No module named 'models' . I also tried: from ..models import some_model which gave me ValueError: attempted relative import beyond top-level

Getting Python package distribution version from within a package

ε祈祈猫儿з 提交于 2020-02-27 08:16:28
问题 You can get the version of a python distribution using import pkg_resources pkg_resources.get_distribution("distro").version This is great if you know the distribution name, however I need to dynamically figure out my distribution name at runtime. # Common framework base app class, extended by each app class App(object): def get_app_version(self) -> str: package_name = self.__class__.__module__.split('.')[0] try: return pkg_resources.get_distribution(package_name).version except Exception: