mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #19 from zakx/feature/tooling-improvements
Tooling improvements
This commit is contained in:
commit
074ac210b5
12
.travis.yml
12
.travis.yml
@ -3,11 +3,9 @@ python:
|
|||||||
- 3.4
|
- 3.4
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- pip install pep8
|
- make setup
|
||||||
- pip install django
|
- make setup_ci
|
||||||
- pip install djangorestframework
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- python pep_check.py
|
- make style
|
||||||
- python InvenTree/manage.py check
|
- make test
|
||||||
- python InvenTree/manage.py test --noinput
|
|
||||||
|
@ -20,6 +20,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|||||||
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
|
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
|
||||||
|
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
# TODO: remove this
|
||||||
SECRET_KEY = 'oc2z%5)lu#jsxi#wpg)700z@v48)2aa_yn(a(3qg!z!fw&tr9f'
|
SECRET_KEY = 'oc2z%5)lu#jsxi#wpg)700z@v48)2aa_yn(a(3qg!z!fw&tr9f'
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
@ -40,7 +41,7 @@ INSTALLED_APPS = [
|
|||||||
'django.contrib.sessions',
|
'django.contrib.sessions',
|
||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
|
|
||||||
# InvenTree apps
|
# InvenTree apps
|
||||||
'part.apps.PartConfig',
|
'part.apps.PartConfig',
|
||||||
'project.apps.ProjectConfig',
|
'project.apps.ProjectConfig',
|
||||||
|
29
Makefile
Normal file
29
Makefile
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
clean:
|
||||||
|
find . -path '*/__pycache__/*' -delete
|
||||||
|
find . -type d -name '__pycache__' -empty -delete
|
||||||
|
find . -name *.pyc -o -name *.pyo -delete
|
||||||
|
rm -rf *.egg-info
|
||||||
|
rm -rf .cache
|
||||||
|
rm -rf .tox
|
||||||
|
rm -f .coverage
|
||||||
|
|
||||||
|
style:
|
||||||
|
flake8
|
||||||
|
|
||||||
|
test:
|
||||||
|
python InvenTree/manage.py test --noinput
|
||||||
|
|
||||||
|
setup:
|
||||||
|
# TODO: replace this with a proper setup.py
|
||||||
|
pip install -U -r requirements/base.txt
|
||||||
|
python InvenTree/manage.py migrate --run-syncdb
|
||||||
|
python InvenTree/manage.py check
|
||||||
|
|
||||||
|
setup_ci:
|
||||||
|
pip install -U -r requirements/build.txt
|
||||||
|
|
||||||
|
develop:
|
||||||
|
pip install -U -r requirements/dev.txt
|
||||||
|
|
||||||
|
superuser:
|
||||||
|
python InvenTree/manage.py createsuperuser
|
14
README.md
14
README.md
@ -4,18 +4,22 @@ Open Source Inventory Management System
|
|||||||
[![Build Status](https://travis-ci.org/inventree/InvenTree.svg?branch=master)](https://travis-ci.org/inventree/InvenTree)
|
[![Build Status](https://travis-ci.org/inventree/InvenTree.svg?branch=master)](https://travis-ci.org/inventree/InvenTree)
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
When first installing InvenTree, initial database configuration must be performed. This is handled by the `install.py` script, which performs the following actions:
|
It is recommended to set up a clean Python 3.4+ virtual environment first:
|
||||||
|
`mkdir ~/.env && python3 -m venv ~/.env/InvenTree && source ~/.env/InvenTree/bin/activate`
|
||||||
|
|
||||||
1. Installs required django packages (requires [pip](https://pypi.python.org/pypi/pip))
|
You can then continue running `make setup` (which will be replaced by a proper setup.py soon). This will do the following:
|
||||||
|
|
||||||
|
1. Installs required Python dependencies (requires [pip](https://pypi.python.org/pypi/pip), should be part of your virtual environment by default)
|
||||||
1. Performs initial database setup
|
1. Performs initial database setup
|
||||||
1. Updates database tables for all InvenTree components
|
1. Updates database tables for all InvenTree components
|
||||||
|
|
||||||
This script can also be used to update the installation if changes have been made to the database configuration.
|
This command can also be used to update the installation if changes have been made to the database configuration.
|
||||||
|
|
||||||
To create an initial user account, run the command `python InvenTree/manage.py createsuperuser`
|
To create an initial user account, run the command `make superuser`.
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
For project code documentation, refer to the online [documentation](http://inventree.readthedocs.io/en/latest/) (auto-generated)
|
For project code documentation, refer to the online [documentation](http://inventree.readthedocs.io/en/latest/) (auto-generated)
|
||||||
|
|
||||||
## Coding Style
|
## Coding Style
|
||||||
All python code should conform to the [PEP 8](https://www.python.org/dev/peps/pep-0008/) style guide. Run the *pep_check.py* script which will compare all source (.py) files against the PEP 8 style.
|
If you'd like to contribute, install our development dependencies using `make develop`.
|
||||||
|
All Python code should conform to the [PEP 8](https://www.python.org/dev/peps/pep-0008/) style guide. Run `make style` which will compare all source (.py) files against the PEP 8 style. Tests can be run using `make test`.
|
||||||
|
44
install.py
44
install.py
@ -1,44 +0,0 @@
|
|||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
import subprocess
|
|
||||||
import argparse
|
|
||||||
|
|
||||||
def manage(*arg):
|
|
||||||
args = ["python", "InvenTree/manage.py"]
|
|
||||||
|
|
||||||
for a in arg:
|
|
||||||
args.append(a)
|
|
||||||
|
|
||||||
subprocess.call(args)
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description="Install InvenTree inventory management system")
|
|
||||||
|
|
||||||
parser.add_argument('-u', '--update', help='Update only, do not try to install required components', action='store_true')
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
# If 'update' is specified, don't perform initial installation
|
|
||||||
if not args.update:
|
|
||||||
# Install django requirements
|
|
||||||
subprocess.call(["pip", "install", "django", "-q"])
|
|
||||||
subprocess.call(["pip", "install", "djangorestframework", "-q"])
|
|
||||||
|
|
||||||
# Initial database setup
|
|
||||||
manage("migrate")
|
|
||||||
|
|
||||||
# Make migrations for all apps
|
|
||||||
manage("makemigrations", "part")
|
|
||||||
manage("makemigrations", "stock")
|
|
||||||
manage("makemigrations", "supplier")
|
|
||||||
manage("makemigrations", "project")
|
|
||||||
manage("makemigrations", "track")
|
|
||||||
|
|
||||||
# Update the database
|
|
||||||
manage("migrate")
|
|
||||||
|
|
||||||
# Check for errors
|
|
||||||
manage("check")
|
|
||||||
|
|
||||||
if not args.update:
|
|
||||||
print("\n\nAdmin account:\nIf a superuser is not already installed,")
|
|
||||||
print("run the command 'python InvenTree/manage.py createsuperuser'")
|
|
12
pep_check.py
12
pep_check.py
@ -1,12 +0,0 @@
|
|||||||
"""
|
|
||||||
Checks all source files (.py) against PEP8 coding style.
|
|
||||||
The following rules are ignored:
|
|
||||||
- W293 - blank lines contain whitespace
|
|
||||||
- E501 - line too long (82 characters)
|
|
||||||
|
|
||||||
Run this script before submitting a Pull-Request to check your code.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import subprocess
|
|
||||||
|
|
||||||
subprocess.call(['pep8', '--exclude=migrations', '--ignore=W293,E501', 'InvenTree'])
|
|
2
requirements/base.txt
Normal file
2
requirements/base.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Django==1.11
|
||||||
|
djangorestframework==3.6.2
|
2
requirements/build.txt
Normal file
2
requirements/build.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
-r base.txt
|
||||||
|
flake8==3.3.0
|
4
requirements/dev.txt
Normal file
4
requirements/dev.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
-r build.txt
|
||||||
|
django-extensions==1.7.8
|
||||||
|
graphviz==0.6
|
||||||
|
ipython==5.3.0
|
Loading…
Reference in New Issue
Block a user