Skip to content
Snippets Groups Projects
Commit bcc8d818 authored by Frederik Hennig's avatar Frederik Hennig Committed by Markus Holzer
Browse files

Refactor source tree layout

parent da2d8c46
Branches
Tags
1 merge request!362Refactor source tree layout
Showing
with 75 additions and 53 deletions
[flake8] [flake8]
max-line-length=120 max-line-length=120
exclude=pystencils/jupyter.py, exclude=src/pystencils/jupyter.py,
pystencils/plot.py src/pystencils/plot.py
pystencils/session.py src/pystencils/session.py
ignore = W293 W503 W291 C901 E741 ignore = W293 W503 W291 C901 E741
...@@ -5,7 +5,7 @@ __pycache__ ...@@ -5,7 +5,7 @@ __pycache__
*.vti *.vti
/build /build
/dist /dist
/*.egg-info *.egg-info
.cache .cache
_build _build
/html_doc /html_doc
...@@ -15,12 +15,12 @@ _build ...@@ -15,12 +15,12 @@ _build
_local_tmp _local_tmp
RELEASE-VERSION RELEASE-VERSION
test-report test-report
pystencils/boundaries/createindexlistcython.c src/pystencils/boundaries/createindexlistcython.c
pystencils/boundaries/createindexlistcython.*.so src/pystencils/boundaries/createindexlistcython.*.so
pystencils_tests/tmp tests/tmp
pystencils_tests/var tests/var
pystencils_tests/kerncraft_inputs/.2d-5pt.c_kerncraft/ tests/kerncraft_inputs/.2d-5pt.c_kerncraft/
pystencils_tests/kerncraft_inputs/.3d-7pt.c_kerncraft/ tests/kerncraft_inputs/.3d-7pt.c_kerncraft/
report.xml report.xml
coverage_report/ coverage_report/
......
...@@ -13,16 +13,17 @@ tests-and-coverage: ...@@ -13,16 +13,17 @@ tests-and-coverage:
variables: variables:
- $ENABLE_NIGHTLY_BUILDS - $ENABLE_NIGHTLY_BUILDS
image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full
before_script:
- pip install -e .
script: script:
- pip install sympy --upgrade
- env - env
- pip list - pip list
- export NUM_CORES=$(nproc --all) - export NUM_CORES=$(nproc --all)
- mkdir -p ~/.config/matplotlib - mkdir -p ~/.config/matplotlib
- echo "backend:template" > ~/.config/matplotlib/matplotlibrc - echo "backend:template" > ~/.config/matplotlib/matplotlibrc
- mkdir public - mkdir public
- py.test -v -n $NUM_CORES --cov-report html --cov-report xml --cov-report term --cov=. -m "not longrun" --html test-report/index.html --junitxml=report.xml - pytest -v -n $NUM_CORES --cov-report html --cov-report xml --cov-report term --cov=. -m "not longrun" --html test-report/index.html --junitxml=report.xml
- python3 -m coverage xml - python -m coverage xml
tags: tags:
- docker - docker
- cuda11 - cuda11
...@@ -45,8 +46,10 @@ tests-and-coverage-with-longrun: ...@@ -45,8 +46,10 @@ tests-and-coverage-with-longrun:
when: manual when: manual
allow_failure: true allow_failure: true
image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full
script: before_script:
- pip install sympy --upgrade - pip install sympy --upgrade
- pip install -e .
script:
- env - env
- pip list - pip list
- export NUM_CORES=$(nproc --all) - export NUM_CORES=$(nproc --all)
...@@ -66,9 +69,12 @@ latest-python: ...@@ -66,9 +69,12 @@ latest-python:
variables: variables:
- $ENABLE_NIGHTLY_BUILDS - $ENABLE_NIGHTLY_BUILDS
image: i10git.cs.fau.de:5005/pycodegen/pycodegen/latest_python image: i10git.cs.fau.de:5005/pycodegen/pycodegen/latest_python
before_script:
- pip install -e .
script: script:
- env - env
- pip list - pip list
- pip install -e .
- export NUM_CORES=$(nproc --all) - export NUM_CORES=$(nproc --all)
- mkdir -p ~/.config/matplotlib - mkdir -p ~/.config/matplotlib
- echo "backend:template" > ~/.config/matplotlib/matplotlibrc - echo "backend:template" > ~/.config/matplotlib/matplotlibrc
...@@ -107,18 +113,16 @@ ubuntu: ...@@ -107,18 +113,16 @@ ubuntu:
- $ENABLE_NIGHTLY_BUILDS - $ENABLE_NIGHTLY_BUILDS
image: i10git.cs.fau.de:5005/pycodegen/pycodegen/ubuntu image: i10git.cs.fau.de:5005/pycodegen/pycodegen/ubuntu
before_script: before_script:
- apt-get -y remove python3-sympy
- ln -s /usr/include/locale.h /usr/include/xlocale.h - ln -s /usr/include/locale.h /usr/include/xlocale.h
- pip3 install `grep -Eo 'sympy[>=]+[0-9\.]+' pyproject.toml | sed 's/>/=/g'` - pip3 install -e .
# - pip3 install `grep -Eo 'sympy[>=]+[0-9\.]+' setup.py | sed 's/>/=/g'`
script: script:
- export NUM_CORES=$(nproc --all) - export NUM_CORES=$(nproc --all)
- mkdir -p ~/.config/matplotlib - mkdir -p ~/.config/matplotlib
- echo "backend:template" > ~/.config/matplotlib/matplotlibrc - echo "backend:template" > ~/.config/matplotlib/matplotlibrc
- sed -i 's/--doctest-modules //g' pytest.ini - sed -i 's/--doctest-modules //g' pytest.ini
- env - env
- pip3 list - pip list
- pytest-3 -v -n $NUM_CORES -m "not longrun" --junitxml=report.xml - pytest -v -n $NUM_CORES -m "not longrun" --junitxml=report.xml
tags: tags:
- docker - docker
- cuda11 - cuda11
...@@ -134,6 +138,8 @@ ubuntu: ...@@ -134,6 +138,8 @@ ubuntu:
variables: variables:
- $ENABLE_NIGHTLY_BUILDS - $ENABLE_NIGHTLY_BUILDS
before_script: &multiarch_before_script before_script: &multiarch_before_script
# - pip3 install -v .
- export PYTHONPATH=src
- python3 -c "import pystencils as ps; ps.cpu.cpujit.read_config()" - python3 -c "import pystencils as ps; ps.cpu.cpujit.read_config()"
- sed -i '/^fail_under.*/d' pytest.ini - sed -i '/^fail_under.*/d' pytest.ini
script: script:
...@@ -143,7 +149,7 @@ ubuntu: ...@@ -143,7 +149,7 @@ ubuntu:
- sed -i 's/--doctest-modules //g' pytest.ini - sed -i 's/--doctest-modules //g' pytest.ini
- env - env
- pip3 list - pip3 list
- pytest-3 -v -n $NUM_CORES --junitxml=report.xml pystencils_tests/test_*vec*.py pystencils_tests/test_random.py pystencils_tests/test_half_precision.py - python3 -m pytest -v -n $NUM_CORES --junitxml=report.xml tests/test_*vec*.py tests/test_random.py tests/test_half_precision.py
tags: tags:
- docker - docker
- AVX - AVX
...@@ -199,6 +205,8 @@ minimal-conda: ...@@ -199,6 +205,8 @@ minimal-conda:
variables: variables:
- $ENABLE_NIGHTLY_BUILDS - $ENABLE_NIGHTLY_BUILDS
image: i10git.cs.fau.de:5005/pycodegen/pycodegen/minimal_conda image: i10git.cs.fau.de:5005/pycodegen/pycodegen/minimal_conda
before_script:
- pip install -e .
script: script:
- python quicktest.py - python quicktest.py
tags: tags:
...@@ -212,6 +220,8 @@ minimal-sympy-master: ...@@ -212,6 +220,8 @@ minimal-sympy-master:
variables: variables:
- $ENABLE_NIGHTLY_BUILDS - $ENABLE_NIGHTLY_BUILDS
image: i10git.cs.fau.de:5005/pycodegen/pycodegen/minimal_conda image: i10git.cs.fau.de:5005/pycodegen/pycodegen/minimal_conda
before_script:
- pip install -e .
script: script:
- python -m pip install --upgrade git+https://github.com/sympy/sympy.git - python -m pip install --upgrade git+https://github.com/sympy/sympy.git
- python quicktest.py - python quicktest.py
...@@ -275,7 +285,7 @@ flake8-lint: ...@@ -275,7 +285,7 @@ flake8-lint:
- $ENABLE_NIGHTLY_BUILDS - $ENABLE_NIGHTLY_BUILDS
image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full
script: script:
- flake8 pystencils - flake8 src/pystencils
tags: tags:
- docker - docker
...@@ -283,8 +293,9 @@ flake8-lint: ...@@ -283,8 +293,9 @@ flake8-lint:
build-documentation: build-documentation:
stage: test stage: test
image: i10git.cs.fau.de:5005/pycodegen/pycodegen/documentation image: i10git.cs.fau.de:5005/pycodegen/pycodegen/documentation
before_script:
- pip install -e .
script: script:
- export PYTHONPATH=`pwd`
- mkdir html_doc - mkdir html_doc
- sphinx-build -b html doc html_doc - sphinx-build -b html doc html_doc
- sphinx-build -W -b html doc html_doc - sphinx-build -W -b html doc html_doc
......
...@@ -8,7 +8,7 @@ import nbformat ...@@ -8,7 +8,7 @@ import nbformat
import pytest import pytest
from nbconvert import PythonExporter from nbconvert import PythonExporter
from pystencils.boundaries.createindexlistcython import * # NOQA from pystencils.boundaries.createindexlist import * # NOQA
# Trigger config file reading / creation once - to avoid race conditions when multiple instances are creating it # Trigger config file reading / creation once - to avoid race conditions when multiple instances are creating it
# at the same time # at the same time
from pystencils.cpu import cpujit from pystencils.cpu import cpujit
...@@ -40,48 +40,48 @@ def add_path_to_ignore(path): ...@@ -40,48 +40,48 @@ def add_path_to_ignore(path):
collect_ignore = [os.path.join(SCRIPT_FOLDER, "doc", "conf.py"), collect_ignore = [os.path.join(SCRIPT_FOLDER, "doc", "conf.py"),
os.path.join(SCRIPT_FOLDER, "pystencils", "opencl", "opencl.autoinit")] os.path.join(SCRIPT_FOLDER, "src", "pystencils", "opencl", "opencl.autoinit")]
add_path_to_ignore('pystencils_tests/benchmark') add_path_to_ignore('tests/benchmark')
add_path_to_ignore('_local_tmp') add_path_to_ignore('_local_tmp')
try: try:
import cupy import cupy
except ImportError: except ImportError:
collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils_tests/test_gpu.py")] collect_ignore += [os.path.join(SCRIPT_FOLDER, "tests/test_gpu.py")]
add_path_to_ignore('pystencils/gpu') add_path_to_ignore('src/pystencils/gpu')
try: try:
import waLBerla import waLBerla
except ImportError: except ImportError:
collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils_tests/test_aligned_array.py"), collect_ignore += [os.path.join(SCRIPT_FOLDER, "tests/test_aligned_array.py"),
os.path.join(SCRIPT_FOLDER, "pystencils_tests/test_datahandling_parallel.py"), os.path.join(SCRIPT_FOLDER, "tests/test_datahandling_parallel.py"),
os.path.join(SCRIPT_FOLDER, "doc/notebooks/03_tutorial_datahandling.ipynb"), os.path.join(SCRIPT_FOLDER, "doc/notebooks/03_tutorial_datahandling.ipynb"),
os.path.join(SCRIPT_FOLDER, "pystencils/datahandling/parallel_datahandling.py"), os.path.join(SCRIPT_FOLDER, "src/pystencils/datahandling/parallel_datahandling.py"),
os.path.join(SCRIPT_FOLDER, "pystencils_tests/test_small_block_benchmark.ipynb")] os.path.join(SCRIPT_FOLDER, "tests/test_small_block_benchmark.ipynb")]
try: try:
import blitzdb import blitzdb
except ImportError: except ImportError:
add_path_to_ignore('pystencils/runhelper') add_path_to_ignore('src/pystencils/runhelper')
collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils_tests/test_parameterstudy.py")] collect_ignore += [os.path.join(SCRIPT_FOLDER, "tests/test_parameterstudy.py")]
collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils_tests/test_json_serializer.py")] collect_ignore += [os.path.join(SCRIPT_FOLDER, "tests/test_json_serializer.py")]
try: try:
import islpy import islpy
except ImportError: except ImportError:
collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils/integer_set_analysis.py")] collect_ignore += [os.path.join(SCRIPT_FOLDER, "src/pystencils/integer_set_analysis.py")]
try: try:
import graphviz import graphviz
except ImportError: except ImportError:
collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils/backends/dot.py")] collect_ignore += [os.path.join(SCRIPT_FOLDER, "src/pystencils/backends/dot.py")]
collect_ignore += [os.path.join(SCRIPT_FOLDER, "doc/notebooks/01_tutorial_getting_started.ipynb")] collect_ignore += [os.path.join(SCRIPT_FOLDER, "doc/notebooks/01_tutorial_getting_started.ipynb")]
try: try:
import pyevtk import pyevtk
except ImportError: except ImportError:
collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils/datahandling/vtk.py")] collect_ignore += [os.path.join(SCRIPT_FOLDER, "src/pystencils/datahandling/vtk.py")]
collect_ignore += [os.path.join(SCRIPT_FOLDER, 'setup.py')] collect_ignore += [os.path.join(SCRIPT_FOLDER, 'setup.py')]
......
...@@ -12,7 +12,7 @@ authors = [ ...@@ -12,7 +12,7 @@ authors = [
] ]
license = { file = "COPYING.txt" } license = { file = "COPYING.txt" }
requires-python = ">=3.10" requires-python = ">=3.10"
dependencies = ["sympy>=1.6,<=1.11.1", "numpy>=1.8.0", "appdirs", "joblib"] dependencies = ["sympy>=1.6,<=1.11.1", "numpy>=1.8.0", "appdirs", "joblib", "pyyaml"]
classifiers = [ classifiers = [
"Development Status :: 4 - Beta", "Development Status :: 4 - Beta",
"Framework :: Jupyter", "Framework :: Jupyter",
...@@ -62,12 +62,14 @@ tests = [ ...@@ -62,12 +62,14 @@ tests = [
'nbformat', 'nbformat',
'nbconvert', 'nbconvert',
'ipython', 'ipython',
'matplotlib',
'py-cpuinfo',
'randomgen>=1.18', 'randomgen>=1.18',
] ]
[build-system] [build-system]
requires = [ requires = [
"setuptools>=69", "setuptools>=61",
"versioneer>=0.29", "versioneer>=0.29",
"tomli; python_version < '3.11'", "tomli; python_version < '3.11'",
# 'Cython' # 'Cython'
...@@ -84,7 +86,7 @@ pystencils = [ ...@@ -84,7 +86,7 @@ pystencils = [
] ]
[tool.setuptools.packages.find] [tool.setuptools.packages.find]
where = ["."] where = ["src"]
include = ["pystencils", "pystencils.*"] include = ["pystencils", "pystencils.*"]
namespaces = false namespaces = false
...@@ -94,7 +96,7 @@ namespaces = false ...@@ -94,7 +96,7 @@ namespaces = false
# resulting files. # resulting files.
VCS = "git" VCS = "git"
style = "pep440" style = "pep440"
versionfile_source = "pystencils/_version.py" versionfile_source = "src/pystencils/_version.py"
versionfile_build = "pystencils/_version.py" versionfile_build = "pystencils/_version.py"
tag_prefix = "release/" tag_prefix = "release/"
parentdir_prefix = "pystencils-" parentdir_prefix = "pystencils-"
[pytest] [pytest]
testpaths = src tests doc/notebooks
pythonpath = src
python_files = test_*.py *_test.py scenario_*.py python_files = test_*.py *_test.py scenario_*.py
norecursedirs = *.egg-info .git .cache .ipynb_checkpoints htmlcov norecursedirs = *.egg-info .git .cache .ipynb_checkpoints htmlcov
addopts = --doctest-modules --durations=20 --cov-config pytest.ini addopts = --doctest-modules --durations=20 --cov-config pytest.ini
...@@ -17,20 +19,21 @@ filterwarnings = ...@@ -17,20 +19,21 @@ filterwarnings =
[run] [run]
branch = True branch = True
source = pystencils source = src/pystencils
pystencils_tests tests
omit = doc/* omit = doc/*
pystencils_tests/* tests/*
setup.py setup.py
quicktest.py
conftest.py conftest.py
versioneer.py versioneer.py
pystencils/jupytersetup.py src/pystencils/jupytersetup.py
pystencils/cpu/msvc_detection.py src/pystencils/cpu/msvc_detection.py
pystencils/sympy_gmpy_bug_workaround.py src/pystencils/sympy_gmpy_bug_workaround.py
pystencils/cache.py src/pystencils/cache.py
pystencils/pacxx/benchmark.py src/pystencils/pacxx/benchmark.py
pystencils/_version.py src/pystencils/_version.py
venv/ venv/
[report] [report]
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
from contextlib import redirect_stdout from contextlib import redirect_stdout
import io import io
from pystencils_tests.test_quicktests import ( from tests.test_quicktests import (
test_basic_kernel, test_basic_kernel,
test_basic_blocking_staggered, test_basic_blocking_staggered,
test_basic_vectorization, test_basic_vectorization,
......
import os from setuptools import setup, __version__ as setuptools_version
from setuptools import Extension, setup if int(setuptools_version.split('.')[0]) < 61:
raise Exception(
"[ERROR] pystencils requires at least setuptools version 61 to install.\n"
"If this error occurs during an installation via pip, it is likely that there is a conflict between "
"versions of setuptools installed by pip and the system package manager. "
"In this case, it is recommended to install pystencils into a virtual environment instead."
)
import versioneer import versioneer
......
File moved
File moved
File moved
File moved
File moved
File moved
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment