Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue using poetry #433

Open
evilmonkey19 opened this issue Sep 10, 2024 · 0 comments
Open

Issue using poetry #433

evilmonkey19 opened this issue Sep 10, 2024 · 0 comments

Comments

@evilmonkey19
Copy link

evilmonkey19 commented Sep 10, 2024

Hello!

I'm trying to integrate pylint-django into my pipelines for a project of mine, but unfortunately I got stopped by an issue related to my project folder directory and how the app manages everything. Currently I'm using poetry which is really helpful for organizing everything but it doesn't not work as expected pylint-django.

My folder structure is as follows:

.
├── Caddyfile
├── Dockerfile
├── README.md
├── docker-compose.yml
├── my_project
│   ├── __init__.py
│   ├── config
│   │   ├── __init__.py
│   │   ├── settings
│   │   │   ├── __init__.py
│   │   │   ├── base.py
│   │   │   ├── dev.py
│   │   │   ├── prod.py
│   │   │   └── stage.py
│   │   ├── urls.py
│   │   └── wsgi.py
│   ├── contest
│   │   ├── __init__.py
│   │   ├── apps.py
│   │   ├── celery.py
│   │   ├── context_processors.py
│   │   ├── management
│   │   │   ├── __init__.py
│   │   │   └── commands
│   │   │       ├── __init__.py
│   │   │       └── close_phases.py
│   │   ├── migrations
│   │   │   ├── 0001_initial.py
│   │   │   ├── 0002_alter_song_unique_together.py
│   │   │   ├── 0003_remove_contestant_general_pk_and_more.py
│   │   │   ├── 0004_alter_contestant_unique_together_and_more.py
│   │   │   ├── 0005_member_rename_socialnetworks_socialnetwork_and_more.py
│   │   │   ├── 0006_rename_phases_phase.py
│   │   │   ├── 0007_contestanttag_name_ca_contestanttag_name_en_and_more.py
│   │   │   ├── 0008_contestanttag_slug_ca_contestanttag_slug_en_and_more.py
│   │   │   ├── 0009_remove_contestanttag_slug_ca_and_more.py
│   │   │   ├── 0010_alter_partnerspage_partners_and_more.py
│   │   │   ├── 0011_alter_socialnetwork_platform.py
│   │   │   ├── 0012_alter_partnerspage_partners.py
│   │   │   ├── 0013_alter_member_image_alter_member_instrument_and_more.py
│   │   │   ├── 0014_rename_image_images_image_original_and_more.py
│   │   │   ├── 0015_archivepage.py
│   │   │   ├── 0016_alter_member_unique_together_alter_member_instrument_and_more.py
│   │   │   ├── 0017_alter_images_image_original_and_more.py
│   │   │   ├── __init__.py
│   │   ├── models.py
│   │   ├── parser.py
│   │   ├── services.py
│   │   ├── templatetags
│   │   │   ├── __init__.py
│   │   │   └── contestant_tags.py
│   │   ├── translation.py
│   │   ├── urls.py
│   │   ├── views.py
│   │   └── wagtail_hooks.py
│   ├── db.sqlite3
│   ├── fixtures
│   │   └── initial_data.json
│   ├── inscriptions
│   │   ├── __init__.py
│   │   ├── apps.py
│   │   ├── forms.py
│   │   ├── images_utils.py
│   │   ├── urls.py
│   │   ├── validators.py
│   │   └── views.py
│   ├── locale
│   │   ├── ca
│   │   │   └── LC_MESSAGES
│   │   │       ├── django.mo
│   │   │       └── django.po
│   │   └── es
│   │       └── LC_MESSAGES
│   │           ├── django.mo
│   │           └── django.po
│   ├── manage.py
│   ├── static
│   │   ├── ....
│   ├── templates
│   │   ├── ...
│   ├── theme
│   │   ├── __init__.py
│   │   ├── apps.py
│   │   ├── static
│   │   │   └── css
│   │   │       └── dist
│   │   │           └── styles.css
│   │   └── static_src
│   │       ├── package-lock.json
│   │       ├── package.json
│   │       ├── postcss.config.js
│   │       ├── src
│   │       │   └── styles.css
│   │       └── tailwind.config.js
│   └── users
│       ├── __init__.py
│       ├── templatetags
│       │   ├── __init__.py
│       │   └── voting_tags.py
│       ├── urls.py
│       └── views.py
├── example.env
├── poetry.lock
├── pyproject.toml
├── requirements.txt
├── tasks.py
└── tests
    ├── __init__.py
    ├── test_contest.py
    ├── test_inscriptions.py
    └── test_users.py

