From 473bd441dfe6f377ec77e55d07c2c22038099c51 Mon Sep 17 00:00:00 2001 From: Oliver Date: Sun, 2 Apr 2017 23:06:43 +1000 Subject: [PATCH 1/8] Create roadmap.md --- roadmap.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 roadmap.md diff --git a/roadmap.md b/roadmap.md new file mode 100644 index 0000000000..b194aa17b2 --- /dev/null +++ b/roadmap.md @@ -0,0 +1,22 @@ +## 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 From bb680c34274e10b283489727102c19fd6b94c8e8 Mon Sep 17 00:00:00 2001 From: Oliver Date: Sun, 2 Apr 2017 23:46:00 +1000 Subject: [PATCH 2/8] Update roadmap.md --- roadmap.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/roadmap.md b/roadmap.md index b194aa17b2..af9964f7b0 100644 --- a/roadmap.md +++ b/roadmap.md @@ -20,3 +20,9 @@ The goals for the initial release should be limited to the following: 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 From 89e4cf899efcc1f0bc423ee6d01940b110515369 Mon Sep 17 00:00:00 2001 From: zakx Date: Mon, 10 Apr 2017 22:55:25 +0200 Subject: [PATCH 3/8] Modernized environment --- Makefile | 26 +++++++++++++++++++++++++ install.py | 44 ------------------------------------------ pep_check.py | 12 ------------ requirements/base.txt | 5 +++++ requirements/build.txt | 2 ++ requirements/dev.txt | 4 ++++ setup.cfg | 8 ++++++++ 7 files changed, 45 insertions(+), 56 deletions(-) create mode 100644 Makefile delete mode 100644 install.py delete mode 100644 pep_check.py create mode 100644 requirements/base.txt create mode 100644 requirements/build.txt create mode 100644 requirements/dev.txt create mode 100644 setup.cfg diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..d5d42d75cf --- /dev/null +++ b/Makefile @@ -0,0 +1,26 @@ +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 + +develop: + pip install -U -r requirements/dev.txt + +superuser: + python InvenTree/manage.py createsuperuser diff --git a/install.py b/install.py deleted file mode 100644 index 090fdd3e79..0000000000 --- a/install.py +++ /dev/null @@ -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'") diff --git a/pep_check.py b/pep_check.py deleted file mode 100644 index 71ce27db68..0000000000 --- a/pep_check.py +++ /dev/null @@ -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']) diff --git a/requirements/base.txt b/requirements/base.txt new file mode 100644 index 0000000000..0c3901f32b --- /dev/null +++ b/requirements/base.txt @@ -0,0 +1,5 @@ +Django==1.11 +djangorestframework==3.6.2 +pep8==1.7.0 +pkg-resources==0.0.0 +pytz==2017.2 diff --git a/requirements/build.txt b/requirements/build.txt new file mode 100644 index 0000000000..c400442ceb --- /dev/null +++ b/requirements/build.txt @@ -0,0 +1,2 @@ +-r base.txt +flake8==3.3.0 diff --git a/requirements/dev.txt b/requirements/dev.txt new file mode 100644 index 0000000000..3ec7263b93 --- /dev/null +++ b/requirements/dev.txt @@ -0,0 +1,4 @@ +-r build.txt +django-extensions==1.7.8 +graphviz==0.6 +ipython==5.3.0 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000000..ea418b2daf --- /dev/null +++ b/setup.cfg @@ -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 From 82541b9b861ae5e00006ea502609c82cb6409e39 Mon Sep 17 00:00:00 2001 From: zakx Date: Mon, 10 Apr 2017 22:55:55 +0200 Subject: [PATCH 4/8] Updating travis file to use Makefile commands --- .travis.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3f55eeb22b..42c419baae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,11 +3,8 @@ python: - 3.4 before_install: - - pip install pep8 - - pip install django - - pip install djangorestframework - + - make setup + script: - - python pep_check.py - - python InvenTree/manage.py check - - python InvenTree/manage.py test --noinput \ No newline at end of file + - make style + - make test From 428015ecf5e7bd09ea65b3f857bc91a5f0ac0d88 Mon Sep 17 00:00:00 2001 From: zakx Date: Mon, 10 Apr 2017 22:56:09 +0200 Subject: [PATCH 5/8] Adding reminder to remove pre-generated SECRET_KEY Later on, we'll need environment-based default configs anyway, so this will probably be done together. --- InvenTree/InvenTree/settings.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/InvenTree/InvenTree/settings.py b/InvenTree/InvenTree/settings.py index 8585f5b911..ab2205a296 100644 --- a/InvenTree/InvenTree/settings.py +++ b/InvenTree/InvenTree/settings.py @@ -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', From d27c68e4eecf5d76ff2f07eb284983fc12189d84 Mon Sep 17 00:00:00 2001 From: zakx Date: Mon, 10 Apr 2017 22:57:13 +0200 Subject: [PATCH 6/8] Updating README to reflect new tooling --- README.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b8b975b804..18c67aebbf 100644 --- a/README.md +++ b/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) ## 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`. From c5b2206f94c0d9b04177fc9305c49b84686deecb Mon Sep 17 00:00:00 2001 From: zakx Date: Mon, 10 Apr 2017 23:03:12 +0200 Subject: [PATCH 7/8] Removing bogus dependencies --- requirements/base.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/requirements/base.txt b/requirements/base.txt index 0c3901f32b..1a4283d80d 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,5 +1,2 @@ Django==1.11 djangorestframework==3.6.2 -pep8==1.7.0 -pkg-resources==0.0.0 -pytz==2017.2 From 38725e6ad044cfc8bbfdd6e6498a4a2d8983cfdb Mon Sep 17 00:00:00 2001 From: zakx Date: Mon, 10 Apr 2017 23:15:11 +0200 Subject: [PATCH 8/8] Making sure travis has the build.txt requirements --- .travis.yml | 1 + Makefile | 3 +++ 2 files changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 42c419baae..9f63351f98 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ python: before_install: - make setup + - make setup_ci script: - make style diff --git a/Makefile b/Makefile index d5d42d75cf..307922603a 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,9 @@ setup: 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