Skip to content
Snippets Groups Projects
Commit 4b22b835 authored by Vincent Texier's avatar Vincent Texier
Browse files

[enh] add MakeFile and requirements files and update README.md

parent 1de71a18
No related branches found
No related tags found
1 merge request!7750.50.0
Makefile 0 → 100644
.PHONY: docs tests check check-format mypy pylint format build deploy deploy_test
.SILENT: deploy deploy_test # do not echo commands with password
# run tests
tests:
pytest -q -s ${TESTS_FILTER}
# check
check: mypy pylint check-format
# check static typing
mypy:
python3 -m mypy src --ignore-missing-imports
python3 -m mypy tests --ignore-missing-imports
# check code errors
pylint:
pylint --disable=C,R0902,R0903,R0904,R0912,R0913,R0914,R0915,W0613 --enable=C0121,C0202,C0321 --jobs=0 src/sakia/
pylint --disable=C,R0902,R0903,R0904,R0912,R0913,R0914,R0915,W0613 --enable=C0121,C0202,C0321 --jobs=0 tests/
# check format
check-format:
black --check src
black --check tests
# format code
format:
black src
black tests
# build a wheel package in build folder and put it in dist folder
build:
if [ -d "./build" ]; then rm -r build/*; fi
if [ -d "./dist" ]; then rm -r dist/*; fi
python setup.py sdist bdist_wheel
# upload on PyPi repository
deploy:
twine upload dist/* --username ${PYPI_LOGIN} --password ${PYPI_PASSWORD}
# upload on PyPi test repository
deploy_test:
twine upload dist/* --username ${PYPI_TEST_LOGIN} --password ${PYPI_TEST_PASSWORD} --repository-url https://test.pypi.org/legacy/
...@@ -53,5 +53,80 @@ Python3 and PyQt5 Client for [duniter](http://www.duniter.org) project. ...@@ -53,5 +53,80 @@ Python3 and PyQt5 Client for [duniter](http://www.duniter.org) project.
* Unzip and start "sakia" :) * Unzip and start "sakia" :)
* Join our beta community by contacting us on [duniter forum](http://forum.duniter.org/) * Join our beta community by contacting us on [duniter forum](http://forum.duniter.org/)
## Development
* When writing docstrings, use the reStructuredText format recommended by https://www.python.org/dev/peps/pep-0287/#docstring-significant-features
* Use make commands to check the code and the format it correct.
The development tools require Python 3.6.x or higher.
* Create a python virtual environment with [pyenv](https://github.com/pyenv/pyenv)
```bash
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
```
* Install dependencies
```bash
pip install -r requirements.txt
```
* Run Sakia from the source code
```bash
PYTHONPATH="`pwd`/src/." python src/sakia/main.py
```
* Before submiting a merge requests, please check the static typing and tests.
* Install dev dependencies
```bash
pip install -r requirements_dev.txt
```
* Check static typing with [mypy](http://mypy-lang.org/)
```bash
make check
```
* Run all unit tests (pytest module) with:
```bash
make tests
```
* Run only some unit tests by passing a special ENV variable:
```bash
make tests TESTS_FILTER=tests.documents.test_block.TestBlock.test_fromraw
```
## Packaging and deploy
### PyPi
In the development pyenv environment, install the tools to build and deploy
```bash
pip install --upgrade -r requirements_deploy.txt
```
Change and commit and tag the new version number (semantic version number)
```bash
./release.sh 0.x.y
```
Build the PyPi package in the `dist` folder
```bash
make build
```
Deploy the package to PyPi test repository (prefix the command with a space in order for the shell not to save in its history system the command containing the password)
```bash
[SPACE]make deploy_test PYPI_TEST_LOGIN=xxxx PYPI_TEST_PASSWORD=xxxx
```
Install the package from PyPi test repository
```bash
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.python.org/simple/ duniterpy
```
Deploy the package on the PyPi repository (prefix the command with a space in order for the shell not to save in its history system the command containing the password)
```bash
[SPACE]make deploy PYPI_LOGIN=xxxx PYPI_PASSWORD=xxxx
```
## License ## License
This software is distributed under [GNU GPLv3](https://raw.github.com/duniter/sakia/dev/LICENSE). This software is distributed under [GNU GPLv3](https://raw.github.com/duniter/sakia/dev/LICENSE).
...@@ -2,11 +2,8 @@ quamash ...@@ -2,11 +2,8 @@ quamash
asynctest asynctest
networkx networkx
attrs attrs
duniter-mirage
duniterpy>=0.40,<0.50.0 duniterpy>=0.40,<0.50.0
pytest
pytest-asyncio<0.6
pyyaml
aiohttp aiohttp
async_timeout async_timeout
PyQt5>=5.9,<5.10 PyQt5>=5.9,<5.10
\ No newline at end of file pyyaml
\ No newline at end of file
setuptools
wheel
twine
\ No newline at end of file
duniter-mirage
pytest
pytest-asyncio<0.6
black
mypy
pylint
\ No newline at end of file
#!/usr/bin/env bash
# Ubuntu 18.04+
sudo apt-get install curl qt5-qmake qtbase5-dev qttools5-dev-tools libqt5svg5-dev libdbus-1-dev libdbus-glib-1-dev autoconf automake libtool libsodium23
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment