python-packaging

Parser for Pipfiles (get a list of all packages used in a Pipfile)

醉酒当歌 提交于 2019-12-11 19:29:43
问题 Is there any parser out there for reading in a Pipfile and returning a list of all packages used in the Pipfile? If not, how would one go about this? I was thinking a regular expression could do the job, but I am not sufficiently acquainted with the structure of Pipfiles to confirm that is the case. 回答1: first install pipfile pip install pipfile . then just use the parser it provides from pipfile import Pipfile parsed = Pipfile.load(filename=pipfile_path) 来源: https://stackoverflow.com

Unable to import module from another package

穿精又带淫゛_ 提交于 2019-12-11 10:39:34
问题 I have a directory structure like this conf __init__.py settings.py abc.conf def.conf src main.py xyz.py src I chose not to make a package but a regular folder. I am trying to import the settings.py file in the main.py and executing the whole thing with the command python3 main.py My import statement in main.py : import conf.settings The error I'm getting is No module named conf.settings and I can't get my head around it. Is python failing to recognize conf as a package? Can packages contain

Clone some packages from base env to another one

淺唱寂寞╮ 提交于 2019-12-11 04:47:44
问题 I installed anaconda. So I already have a lot of packages installed. Now I created new one env (almost empty). And start to install some specific packages to it. I have no internet on this machine, so I need to copy wheels or source files to it. Ok, it works, but Why I need to download and copy some packages like numpy when I already have it in base env? So my question is - How to install packages to new env if I already have them in base? --use-locals key or smth else? I found this one

Difference between devpi and pypi server

安稳与你 提交于 2019-12-10 14:26:22
问题 Had a quick question here, am used to devpi and was wondering what is the difference between devpi and pypi server ? Is on better than another? Which of this one scale better? Cheers 回答1: PyPI (Python Package Index)- is the official repository for third-party Python software packages. Every time you use e.g. pip to install a package that is not in the standard it will get downloaded from the PyPI server. All of the packages that are on PyPI are publicly visible. So if you upload your own

AWS Lambda Function can import a module when run locally, but not when deployed

为君一笑 提交于 2019-12-09 06:51:28
I am attempting to expand on this guide , by building a CodePipeline to pick up changes in GitHub, build them, and deploy the changes to my Lambda. sam build --use-container; sam local start-api allows me to successfully call the function locally - but when I deploy the function to AWS, the code fails to import a dependency. My code depends on requests . I have duly included that in my requirements.txt file: requests==2.20.0 My buildspec.yml includes directions to install the dependencies version: 0.1 phases: install: commands: - pip install -r hello_world/requirements.txt -t . - pip install

adding a newly created and uploaded package to pycharm

ぐ巨炮叔叔 提交于 2019-12-08 15:02:13
问题 I created a package (thompcoUtils) on test.pypi.org and pypi.org https://pypi.org/project/thompcoUtils/ and https://test.pypi.org/project/thompcoUtils/ show the package is installed in both the test and live repositories I added the repositories https://test.pypi.org/simple/ and https://pypi.org/simple/ to pycharm. I refreshed and searched for the package in pycharm under available packages but thompcoUtils could not be found. I am using virtual environments in pycharm I am able to install

AWS Lambda Function can import a module when run locally, but not when deployed

最后都变了- 提交于 2019-12-08 05:23:14
问题 I am attempting to expand on this guide, by building a CodePipeline to pick up changes in GitHub, build them, and deploy the changes to my Lambda. sam build --use-container; sam local start-api allows me to successfully call the function locally - but when I deploy the function to AWS, the code fails to import a dependency. My code depends on requests . I have duly included that in my requirements.txt file: requests==2.20.0 My buildspec.yml includes directions to install the dependencies

How should I handle importing third-party libraries within my setup.py script?

我的未来我决定 提交于 2019-12-07 05:37:22
问题 I'm developing a Python application and in the process of branching off a release. I've got a PyPI server set up on a company server and I've copied a source distribution of my package onto it. I checked that the package was being hosted on the server and then tried installing it on my local development machine. I ended up with this output: $ pip3 install --trusted-host 172.16.1.92 -i http://172.16.1.92:5001/simple/ <my-package> Collecting <my-package> Downloading http://172.16.1.92:5001

Correct use of PEP 508 environment markers in setup.cfg

China☆狼群 提交于 2019-12-06 02:28:27
问题 I am trying to make use of PEP 496 -- Environment Markers and PEP 508 -- Dependency specification for Python Software Packages by specifying dependencies that only make sense on specific OS. My setup.py looks like this: import setuptools assert setuptools.__version__ >= '36.0' setuptools.setup() My minimal setup.cfg looks like this: [metadata] name = foobar version = 1.6.5+0.1.0 [options] packages = find: install_requires = ham >= 0.1.0 eggs >= 8.1.2 spam >= 1.2.3; platform_system=="Darwin" i

How should I handle importing third-party libraries within my setup.py script?

有些话、适合烂在心里 提交于 2019-12-05 11:42:14
I'm developing a Python application and in the process of branching off a release. I've got a PyPI server set up on a company server and I've copied a source distribution of my package onto it. I checked that the package was being hosted on the server and then tried installing it on my local development machine. I ended up with this output: $ pip3 install --trusted-host 172.16.1.92 -i http://172.16.1.92:5001/simple/ <my-package> Collecting <my-package> Downloading http://172.16.1.92:5001/packages/<my-package>-0.2.0.zip Complete output from command python setup.py egg_info: Traceback (most