Skip to content

Commit

Permalink
Merge pull request #2 from carmelom/python_package
Browse files Browse the repository at this point in the history
  • Loading branch information
DurhamDecLab committed Mar 4, 2022
2 parents 57cf606 + 27c5db8 commit e8e9022
Show file tree
Hide file tree
Showing 30 changed files with 4,600 additions and 25 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/ci-cd.yml
@@ -0,0 +1,92 @@
name: ci-cd

on: [push, pull_request]

jobs:
ci:
# Set up operating system
runs-on: ubuntu-latest

# Define job steps
steps:
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Check-out repository
uses: actions/checkout@v2

- name: Install poetry
uses: snok/install-poetry@v1

- name: Install package
run: poetry install

- name: Test with pytest
run: poetry run pytest tests/ --cov=ARBInterp --cov-report=xml

- name: Use Codecov to track coverage
uses: codecov/codecov-action@v2
with:
files: ./coverage.xml # coverage report

- name: Build documentation
run: poetry run make html --directory docs/

cd:
# Only run this job if the "ci" job passes
needs: ci

# Only run this job if new work is pushed to "main"
if: github.event_name == 'push' && github.ref == 'refs/heads/main'

# Set up operating system
runs-on: ubuntu-latest

# Define job steps
steps:
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Check-out repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install poetry
uses: snok/install-poetry@v1

- name: Install package
run: poetry install

- name: Use Python Semantic Release to prepare release
env:
# This token is created automatically by GH Actions
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name github-actions
git config user.email github-actions@github.com
poetry run semantic-release publish
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/

- name: Test install from TestPyPI
run: |
pip install \
--index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple \
ARBInterp
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
142 changes: 142 additions & 0 deletions .gitignore
@@ -0,0 +1,142 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
**__pycache__

# PyCharm
.idea/

# RStudio project files
**.Rproj.user/
**.Rproj.user*
**.Rproj
**.Rhistory

# MacOS
.DS_Store
14 changes: 14 additions & 0 deletions .readthedocs.yml
@@ -0,0 +1,14 @@
# Required
version: 2

# Image to use
build:
image: testing

# Configuration
python:
version: 3.9
install:
- requirements: docs/requirements.txt
- method: pip
path: .
22 changes: 22 additions & 0 deletions CHANGELOG.md
@@ -0,0 +1,22 @@
# Changelog

<!--next-version-placeholder-->

## v1.8.0 (10/10/2021)

- Skipping v1.7 since I never got around to uploading it.
- I've dropped the atom trajectory stuff because it's pretty outdated and not that interesting.
- I have made some minor changes to how the code determines when it needs to calculate coefficients for a volume element or not; in some cases they may have been calculated more than once, wasting resources. There is also a new "allCoeffs" method to calculate the entire coefficients matrix, which may be useful for cases where the interpolant field doesn't change and we will re-use it (this is not a good idea for a use case where you are frequently updating the field and only sampling part of it). The next version might include an option to save these coefficients to a file for later use.

## v1.5.0 (04/10/2020) - now 4 dimensional!

- A few minor improvements to the existing tricubic class for interpolation of 3D fields - no changes to functionality.
- Now includes quadcubic class for interpolation of 4D fields - this is set up for time-dependent spatially 3D fields but could easily be adjusted to work with fields with four spatial components.

## v1.3.0 (15/02/2019)

- Minor improvements. Added optional "quiet" mode to the interpolator to suppress screen messages. Added new "Query" method to interpolate the field, which detects length of input array and handles it appropriately. Old "sQuery" and "rQuery" methods still work.

## v1.0.0 (24/01/2019)

- First release of tricubic interpolator. Designed for both scalar and vector fields, gradients are implemented. Methods for querying at single coordinates or multiple simultaneous coordinates. Created for simulating particle motion in magnetic fields but will operate with any suitably-formatted input. Future releases to incorporate numerical integrators for particle motion.
43 changes: 43 additions & 0 deletions CONDUCT.md
@@ -0,0 +1,43 @@
# Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant homepage](http://contributor-covenant.org/version/1/4), version 1.4.
73 changes: 73 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,73 @@
# Contributing

Contributions are welcome, and they are greatly appreciated! Every little bit
helps, and credit will always be given.

## Types of Contributions

### Report Bugs

If you are reporting a bug, please include:

* Your operating system name and version.
* Any details about your local setup that might be helpful in troubleshooting.
* Detailed steps to reproduce the bug.

### Fix Bugs

Look through the GitHub issues for bugs. Anything tagged with "bug" and "help
wanted" is open to whoever wants to implement it.

### Implement Features

Look through the GitHub issues for features. Anything tagged with "enhancement"
and "help wanted" is open to whoever wants to implement it.

### Write Documentation

You can never have enough documentation! Please feel free to contribute to any
part of the documentation, such as the official docs, docstrings, or even
on the web in blog posts, articles, and such.

### Submit Feedback

If you are proposing a feature:

* Explain in detail how it would work.
* Keep the scope as narrow as possible, to make it easier to implement.
* Remember that this is a volunteer-driven project, and that contributions
are welcome :)

## Get Started!

Ready to contribute? Here's how to set up `ARBInterp` for local development.

1. Download a copy of `ARBInterp` locally.
2. Install `ARBInterp` using `poetry`:

```console
$ poetry install
```

3. Use `git` (or similar) to create a branch for local development and make your changes:

```console
$ git checkout -b name-of-your-bugfix-or-feature
```

4. When you're done making changes, check that your changes conform to any code formatting requirements and pass any tests.

5. Commit your changes and open a pull request.

## Pull Request Guidelines

Before you submit a pull request, check that it meets these guidelines:

1. The pull request should include additional tests if appropriate.
2. If the pull request adds functionality, the docs should be updated.
3. The pull request should work for all currently supported operating systems and versions of Python.

## Code of Conduct

Please note that the `ARBInterp` project is released with a
Code of Conduct. By contributing to this project you agree to abide by its terms.

0 comments on commit e8e9022

Please sign in to comment.