Merge remote-tracking branch 'inventree/master'

This commit is contained in:
Oliver 2017-04-11 09:41:49 +10:00
commit 91d3aecd9d
11 changed files with 89 additions and 69 deletions

View File

@ -3,11 +3,9 @@ python:
- 3.4
before_install:
- pip install pep8
- pip install django
- pip install djangorestframework
- make setup
- make setup_ci
script:
- python pep_check.py
- python InvenTree/manage.py check
- python InvenTree/manage.py test --noinput
- make style
- make test

View File

@ -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/
# 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'
# SECURITY WARNING: don't run with debug turned on in production!
@ -40,7 +41,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# InvenTree apps
'part.apps.PartConfig',
'project.apps.ProjectConfig',

29
Makefile Normal file
View 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

View File

@ -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)
## 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. 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
For project code documentation, refer to the online [documentation](http://inventree.readthedocs.io/en/latest/) (auto-generated)
## 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`.

View File

@ -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'")

View File

@ -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
View File

@ -0,0 +1,2 @@
Django==1.11
djangorestframework==3.6.2

2
requirements/build.txt Normal file
View File

@ -0,0 +1,2 @@
-r base.txt
flake8==3.3.0

4
requirements/dev.txt Normal file
View File

@ -0,0 +1,4 @@
-r build.txt
django-extensions==1.7.8
graphviz==0.6
ipython==5.3.0

28
roadmap.md Normal file
View File

@ -0,0 +1,28 @@
## InvenTree Roadmap
### Design Goals
InvenTree is intened to provide a stand-alone stock-management system that runs completely offline.
It is designed to be run on a local server, and should not require the use of plugins/scripts that phone-home or load external content.
(This ignores the use of bespoke plugins that may be implemented down the line, e.g. for OctoPart integration, etc)
### 0.1 Release
The goals for the initial release should be limited to the following:
1. Fully implement a JSON API for the various apps and models
1. Design an initial front-end for querying data using this API
* Single-pase design is preferred, for the sake of responsiveness and intuitive interaction
* Investigate JS/AJAX engine - Angular? Bootstrap?
1. Allow users to view part category tree
1. Allow users to view all parts in a given category
1. "" edit parts
1. "" add new parts
### TODO
Research needed!
django-restful in combination with angular seems the way to go. Extra tools provided via https://github.com/jrief/django-angular

8
setup.cfg Normal file
View File

@ -0,0 +1,8 @@
[flake8]
ignore =
# - W293 - blank lines contain whitespace
W293,
# - E501 - line too long (82 characters)
E501
exclude = .git,__pycache__
max-complexity = 10