Skip to content

Commit

Permalink
Use pip requirements, add github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
SallyDa committed Oct 30, 2024
1 parent e8af253 commit 76797a0
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 132 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/main_actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: sodym.tests

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read

jobs:
build:

runs-on: windows-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v3
with:
python-version: "3.12"
- name: Install dependencies and run tests
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
python -m pytest
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
repos:
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
args: [--line-length=100]
language_version: python3.12
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-yaml
- id: check-case-conflict
- id: end-of-file-fixer
- id: trailing-whitespace
20 changes: 7 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,17 @@ https://github.com/IndEcol/ODYM<br>

## Installation

sodym dependencies are managed with [poetry](https://python-poetry.org/), which creates a [virtual environment](https://docs.python.org/3/tutorial/venv.html) and installs dependencies automatically. The process is quite simple:
sodym dependencies are managed with [pip](https://pypi.org/project/pip/).

1. Clone the sodym repository using git.
2. [Install poetry](https://python-poetry.org/docs/#installation)
- *Optional*: Configure poetry to create your virtual environment in the project folder via<br>`poetry config virtualenvs.in-project true`
3. From the project main directory, run `poetry install` to obtain all the necessary dependencies.

To execute python commands using the virtual environment of this project, use `poetry run <command>`, or activate the environment via `[/path/to/].venv/Scripts/activate`.
Further information can be found in the documentations of poetry and virtual environments linked above.
To install as a user: run `python -m pip install sodym@git+https://github.com/pik-piam/sodym.git`

## Documentation
To install as a developer, assuming you already have python installed:

To build and view the documentation, follow these steps:
1. Clone the sodym repository using git.
2. From the project main directory, run `pip install -e ".[test]"` to obtain all the necessary
dependencies, including those for running the tests.

1. From the main directory, run `poetry install --with docs`
2. Navigate to the `docs` subdirectory, and run `poetry run make html`.
3. Open the file `docs/build/html/index.html` to view the documentation.
Note that it is advisable to do this within a virtual environment.

## Examples

Expand Down
78 changes: 36 additions & 42 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,46 +1,40 @@
[tool.poetry]
[build-system]
requires = ["setuptools >= 61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "sodym"
version = "0.1.0"
description = ""
authors = ["Jakob Dürrwächter, Merlin Hosak, Stefan Pauliuk"]
authors = [
{name = "Jakob Dürrwächter"},
{name = "Merlin Hosak"},
]
readme = "README.md"
packages = [{include = "sodym"}]

[tool.poetry.dependencies]
python = ">=3.10,<3.13"
matplotlib = "^3.7.1"
numpy = "^1.25.0"
scipy = "^1.11.0"
PyYAML = "^6.0"
pandas = "^2.0.2"
pickle4 = "^0.0.1"
plotly = "^5.18.0"
pydantic = "^2.8.2"
ruff = "^0.5.6"
docformatter = "^1.7.5"
openpyxl = "^3.1.5"
nbformat = "^5.10.4"

[tool.poetry.group.examples.dependencies]
jupyter = "^1.1.1"

[tool.poetry.group.test]
optional = true
requires-python = ">= 3.10"
dependencies = [
"matplotlib>=3.7.1",
"numpy>=1.25.0",
"scipy>=1.11.0",
"PyYAML>=6.0",
"pandas>=2.0.2",
"pickle4>=0.0.1",
"plotly>=5.18.0",
"pydantic>=2.8.2",
"docformatter>=1.7.5",
"openpyxl>=3.1.5",
"nbformat>=5.10.4",
]

[tool.poetry.group.test.dependencies]
pytest = "^8.3.2"
polyfactory = "^2.16.2"

[tool.poetry.group.docs]
optional = true

[tool.poetry.group.docs.dependencies]
sphinx = "^7.4.0"
sphinx-pydantic = "^0.1.1"
autodoc-pydantic = "^2.2.0"
sphinx-rtd-theme = "^2.0.0"
myst-parser = "^4.0.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[project.optional-dependencies]
examples = ["jupyter>=1.1.1"]
test = [
"pytest>=8.3.2",
"polyfactory>=2.16.2",
]
docs = [
"sphinx>=7.4.0",
"sphinx-pydantic>=0.1.1",
"autodoc-pydantic>=2.2.0",
"sphinx-rtd-theme>=2.0.0",
"myst-parser>=4.0.0",
]
46 changes: 46 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
annotated-types==0.7.0
attrs==24.2.0
charset-normalizer==3.4.0
colorama==0.4.6
contourpy==1.3.0
cycler==0.12.1
docformatter==1.7.5
et-xmlfile==1.1.0
Faker==30.8.0
fastjsonschema==2.20.0
fonttools==4.54.1
iniconfig==2.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter_core==5.7.2
kiwisolver==1.4.7
matplotlib==3.9.2
nbformat==5.10.4
numpy==2.1.2
openpyxl==3.1.5
packaging==24.1
pandas==2.2.3
pickle4==0.0.1
pillow==11.0.0
platformdirs==4.3.6
plotly==5.24.1
pluggy==1.5.0
polyfactory==2.17.0
pydantic==2.9.2
pydantic_core==2.23.4
pyparsing==3.2.0
pytest==8.3.3
python-dateutil==2.9.0.post0
pytz==2024.2
pywin32==308
PyYAML==6.0.2
referencing==0.35.1
rpds-py==0.20.0
scipy==1.14.1
setuptools==75.2.0
six==1.16.0
tenacity==9.0.0
traitlets==5.14.3
typing_extensions==4.12.2
tzdata==2024.2
untokenize==0.1.1
77 changes: 0 additions & 77 deletions ruff.toml

This file was deleted.

0 comments on commit 76797a0

Please sign in to comment.