Skip to main content

A minimal code to compute vertical stresses in horizontal soil profile.

Project description

Rudimentary soil model primarily for vertical stresses under level ground.

Define soil layers, assemble them into soil profile and compute total vertical stresses, pore pressures, and effective vertical stresses at specified locations beneath a level ground. In addition, return requested soil parameters at specified depths. One can use these parameters at specified depths to perform futher analysis. This is a work in progress.

Documentation

pyvstress documentation

References:

Usage

Sorry for the lack of documentation. I am in the process of learning how to create documentation from python docstrings. I am a slow learner so I do not know when that will be ready. Once that is up, maybe I will include few examples in the documentation. Untill then please refer to the tests and the examples folders.

Requirements

There is a requirements.txt file which was generated using pipreqs. The version number may not be very important. Only Python and Numpy are required for the package:

  • python: the latest version, most probably 3.10, but version number may not be too important
  • numpy

If you have a .venv virtual environment, pipreqs returns a bunch of packages. In such cases use --ignore .venv.

pipreqs ./ --ignore .venv

Use --force if requirement.txt already exists.

However, these additional packages are required to run the example files and tests with pytest.

  • pandas
  • matplotlib
  • altair
  • hancalcs
  • pytest

Project folder

pyvstress (Package root directory) ├── build ├── dist ├── docs ├── examples ├── LICENSE.md ├── pyproject.toml ├── pyvstress ├── about.py ├── exceptions.py ├── init.py ├── pycache ├── soil.py └── utility_functions.py ├── pyvstress.egg-info ├── README.md ├── requirements.txt └── tests

Local installation in virtual environment

  1. Make a .venv directory in the project folder.
  2. Make a virtual environment python -m venv .venv
  3. Activate the virtual environment source .venv/bin/activate
  4. Install the requirements python -m pip install -r requirements.txt
  5. Install the package locally pip install -e .

Above (4) and (5) are run after activating the virtual environment. This will install the package to the virtual environment. Any changes your make to the source code will be reflected in the package.

Build system

Creater a pyproject.toml file. Refer to Setuptools Quickstart Userguide

  • Place a pyproject.toml in the root directory of the project. Check the file for this package in the project root directory.

  • Install setuptools and build using pip in the virtual environment .venv.

  • Run python -m build in the package root directory. This will create .whl and .tar.gz in the /build directory for distribution.

Upload to online repository with twine

  • To upload to pypi, twine upload

  • To upload to TestPyPi twine upload --repository testpypi dist/*

Installation

I have a version uploaded to pypi pip install pyvstress

If installing packages from TestPyPi then $ pip install --index-url https://test.pypi.org/simple/packagename

Publishing

The documentation is created using the docstrings with Sphinx and published at Read the docs.

  1. Install sphinx and sphinx-rtd-theme, in the same environment in which you are building your package. That means you have to be in the virtural environment e.g. source .venv\bin\activate
pip install sphinx
pip install sphinx-rtd-theme
  1. Create docs directory in your package directory to hold the documentation files. mkdir docs

  2. Run sphinx-quickstart in the docs folder. Provide the information and when asked about creating a separate folder for build type y.

sphinx-quickstart

The docs folder will have

build
source
Makefile
make.bat

Within the source folder there will be two files:

conf.py
index.rst
  1. Run the Sphinx API documentation command sphinx-apidoc to generate Sphinx source files.
[user@host docs]$ sphinx-apidoc -o source/ ../pyvstress
  1. Edit the conf.py file.

    • a. Change the html_theme to the one of your liking, html_theme = 'sphinx_rtd_theme.
    • b. For autocode generattion from docstrings in the code, specifiy the directory of source code.
    import os
    import sys
    sys.path.insert(0, os.path.abspath('../../pysoil/'))
    
    • c. Also add some extensions
    extensions = ['sphinx.ext.todo', 'sphinx.ext.viewcode', 'sphinx.ext.autodoc']
    
  2. Run make htlm, which builds the htlm files in the build/ directory.

  3. Log into ReadTheDocs and click on Import Project. Fill out the fields. For the repository URL use https://gitlab.com/geosharma/pyvstress.git. This can be got from CLONE -> Clone with HTPPS URL.

  4. Then in Projects -> Admin -> Integration, click on Add Integration and choose GitLab incoming webhook.

  5. Then copy the URL starting with readthedocs.org/api/v2/webhook/...../...... and paste it into GitLab Project Settings -> Webhooks References:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyvstress-0.0.3.tar.gz (25.7 kB view details)

Uploaded Source

Built Distribution

pyvstress-0.0.3-py3-none-any.whl (25.1 kB view details)

Uploaded Python 3

File details

Details for the file pyvstress-0.0.3.tar.gz.

File metadata

  • Download URL: pyvstress-0.0.3.tar.gz
  • Upload date:
  • Size: 25.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.5 Linux/6.4.12-arch1-1

File hashes

Hashes for pyvstress-0.0.3.tar.gz
Algorithm Hash digest
SHA256 327c555fdcb337bf8f762ca1cecf5a60c777de38b02b723e59a939bce8d5bc86
MD5 dd15bc558f4cba4e48503d8fcb846ca2
BLAKE2b-256 d76e0c21cd014b3912635f6f707668d955d44c6404de2e8cc83139ab2b2a641d

See more details on using hashes here.

File details

Details for the file pyvstress-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: pyvstress-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 25.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.5 Linux/6.4.12-arch1-1

File hashes

Hashes for pyvstress-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4b55825d438251eeb6834db9ca0d6997f57c49d2514fa624b4d8b07b2d06f566
MD5 b62f4361c74c5794e8da7fe25ab6c710
BLAKE2b-256 60a83926d10ffac1130ab4153e625d6a7705c6bbf2a15658b1f6695e621fafb9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page