Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
10 changes: 3 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,10 @@ repos:
- id: end-of-file-fixer
- id: check-yaml
- id: mixed-line-ending
- repo: https://github.com/pycqa/flake8
rev: '6.1.0'
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.16.1
hooks:
- id: flake8
- repo: https://github.com/pycqa/isort
rev: '5.12.0'
hooks:
- id: isort
- id: ruff-check
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[![PyPI](https://img.shields.io/pypi/v/inventree)](https://pypi.org/project/inventree/)
![Build Status](https://github.com/inventree/inventree-python/actions/workflows/ci.yaml/badge.svg)
[![Coverage Status](https://coveralls.io/repos/github/inventree/inventree-python/badge.svg)](https://coveralls.io/github/inventree/inventree-python)
![PEP](https://github.com/inventree/inventree-python/actions/workflows/pep.yaml/badge.svg)
![Code Style](https://github.com/inventree/inventree-python/actions/workflows/style.yaml/badge.svg)

## InvenTree Python Interface

Expand Down
30 changes: 19 additions & 11 deletions inventree/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,24 @@
"""

# Pass PurchaseOrder models through
from inventree.purchase_order import PurchaseOrder # noqa:F401
from inventree.purchase_order import PurchaseOrderExtraLineItem # noqa:F401
from inventree.purchase_order import PurchaseOrderLineItem # noqa:F401
from inventree.purchase_order import (
PurchaseOrder, # noqa:F401
PurchaseOrderExtraLineItem, # noqa:F401
PurchaseOrderLineItem, # noqa:F401
)

# Pass ReturnOrder models through
from inventree.return_order import ReturnOrder # noqa:F401
from inventree.return_order import ReturnOrderExtraLineItem # noqa:F401
from inventree.return_order import ReturnOrderLineItem # noqa:F401
from inventree.return_order import (
ReturnOrder, # noqa:F401
ReturnOrderExtraLineItem, # noqa:F401
ReturnOrderLineItem, # noqa:F401
)

# Pass SalesOrder models through
from inventree.sales_order import SalesOrder # noqa:F401
from inventree.sales_order import SalesOrderExtraLineItem # noqa:F401
from inventree.sales_order import SalesOrderLineItem # noqa:F401
from inventree.sales_order import SalesOrderShipment # noqa:F401
from inventree.sales_order import SalesOrderAllocation # noqa:F401
from inventree.sales_order import (
SalesOrder, # noqa:F401
SalesOrderAllocation, # noqa:F401
SalesOrderExtraLineItem, # noqa:F401
SalesOrderLineItem, # noqa:F401
SalesOrderShipment, # noqa:F401
)
26 changes: 14 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ keywords = [
"stock",
]
dependencies = [
"requests>=2.27.0",
"requests>=2.27.0",
"urllib3>=2.3.0",
]
[project.optional-dependencies]
Expand All @@ -34,19 +34,21 @@ dependencies = [
Homepage = "https://github.com/inventree/inventree-python/"

[tool.setuptools.dynamic]
version = {attr = "inventree.base.INVENTREE_PYTHON_VERSION"}
version = {attr = "inventree.base.INVENTREE_PYTHON_VERSION"}

[tool.setuptools]
packages = ["inventree"]

[tool.flake8]
ignore =[
'C901',
# - W293 - blank lines contain whitespace
'W293',
# - E501 - line too long (82 characters)
'E501',
'N802']
exclude = ['.git','__pycache__','inventree_server','dist','build','test.py']
max-complexity = 20
[tool.ruff]
extend-exclude = ["inventree_server", "test.py"]

[tool.ruff.lint]
# E/W: pycodestyle, F: pyflakes, I: isort, C90: mccabe complexity
select = ["E", "W", "F", "I", "C90"]
ignore = [
"E501", # line too long
"W293", # blank line contains whitespace
]

[tool.ruff.lint.mccabe]
max-complexity = 20
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
requests[socks]>=2.21.0 # Python HTTP for humans with proxy support
flake8==7.1.2 # PEP checking
flake8-pyproject==1.2.3 # PEP 621 support
ruff==0.16.1 # Linting / code style
wheel>=0.34.2 # Building package
invoke>=1.4.0
coverage>=6.4.1 # Run tests, measure coverage
Expand Down
10 changes: 0 additions & 10 deletions setup.cfg

This file was deleted.

4 changes: 2 additions & 2 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def style(c):
Run PEP style checks against the codebase
"""

print("Running PEP code style checks...")
c.run('flake8 .')
print("Running ruff code style checks...")
c.run('ruff check .')


@task
Expand Down
10 changes: 6 additions & 4 deletions test/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@

sys.path.append(os.path.abspath(os.path.dirname(__file__)))

from inventree import api # noqa: E402
from inventree import base # noqa: E402
from inventree import part # noqa: E402
from inventree import stock # noqa: E402
from inventree import (
api, # noqa: E402
base, # noqa: E402
part, # noqa: E402
stock, # noqa: E402
)

SERVER = os.environ.get('INVENTREE_PYTHON_TEST_SERVER', 'http://127.0.0.1:12345')
USERNAME = os.environ.get('INVENTREE_PYTHON_TEST_USERNAME', 'testuser')
Expand Down
2 changes: 1 addition & 1 deletion test/test_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

from test_api import InvenTreeTestCase # noqa: E402

from inventree.base import Attachment # noqa: E402
from inventree import company # noqa: E402
from inventree.base import Attachment # noqa: E402
from inventree.part import Part # noqa: E402


Expand Down
10 changes: 6 additions & 4 deletions test/test_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@

from test_api import InvenTreeTestCase # noqa: E402

from inventree import company # noqa: E402
from inventree import order # noqa: E402
from inventree import part # noqa: E402
from inventree import stock # noqa: E402
from inventree import (
company, # noqa: E402
order, # noqa: E402
part, # noqa: E402
stock, # noqa: E402
)
from inventree.base import Attachment # noqa: E402


Expand Down
17 changes: 11 additions & 6 deletions test/test_part.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@

from test_api import InvenTreeTestCase # noqa: E402

from inventree.base import (Attachment, Parameter, # noqa: E402
ParameterTemplate)
from inventree.base import Attachment, Parameter, ParameterTemplate # noqa: E402
from inventree.company import SupplierPart # noqa: E402
from inventree.part import InternalPrice # noqa: E402
from inventree.part import (BomItem, Part, PartCategory, # noqa: E402
PartCategoryParameterTemplate, PartParameter,
PartRelated, PartTestTemplate)
from inventree.part import ( # noqa: E402
BomItem,
InternalPrice, # noqa: E402
Part,
PartCategory,
PartCategoryParameterTemplate,
PartParameter,
PartRelated,
PartTestTemplate,
)
from inventree.stock import StockItem # noqa: E402


Expand Down
6 changes: 4 additions & 2 deletions test/test_stock.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@

from test_api import InvenTreeTestCase # noqa: E402

from inventree import company # noqa: E402
from inventree import part # noqa: E402
from inventree import (
company, # noqa: E402
part, # noqa: E402
)
from inventree.stock import StockItem, StockLocation # noqa: E402


Expand Down
Loading