我试图使用Travis CI进行持续集成,但自从第一次使用Travis以来,我一直在处理很多问题。最近,我遇到以下生成失败:
ModuleNotFoundError: No module named 'my-package'
在我的db.py
文件中的以下代码行中会发生这种情况:
我应该提到我使用的是importlib
,因为我的存储库名称中有破折号,并且根据this post中的建议,我开始使用该包。在
现在,我的项目结构如下:
my-project
├── conf
├───── db_conf.py
├── lib
└───── db.py
如您所见,我试图从conf
目录导入db_conf.py
,但没有遇到名为issue的模块。在过去的几天里,我一直坚持这样做,并在上面找到了以下帖子:this one和{a3}。问题是我试过所有这些方法,但似乎没有一个对我有效。以下是我的.travis.yml
和setup.py
文件的外观:
。特拉维斯·伊梅尔
language: python
python:
- 3.7
env:
global:
# TRAVIS TESTING CONFIGURATION
- COMMIT=${TRAVIS_COMMIT::8}
- CGO_ENABLED=0
- GOOS=linux
- GOARCH=amd64
before_script:
- export PYTHONPATH=$PYTHONPATH:$(pwd)
before_install:
- python --version
- pip install -U pip
- python setup.py install
- pip install -U pytest
- pip install codecov
install:
- pip install ".[test]" . # install package + test dependencies
script:
- pytest
- codecov
after_success:
- codecov
而且设置.py:
from setuptools import setup, find_packages
INSTALL_REQUIRES = [
'pandas',
'pyspark',
'pyhdfs',
'sqlalchemy',
'configparser',
'python-dotenv',
'mysqlclient'
]
TEST_REQUIRES = [
# testing and coverage
'pytest', 'coverage', 'pytest-cov',
# to be able to run `python setup.py checkdocs`
'collective.checkdocs', 'pygments',
]
with open('README.md') as f:
README = f.read()
setup(
author="John Doe",
author_email="john.doe@gmail.com",
name='my-package',
license="MIT",
description='Supports my processes',
version='1.0.0',
long_description=README,
url='https://github.com/my-user-name/my-package',
packages=find_packages(),
include_package_data=True,
python_requires=">=3.5",
install_requires=INSTALL_REQUIRES,
extras_require={
'test': TEST_REQUIRES + INSTALL_REQUIRES,
},
classifiers=[
'Development Status :: 3 - Alpha',
'Programming Language :: Python',
'Programming Language :: Python :: 3.7',
'Topic :: Software Development :: Build Tools',
'Intended Audience :: Developers',
],
)
我有什么遗漏吗?我做错什么了吗?任何帮助或任何引导到正确的方向都是非常感谢的,因为这让我发疯了。在
目前没有回答
相关问题 更多 >
编程相关推荐