Skip to content

Commit

Permalink
Update README with a section for developers
Browse files Browse the repository at this point in the history
  • Loading branch information
MetinSa committed Mar 21, 2024
1 parent 09f19e2 commit e137965
Show file tree
Hide file tree
Showing 4 changed files with 266 additions and 62 deletions.
189 changes: 166 additions & 23 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,31 +1,174 @@
.DS_Store
.vscode
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Byte compilation
__pycache__
# C extensions
*.so

# Distribution / packaging
dist
build
.pytest_cache
.mypy_cache
.hypothesis
.tox
.eggs
.cache
htmlcov
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
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
UNKNOWN.egg-info
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# 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/
site
# Development files and directories
context.py
test.py
fitting
zodipy/_integration.py

# data
dirbe
# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .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

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

TODO.md
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__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/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# ruff
.ruff_cache

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# vscode
settings.json

#mac
.DS_Store
.vscode

#files
test.py
context.py
6 changes: 5 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ contributions.
The goal is to maintain a diverse community that's pleasant for everyone.
**Please be considerate and respectful of others**. Everyone must abide by our
[Code of Conduct](https://github.com/Cosmoglobe/zodipy/blob/main/CODE_OF_CONDUCT.md)
and we encourage all to read it carefully.
and we encourage all to read it carefully.

## For developers

Contributers should read the "For developers" section in the project README, which describes the installation and testing steps required during development.
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ See the [documentation](https://cosmoglobe.github.io/zodipy/) for more informati
# Installation
ZodiPy is installed using `pip install zodipy`.

# Dependencies
ZodiPy supports all Python versions >= 3.8, and has the following dependencies:
- [Astropy](https://www.astropy.org/) (>=5.0.1)
- [NumPy](https://numpy.org/)
- [healpy](https://healpy.readthedocs.io/en/latest/)
- [jplephem](https://pypi.org/project/jplephem/)


# A simple example
```python
import astropy.units as u
Expand All @@ -45,6 +53,53 @@ print(emission)
#> [15.35392831 15.35495051 15.35616009] MJy / sr
```

# For developers
Contributing developers will need the download the following additional dependencies:
- pytest
- pytest-cov
- hypothesis
- coverage
- ruff
- mypy
- pre-commit
- mkdocs
- pymdown-extensions
- markdown-include
- mkdocs-material
- mkdocstrings
- mkdocstrings-python
- markdown (<3.4.0)

which are required to test and build ZodiPy.

## Poetry
Developers can install ZodiPy through [Poetry](https://python-poetry.org/) (Poetry >= 1.8.0) by first cloning or forking the repository, and then running
```
poetry install
```
in a virtual environment from the repository root. This will read the `pyproject.toml` file in the repository and install all dependencies.

## pip
Developers not using Poetry can install ZodiPy in a virtual environment with all dependencies with pip by running
```
pip install -r requirements-dev.txt
```
from the repositry root. This will read and download all the dependencies from the `requirements-dev.txt` file in the repositry.

Note that developers using Python 3.12 will need to upgrade their pip versions with `python3 -m pip install --upgrade pip` before being able to install ZodiPy. This is due to known incompatibilities between older pip versions and Python 3.12

## Tests and formatting
The following tools should be run from the root of the repository and producing no errors. These are ran automatically as part of the CI workflows on GitHub, but should be tested locally first

- [pytest](https://docs.pytest.org/en/8.0.x/): Tests are run with pytest by simply running `pytest` in the command line in the repository root.
- [ruff](https://github.com/astral-sh/ruff): Formating linting is done with `ruff` by simply running `ruff` in the command line in the repository root.
- [mypy](https://mypy-lang.org/): Type checking is done with `mypy` by simply running `mypy zodipy` in the root of the repository.

Remeber to add tests when implementing new features to maintain a high code coverage.

## Documentation
We use [MkDocs](https://www.mkdocs.org/) to create our documentation. Documentation is automatically built and uploaded as part of the github CI. New features should be documented by adding content to the `docs/` folder at the appropriate places.

# Scientific paper and citation
For an overview of the ZodiPy model approach and other information regarding zodiacal emission and interplanetary dust modeling we refer to the scientific paper on ZodiPy:
- [Cosmoglobe: Simulating zodiacal emission with ZodiPy (San et al. 2022)](https://arxiv.org/abs/2205.12962).
Expand Down
Loading

0 comments on commit e137965

Please sign in to comment.