Skip to content
Snippets Groups Projects
Commit f510d4fc authored by Andreas Hellerschmied's avatar Andreas Hellerschmied
Browse files

Set up project. It can be used as boilerplate fpr other projects with PyQt6,...

Set up project. It can be used as boilerplate fpr other projects with PyQt6, pandas, numpy, sphinx, etc.
parents
No related branches found
No related tags found
No related merge requests found
### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# virtualenv
venv/
ENV/
env/
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff:
.idea/workspace.xml
.idea/tasks.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml
# Sensitive or high-churn files:
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml
# Gradle:
.idea/gradle.xml
.idea/libraries
# Mongo Explorer plugin:
.idea/mongoSettings.xml
.idea/
This diff is collapsed.
# lifescale_gui
Data analysis tools for lifescale with GUI.
# Installation and setup
* **1. Create virtual environment (venv)**
* `python3 -m venv env`
* **2. Activate virtual environment**
* `source env/bin/activate`
* **3. Clone git repository to local machine**
* `git clone git@gitlab.com:hellerdev/lifescale_gui.git`
* `cd lifescale_gui`
* **4. Install required python packages using pip**
* `pip install -r requirements.txt`
## Installation issues on Ubuntu (20.04):
After just installing PyQt5 with pip3 the following error occurred when trying to actually run a PyQt GUI: qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This issue was resolved by installing the QT dev tools (Designer, etc.):
sudo apt-get install qttools5-dev-tools
# Test installation with setuptools
With command line interface.
* **1. Configure setup.py**
* Define entry points (*console_scripts*)
* **2. Activate virtual environment**
* e.g. `source env/bin/activate`
* **3. Run setup.py**
* `python3 setup.py develop`
## Using make
`python3 setup.py develop`
# Run application on Windows and create a stand-alone Windows executable file:
TODO
# Comments on requirements.txt file:
* Two entries can be deleted:
* -e git+git@gitlab.com:Heller182/grav.git@fe528c0769502e84a06be67a742032cacfd386df#egg=gravtools
* pkg-resources==0.0.0 (created due a bug when using Linux, see: https://stackoverflow.com/questions/39577984/what-is-pkg-resources-0-0-0-in-output-of-pip-freeze-command)
# Create HTML documentation with sphinx:
Run make in the gravtools/doc directory:
* `>>>make html_doc`
# Guidelines and conventions
## Code style:
* Respect the PEP conventions on python coding!
* PEP 8 -- Style Guide for Python Code: https://www.python.org/dev/peps/pep-0008/
* The maximum line length is 120 characters
* Use **type hints**: https://www.python.org/dev/peps/pep-0484/
* Use docstrings according to the numpy standard: https://numpydoc.readthedocs.io/en/latest/format.html#docstring-standard
* They are useful to generate the documentation automatically
* Example: https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html
* Comment code, if necessary!
* Use English language for the code, docstrings and comments
* German is allowed for user interfaces (GUI, command line), although English is preferred
## Documentation and docstring style
* The API reference is created with sphinx (https://www.sphinx-doc.org/).
* Docstrings have to follow the numpy standard, see: https://numpydoc.readthedocs.io/en/latest/format.html#docstring-standard
* Examples: https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html
* Package documentation via docstring in __ini__.py files
* Module documentation via docstring at first lines of py-file
* Documentation of classes, class methods and functions via docstrings
## Command line interface and executable scripts
* The command line interface is realized via entry points (console_scripts) in setuptools (python packaging tool)
* Input arguments are handled with argparse
* The code is located in the command_line module (gravtools/command_line.py)
* Executable scripts are located in gravtools/scripts
## Dependancies
* Required python packages are listed in requirements.txt
* created with `>>>pip freeze > requirements.txt`
## Version control with GIT
* Gitlab repository: https://gitlab.com/Heller182/grav
* Branching model:
* **master** branch: Current release version
* **develop** branch: Current working version.
* All team members merge their feature branches into develop (merge request via gitlab)
* Make sure that the develop branch contains a fully functional version of the code!
* **feature** branches: Branches of develop for the implementation of new features and other changes.
* Code changes only in feature branches!
* Naming convention: feature_<description of change/feature>, e.g. feature_new_tide_model
* Use gitignore files to prevent any data files (except example files), IDE control files, compiled python code, etc. from being stored in the GIT repository
* Generally rule: Ignore everything in a directory and define explicit exceptions!
## Packaging and distribution
* With setuptools
*
!.gitignore
\ No newline at end of file
*
!.gitignore
!Makefile
!index.rst
!conf.py
!_build
!_static
!_templates
\ No newline at end of file
Lifescale pgm times table:
2021-11-06: 20:20 - xx:xx; Setting up project
makefile 0 → 100644
# Makefile for project gravtools
# Test run
test:
$(info Test-run for this makefile!)
$(info Yeah!!)
# Project initaialization
init:
pip install -r requirements.txt
# Convert *.ui files from Qt Designer to Python files:
py_gui:
pyuic5 -o lifescale_gui/gui/MainWindow.py lifescale_gui/gui/MainWindow.ui
alabaster==0.7.12
Babel==2.9.1
certifi==2021.10.8
charset-normalizer==2.0.7
docutils==0.17.1
idna==3.3
imagesize==1.2.0
Jinja2==3.0.2
MarkupSafe==2.0.1
numpy==1.21.4
packaging==21.2
pandas==1.3.4
Pygments==2.10.0
pyparsing==2.4.7
PyQt6==6.2.1
PyQt6-Qt6==6.2.1
PyQt6-sip==13.1.0
pyqtgraph==0.12.3
python-dateutil==2.8.2
pytz==2021.3
requests==2.26.0
six==1.16.0
snowballstemmer==2.1.0
Sphinx==4.2.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
urllib3==1.26.7
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment