poetry icon indicating copy to clipboard operation
poetry copied to clipboard

poetry doesn't include package in pyproject.toml packages

Open RalfKow opened this issue 3 years ago • 4 comments

  • [x] I am on the latest Poetry version.
  • [x] I have searched the issues of this repo and believe that this is not a duplicate.
  • [x] If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

Environement

  • OS version and name: Windows 10
  • Poetry version: Poetry 1.2.0
  • Python:3.8.10
  • Link of a Gist with the contents of your pyproject.toml file: See the pyproject.toml below

Issue

If I run the command

  1. poetry install
  2. poetry run python src/eap_sample_pipeline/main.py -feed greeter

poetry run python src/eap_sample_pipeline/main.py -feed greeter Traceback (most recent call last): File "src/sample_pipeline/main.py", line 4, in from sample_pipeline import feed_selector ImportError: cannot import name 'feed_selector' from 'sample_pipeline' (C:..\sample-pipeline\tests\sample_pipeline_init_.py)

pyproject.toml

[tool.poetry]
name = "sample-pipeline"
version = "0.0.0" # Version is ignored and set by jenkins. Use pipeline to increase.
description = "Example project for Python"
packages = [
    {include = "sample_pipeline", from = "src"},
    {include = "snowpark_utils", from = "src"},
    {include = "test_cases", from = "tests"}] #TODO: Try to get rid of include local packages
readme = "README.md"

[tool.poetry.dependencies]
python = "3.8.*"
numpy = "^1.22.4"                                   # NumPy is the fundamental package for array computing with Python.
pandas = "1.4.4"                                    # Pandas is a data analysis and manipulation tool.
snowflake-snowpark-python = "0.9.0"                 # The Snowpark library provides intuitive APIs for querying and processing data.

[tool.poetry.dev-dependencies]
black = "^22.3.0"                                   # The uncompromising code formatter.
coverage = {extras = ["toml"], version = "^6.4.1"}  # Code coverage measurement for Python
unittest-xml-reporting = "^3.2.0"                   # unittest-based test runner with Ant/JUnit like XML reporting.
pre-commit = "^2.19.0"                              # A framework for managing and maintaining multi-language pre-commit hooks.
pre-commit-hooks = "^4.2.0"                         # Some out-of-the-box hooks for pre-commit.
pydocstyle = "^6.1.1"                               # Python docstring style checker
pylint = "^2.14.1"                                  # python code static checker
reorder-python-imports = "^3.1.0"                   # Tool for reordering python imports

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.pylint.main]
fail-on = "F,E,W"
fail-under = 0.0

[tool.pylint.basic]
good-names = ["i", "j", "k", "n", "s", "d", "ex", "Run", "_", "pk", "x", "y", "df"]

[tool.pylint.format]
max-line-length = 140

[tool.pylint.design]
max-args = 8

[tool.pylint.messages_control]
disable = [
    # pydocstyle takes care of this...
    "missing-module-docstring",
    "missing-function-docstring",
    "missing-class-docstring",
    
    # don't hinder me creating small classes!
    "too-few-public-methods",
    
    # reorder-python-imports should know what it's doing
    "wrong-import-order",

    # can't do much about duplicate imports in two files, I'm afraid...
    "duplicate-code",
]

[tool.pylint.miscellaneous]
notes = []  # don't warn about `TODO` and `FIXME` comments

[tool.pylint.reports]
output-format = "parseable:pylintout,text"

[tool.pydocstyle]
match-dir = "[^\\.][^test].*"
convention = "google"

[tool.coverage.run]
command_line = "-m xmlrunner discover --output-file junittest.xml"

RalfKow avatar Sep 14 '22 06:09 RalfKow

Could you please add your directory structure?

Secrus avatar Sep 14 '22 06:09 Secrus

sample-pipeline
- .idea
- .venv
- src
  - sample_pipeline
    - dataquality
      - __init__.py
      - dataquality_main.py
    - extraction
      - __init__.py
      - extraction_main.py
    - generic
      - __init__.py
      - empty_feed.py
      - generic_feed.py 
    - greeter
      - __init__.py
      - greeter.py
      - greeter_main.py 
    - load
      - __init__.py
      - load_main.py
    - transformation
      - __init__.py
      - transformation_main.py
    - __init__.py
    - base_logger.py
    - feed_selector.py
    - main.py
  - snowpark_utils
    - __init.py__
    - main.py
    - snowflake_client.py
- tests
  - sample_pipeline
    - dataquality
      - __init__.py
    - ingestion
      - __init__.py
    - transformation
      - __init__.py
    - __init__.py
    - test_feed_selector.py
    - test_greeter.py
  - snowpark_utils
    - __init.py__
    - test_snowflake_client.py
  - test_cases
    - __init__.py
    - generic_test_case.py  
  - __init__.py 
- .dockerignore
- .gitattributes
- .pre-commit-config.yaml
- Dockerfile
- poetry.lock
- poetry.toml
- pyproject.tom
- README.md



RalfKow avatar Sep 14 '22 09:09 RalfKow

If I execute poetry install multiple times, it works afterwards.

RalfKow avatar Sep 14 '22 11:09 RalfKow

It's very unclear what is being reported here, I rather doubt that there's a poetry bug.

If you're able to put together a small repository reproducing whatever it is you're reporting, alongside clear instructions, then maybe someone will volunteer to take a look.

But if you have access to a live human with experience in developing python code, I'd advise that you'll likely do better getting local help.

dimbleby avatar Sep 16 '22 17:09 dimbleby

Hello @RalfKow,

you haven't come back to this issue for a long while. So I assume this is solved in the meantime and I can close this ticket.

Feel free to leave a comment if you disagree.

fin swimmer

finswimmer avatar Jan 20 '23 08:01 finswimmer

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Feb 29 '24 21:02 github-actions[bot]