Skip to content

Commit

Permalink
Use and explain Makefile for dev purpose.
Browse files Browse the repository at this point in the history
  • Loading branch information
antarcticrainforest committed Jan 24, 2024
1 parent 3623a8b commit a9a113d
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/pypi_job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
with:
python-version: "3.x"
- name: Adding the evaluation config file
run: wget https://raw.githubusercontent.com/FREVA-CLINT/freva/main/assets/evaluation_system.conf -O assets/share/freva/deployment/config/evaluation_system.conf.tmpl
run: python src/freva_deployment/__init__.py
-
name: Install flit
run: python -m pip install flit
Expand Down
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.PHONY: develop install prepare lint docs
all: develop

develop: prepare
python3 -m pip install -e .[test,docs]

install: prepare
python3 -m pip install .[test,docs]

prepare:
python src/freva_deployment/__init__.py

lint:
isort --profile black -t py311 -l 79 src
mypy --install-types --non-interactive

docs:
make -C docs clean
make -C docs html
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,3 +306,38 @@ git config --global user.email your@email.com
# Advanced: Adjusting the playbook
Playbook templates and be found the in the `playbooks` directory. You can also add new variables to the playbook if they are present in the `config/inventory` file.
# Contributing to freva-deployment
We welcome contributions from the community! Before you start contributing,
please follow these steps to set up your development environment.
Make sure you have the following prerequisites installed:
- Python (>=3.x)
- Git
- Make
```console
git clone https://github.com/FREVA-CLINT/freva-deployment.git
cd freva-deployment.git
```
## Development Workflow
We use a Makefile to manage common development tasks. Here are some useful
commands:
1. To install in development mode use:
```console
make
```
2. To reformat and do type checking:
```console
make lint
```
3. Generate the documentation:
```console
make docs
```
39 changes: 39 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,46 @@ basic deployment setup and servicing Freva will be introduced.
LegalNotes
modules

Contributing to freva-deployment
================================

We welcome contributions from the community! Before you start contributing,
please follow these steps to set up your development environment.
Make sure you have the following prerequisites installed:

- Python (>=3.x)
- Git
- Make

.. code:: console
git clone https://github.com/FREVA-CLINT/freva-deployment.git
cd freva-deployment.git
Development Workflow
--------------------

We use a Makefile to manage common development tasks. Here are some useful
commands:


1. To install in development mode use:

.. code:: console
make
2. To reformat and do type checking:

.. code:: console
make lint
3. Generate the documentations:

.. code:: console
make docs
Indices and tables
==================
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ deploy-freva-map = "freva_deployment.cli:server_map"
freva-service = "freva_deployment.cli:service"
freva-migrate = "freva_deployment.cli:migrate"
deploy-freva = "freva_deployment.ui.deployment_tui:tui"
install_script = "freva_deployment:download_auxiliry_data"


[tool.flit.sdist]
Expand Down
33 changes: 33 additions & 0 deletions src/freva_deployment/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from urllib.request import urlretrieve

__version__ = "2309.0.1"
AVAILABLE_PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11"]
AVAILABLE_CONDA_ARCHS = [
Expand All @@ -7,3 +9,34 @@
"Linux-s390x",
"MacOSX-x86_64",
]


def download_auxiliry_data():
"""Download any data that needs to be downloaded."""

def reporthook(count, block_size, total_size):
if count == 0:
return
frac = count * block_size / total_size
percent = int(100 * frac)
bar = "#" * int(frac * 40)
msg = "Downloading: [{0:<{1}}] | {2}% Completed".format(
bar, 40, round(percent, 2)
)
print(msg, end="\r", flush=True)
if frac >= 1:
print()

urls = {
"https://raw.githubusercontent.com/FREVA-CLINT/"
"freva/main/assets/evaluation_system.conf": (
"assets/share/freva/deployment/config/evaluation_system.conf.tmpl"
)
}

for source, target in urls.items():
urlretrieve(source, filename=target, reporthook=reporthook)


if __name__ == "__main__":
download_auxiliry_data()

0 comments on commit a9a113d

Please sign in to comment.