Skip to content
Open
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
45 changes: 45 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Python Tests

on: [push]

jobs:
build:
defaults:
run:
working-directory: ./server

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12", "3.13"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
# You can test your matrix by printing the current Python version
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
- name: Install the code linting and formatting tool Ruff
run: pipx install ruff
- name: Lint code with Ruff
run: ruff check --output-format=github --target-version=${{ matrix.python-version }}
- name: Check code formatting with Ruff
run: ruff format --diff --target-version=${{ matrix.python-version }}
continue-on-error: true
- name: Install tox and any other packages
run: pip install tox
- name: Run tox
run: tox -e py
- name: Upload tox test results
uses: actions/upload-artifact@v4
with:
name: pytest-results-${{ matrix.python-version }}
path: junit/test-results-${{ matrix.python-version }}.xml
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
174 changes: 174 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# UV
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
#uv.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# Ruff stuff:
.ruff_cache/

# PyPI configuration file
.pypirc
40 changes: 36 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,39 @@
# Wye Make Template
# Inventory

This repository is used as the base for all our other code.
An inventory platform for Wye Make.

SnipeIT is overly complicated, Homebox doesn't have the features we need, so we're writing our own.

## Goals

This system has been written to adhere to the following goals:

### 1. API-Driven

If you're not a developer, this probably means nothing to you, but it enables us to talk to the system from just about anything else including our website, our membership system, Discord, and even Smart Assistants such as Amazon Alexa and Google Home.

It means the system remains flexible and can be updated without worrying about how people access it.

### 2. Tailored to our needs

As a makerspace, we have a number of requirements that other systems either don't have or make overly complex.

Whilst we will release the code "early and often", we will not release a version 1.0 until the following features are in place:

- [ ] The ability to add and remove items
- [ ] The ability to add items to a specific location
- [ ] The ability to "nest" locations (i.e. "The hammer is in toolbox 01 which is stored in cupboard 9 in room 5 of the space")
- [ ] The ability to "loan" equipment to members
- [ ] The ability to track stock of consumables and who is using them

### 3. Open Source

The platform will use Open Source software.

The backend will be written using the [Django](https://www.djangoproject.com/) framework and [Treebeard](https://django-treebeard.readthedocs.io/en/latest/tutorial.html) to deal with nested locations, the API is provided by the [Django Rest Framework (DRF)](https://www.django-rest-framework.org/).

The platform is backed by the PostgreSQL database, and application performance is measured using the [Open Telemetry](https://opentelemetry.io) framework.

The project itself is released under the [MIT Licence](https://choosealicense.com/licenses/mit/) and we hope that this will encourage anyone who uses the platform to donate their improvements back to the original code base.

## How do I use it?

Raise a PR against [the infrastructure repo](https://github.com/MakeMonmouth/wye-make-IaC) requesting a new git repository, and you'll get everything that's in here automatically!
3 changes: 3 additions & 0 deletions server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Inventory Server

This folder contains all of the source code for the server
1 change: 1 addition & 0 deletions server/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
django-rest-framework
9 changes: 9 additions & 0 deletions server/tests/test_create_inventory_location.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# A dummy function to ensure github actions is working
def inc(x):
return x + 1

def test_positive():
assert inc(3) == 4

def test_negative():
assert inc(3) == 5
10 changes: 10 additions & 0 deletions server/tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[tox]
requires = tox>=4

[testenv]
description = Run the unit tests
deps =
pytest>=8
pytest-sugar
commands =
pytest {posargs:tests}