Skip to content
Snippets Groups Projects
Unverified Commit 9db4fbeb authored by Erin (Josh) Rigler's avatar Erin (Josh) Rigler Committed by GitHub
Browse files

Merge pull request #280 from jmfee-usgs/develop-docs

Develop docs - 
parents 37052668 80398769
No related branches found
No related tags found
No related merge requests found
[flake8]
count = True
exclude = .git,__pycache,node_modules,.ipynb_checkpoints
# This project uses PEP8 with the following exceptions:
# - continuation lines should use 2 levels of indentation (8 spaces)
# E122: continuation line missing indentation or outdented
# E126: continuation line over-indented for hanging indent
# E127: continuation line over-indented for visual indent
# E128: continuation line under-indented for visual indent
# E131: continuation line unaligned for hanging indent
# - short variables should be avoided, but not currently enforced
# E741: do not use variables named ‘l’, ‘O’, or ‘I’
# - both W503 and W504 are enabled, but contradictory.
# code currently appears to adhere to W503.
# W504: line break after binary operator
ignore = E122, E126, E127, E128, E131, E741, W504
......@@ -6,4 +6,7 @@ coverage.xml
.ipynb_checkpoints*
.pytest_cache
htmlcov
.vscode
\ No newline at end of file
.vscode
build
dist
*.egg-info
\ No newline at end of file
ARG BUILD_IMAGE=usgs/centos:7
ARG FROM_IMAGE=usgs/centos:7
FROM $BUILD_IMAGE AS pycurl-build
ARG FROM_IMAGE=usgs/centos:8
FROM $FROM_IMAGE
LABEL maintainer="Jeremy Fee <jmfee@usgs.gov>"
# install conda dependencies
RUN yum install -y \
bzip2 \
gcc \
libcurl-devel \
&& yum clean all
# install conda
ENV PATH /conda/bin:$PATH
......@@ -21,29 +16,24 @@ RUN echo 'export PATH=/conda/bin:$PATH' > /etc/profile.d/conda.sh \
# install dependencies via conda
RUN conda config --set ssl_verify $SSL_CERT_FILE \
&& conda config --add channels conda-forge \
&& conda install --yes jupyter obspy \
# build pycurl with SFTP support
&& conda install --yes jupyter obspy pycurl \
&& conda clean --all -y \
&& export PIP_CERT=$SSL_CERT_FILE \
&& export PYCURL_SSL_LIBRARY=nss \
&& pip install pycurl \
# clean up
&& conda clean --all -y
&& pip install \
authlib \
flask \
flask-login \
flask-migrate \
flask-session \
flask-sqlalchemy \
psycopg2-binary
FROM $FROM_IMAGE
LABEL maintainer="Jeremy Fee <jmfee@usgs.gov>"
# use conda install from build container
ENV PATH /conda/bin:$PATH
COPY --from=pycurl-build /conda /conda
COPY --from=pycurl-build /etc/profile.d/conda.sh /etc/profile.d/conda.sh
# copy library (ignores set in .dockerignore)
COPY . /geomag-algorithms
RUN pip install /geomag-algorithms \
&& useradd \
RUN useradd \
-c 'Docker image user' \
-m \
-r \
......
Makefile 0 → 100644
.PHONY: build clean coverage format test
build:
python setup.py bdist_wheel -d dist
clean:
# run in interactive mode
git clean -i
coverage:
pytest --cov=geomagio --cov-report xml
format:
black .
test:
pytest
......@@ -4,7 +4,6 @@ url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
flake8 = "*"
pytest = "*"
pytest-cov = "*"
webtest = "*"
......
......@@ -4,21 +4,21 @@
# "exec" seems like a much simpler solution for this,
# however, jupyter kernels die noisy deaths when using exec.
_term () {
echo 'Caught SIGERM'
kill -TERM "$child"
}
trap _term SIGTERM
# _term () {
# echo 'Caught SIGTERM'
# kill -TERM "$child"
#}
#trap _term SIGTERM
# add geomagio to notebook path
export PYTHONPATH=/geomag-algorithms
# run jupyter notebook server
jupyter notebook \
exec jupyter notebook \
--ip='*' \
--notebook-dir=/home/geomag_user/notebooks \
--no-browser \
--port=8000 &
--port=8000
child=$!
wait "$child"
#child=$!
#wait "$child"
Development Dependencies
========================
# Development Dependencies
These instructions only need to be completed if you plan on developing new
code for this project, and may also be used to run a local copy of the code.
code for this project, but may also be used to run a local copy of the code.
## Clone Project
Begin Developing
----------------
This project uses a forking workflow.
https://guides.github.com/activities/forking/
1. Install `obspy`, `pycurl`, `flake8`, `pytest`, `pytest-cov`, `webtest`.
> Using Anaconda is recommended ( https://conda.io/miniconda.html ).
1. Fork this project on Github.
conda config --add channels conda-forge
conda create --name geomagenv obspy pycurl flake8 pytest pytest-cov webtest
source activate geomagenv
https://github.com/usgs/geomag-algorithms.git
2. Fork this project on Github ( https://guides.github.com/activities/forking/ ).
https://github.com/{YOUR_GITHUB_ACCOUNT}/geomag-algorithms.git
3. Clone your fork
2. Clone your fork
git clone https://github.com/{YOUR_GITHUB_ACCOUNT}/geomag-algorithms.git
cd geomag-algorithms
git remote add upstream https://github.com/usgs/geomag-algorithms.git
4. Use branches to develop new features and submit pull requests.
3. Use branches to develop new features and submit pull requests.
## Install Dependencies
Developer Tools
---------------
- Using `pipenv`
https://pipenv.kennethreitz.org/en/latest/
- **Linting errors**
Check for linting errors using Flake8
> `pyenv` is also useful for installing specific/multiple versions of python
>
> - https://github.com/pyenv/pyenv
> - https://github.com/pyenv-win/pyenv-win
cd geomag-algorithms
flake8
pipenv install --dev
pipenv shell
- Or, using Miniconda/Anaconda
https://conda.io/miniconda.html
conda config --add channels conda-forge
conda create --name geomagenv obspy pycurl black pre-commit pytest pytest-cov webtest
conda activate geomagenv
## Coding Standards
This project uses _The Black Code Style_
https://black.readthedocs.io/en/stable/the_black_code_style.html
## Developer Tools
- **Code Formatting**
This project uses the `black` formatter, combined with `pre-commit`, to
automatically format code before it is committed.
VSCode ( https://code.visualstudio.com/ ), with the `Python` extension,
can be configured to automatically format using `black` when files are saved.
The `Formatting Toggle` extension is also useful.
You can also manually format all files in the project by running
black .
- **Unit tests**
Run unit tests using PyTest
cd geomag-algorithms
pytest
Run unit tests using PyTest
- **Unit test coverage**
pytest
cd geomag-algorithms
pytest --cov=geomagio
- **Unit test coverage**
- **Automatically run linting and tests while developing**
(Requires NodeJS)
pytest --cov=geomagio
cd geomag-algorithms
npm install
npm run watch
## Routine Git Updates
There are also "npm run" aliases for individual commands which are listed by running
- **Pulling new changes**
npm run
When starting a new branch, or before putting in a pull request, make sure
you have the latest changes from the `upstream` repository.
> The local master branch should only be used for synchonization with the
> `upstream` repository, and we recommend always using the `--ff-only` option.
Coding Standards
----------------
git checkout master
git pull --ff-only upstream master
This project adheres to PEP8 standards in most cases:
https://www.python.org/dev/peps/pep-0008
- **Rebase an existing branch**
**PEP8 Exceptions**
After downloading updates into the master branch, feature branches need to be
rebased so they include any already merged changes.
- Hanging/Visual indents (E122, E126, E127, E128, E131)
git checkout FEATURE-BRANCH
git rebase master
- line continuations should use two indentations (8 spaces).
- do not use visual indents.
Resolve any rebase conflicts.
If you have already pushed this branch to your fork, you may need to force push
because branch history has changed.
from distutils.core import setup
import setuptools
setup(
setuptools.setup(
name="geomag-algorithms",
version="1.0.0",
description="USGS Geomag IO Library",
version="1.0.1",
description="USGS Geomag Algorithms Library",
url="https://github.com/usgs/geomag-algorithms",
packages=[
"geomagio",
"geomagio.algorithm",
"geomagio.binlog",
"geomagio.edge",
"geomagio.iaga2002",
"geomagio.imfjson",
"geomagio.imfv122",
"geomagio.imfv283",
"geomagio.pcdcp",
"geomagio.temperature",
"geomagio.vbf",
],
install_requires=["numpy", "matplotlib", "scipy", "obspy", "pycurl"],
packages=setuptools.find_packages(exclude=["test*"]),
python_requires=">=3.6, <4",
install_requires=["obspy"],
extras_require={
"url": ["pycurl"],
"webservice": [
"authlib",
"flask",
"flask-login",
"flask-migrate",
"flask-session",
"flask-sqlalchemy",
"psycopg2-binary",
],
},
scripts=["bin/geomag.py", "bin/geomag_webservice.py", "bin/make_cal.py"],
project_urls={
"Bug Reports": "https://github.com/usgs/geomag-algorithms/issues",
"Source": "https://github.com/usgs/geomag-algorithms",
},
)
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