And the pyproject.toml is as follows:

[tool.poetry]
name = "project"
version = "1.0.0"
description = "My project"
authors = ["evilmonkey19"]
maintainers = ["evilmonkey19"]
homepage = "https://my_project.org"
license = "MIT"
readme = "README.md"
keywords = ["my_project", "django", "wagtail", "voting", "indie"]
classifiers = [
    "Intended Audience :: Developer",
    "Operating System :: POSIX:: Linux",
    "Topic :: Website",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "License :: OSI Approved :: MIT License",
]
include = [
    "LICENSE",
    "README.md",
    "my_project/",
]
packages = [{include = "my_project"}]

[tool.poetry.dependencies]
python = ">=3.10, <3.13"
django = ">=4.0, <5.1"
django-allauth = "^64.2.1"
django-browser-reload = "^1.12.1"
django-modelcluster = "^6.2.1"
django-taggit = ">=5.0,<5.1"
django-tailwind = "^3.8.0"
django-cleanup = "^8.1.0"
fontawesomefree = "^6.5.1"
requests = "^2.31.0"
wagtail = "^6.2.1"
django-modeltranslation = "^0.19.9"
numpy = "^2.1.1"
django-extensions = "^3.2.3"
gunicorn = "^23.0.0"
pyjwt = "^2.9.0"
cryptography = "^43.0.1"

[tool.poetry.group.dev.dependencies]
bandit = "^1.7.9"
black = "^24.8.0"
coverage = "^7.6.1"
invoke = "^2.2.0"
flake8 = "^7.1.1"
pylint = "^3.2.7"
pytest = "^8.3.2"
pytest-django = "^4.9.0"
pytest-env = "^1.1.4"
toml = "^0.10.2"
pylint-django = "^2.5.5"

[tool.black]
line-length = 120
target-version = ['py312']
include = '\.pyi?$'
exclude = '''
(
    /(
    \.eggs  # exclude a few common directories in the
    | \.git # root of the project
    | \.hg
    | \.mypy_cache
    | \.tox
    | \.venv
    | _build
    | buck-out
    | build
    | dist
    )/
)
'''

[tool.bandit]
exclude_dirs = ["tests/", ".venv"]
tests = ["B201", "B301"]
skips = ["B101", "B601"]

[tools.poetry.extras]
test = ["pytest"]

[tool.pylint.master]
ignore = ".venv"
load-plugins = "pylint_django"
django-settings-module = "config.settings.dev"

[tool.pylint.basic]
min-public-methods = 1

[tool.pylint.messages_control]
# Line length is enforced by Black, so pylint doesn't need to check it.
# Pylint and Black disagree about how to format multi-line arrays; Black wins.
disable = """
    line-too-long,
    redefined-outer-name,
"""

[tool.coverage.run]
fail_under = 80
show_missing = true

[tool.coverage.html]
directory = "coverage_html_report"

[tool.pytest.ini_options]
pythonpath = "engrescat"
testpaths = ["tests"]
addopts = "-vv"

[tool.pytest_env]
DJANGO_SETTINGS_MODULE = "config.settings.dev"
SECRET_KEY = "some_password"
ALLOWED_HOSTS = "localhost,127.0.0.1"
CSRF_TRUSTED_ORIGINS = "https://*.internal"
SECURE_HSTS_SECONDS = 3600
SECURE_PROXY_SSL_HEADER = "HTTP_X_FORWARDED_PROTO,https"

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

Also I do believe it is important to explain that the config.settings.base is general for every settings file as it has general settings and then the config.settings.dev imports all the settings from the base as follows:

from engrescat.config.settings.base import *  # noqa: F403
< ADD MORE SETTINGS >

Any help guiding towards this issue would be awesome. Also if you need any more info let me know please 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant