Skip to content

Commit

Permalink
Merge pull request #9 from CosmoStat/refactor
Browse files Browse the repository at this point in the history
refactored code
  • Loading branch information
sfarrens authored Oct 10, 2023
2 parents d289617 + f6ddf6d commit ae1cdef
Show file tree
Hide file tree
Showing 14 changed files with 331 additions and 156 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

on:
pull_request:
branches:
- master

jobs:
test-full:
name: Run CI Tests
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.11"]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Check Python version
run: python --version

- name: Install dependencies
run: python -m pip install ".[test]"

- name: Run tests
run: python -m pytest
9 changes: 5 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v3

- name: Set up conda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: 3.8
python-version: 3.11

- name: Build conda environment
shell: bash -l {0}
Expand All @@ -26,13 +27,13 @@ jobs:
shell: bash -l {0}
run: |
conda activate cosmostatmap
python setup.py install
pip install .
- name: Build map
shell: bash -l {0}
run: |
conda activate cosmostatmap
python scripts/generate_map.py
generate_map.py
mv cosmostat_map.png ./build
- name: GitHub pages action
Expand Down
167 changes: 153 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,160 @@
# Ignore Python compilation
*.pyc
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Ignore scripts
*.sh
# C extensions
*.so

# Ignore cache
*.cache/
# Distribution / packaging
.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

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

# Ignore installation
*egg*
modopt.egg-info/
dist/
build/
# 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
.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

# 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/

# Ignore pypi config
.pypirc
# 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/
23 changes: 0 additions & 23 deletions cosmostatmap/info.py

This file was deleted.

2 changes: 0 additions & 2 deletions data/countries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ current:
- 'Ireland'
- 'Italy'
- 'Lebanon'
- 'Singapore'
- 'Spain'
- 'United States of America'
former:
Expand All @@ -23,7 +22,6 @@ former:
- 'Kazakhstan'
- 'Morocco'
- 'Romania'
- 'Spain'
- 'Taiwan'
- 'Tunisia'
- 'United Kingdom'
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ channels:
dependencies:
- python=3.10
- descartes
- geopandas>=0.6.1
- geopandas>=0.6.1, <1.0
- geoplot>=0.4.0
- jupyter>=1.0.0
- matplotlib
Expand Down
20 changes: 13 additions & 7 deletions notebooks/.ipynb_checkpoints/Display Map-checkpoint.ipynb

Large diffs are not rendered by default.

20 changes: 13 additions & 7 deletions notebooks/Display Map.ipynb

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[project]
name = "cosmostatmap"
readme = "README.rst"
requires-python = ">=3.10"
authors = [{ "name" = "Samuel Farrens", "email" = "[email protected]" }]
maintainers = [{ "name" = "Samuel Farrens", "email" = "[email protected]" }]
description = 'The CosmoStatMap shows the diversity of the CosmoStat team.'
dependencies = [
"descartes",
"geopandas",
"geoplot",
"matplotlib",
"numpy",
"pyyaml",
]
version = "0.0.1"

[project.optional-dependencies]
docs = ["myst-parser", "numpydoc", "sphinx", "sphinx-book-theme"]
lint = ["black", "isort"]
test = [
"pytest",
"pytest-black",
"pytest-cov",
"pytest-emoji",
"pytest-pydocstyle",
]

# Install for development
dev = ["cosmostatmap[docs,lint,test]"]

[tool.setuptools]
script-files = ["scripts/generate_map.py"]

[tool.black]
line-length = 88

[tool.pydocstyle]
convention = "numpy"

[tool.pytest.ini_options]
addopts = [
"--verbose",
"--black",
"--emoji",
"--pydocstyle",
"--cov=cosmostatmap",
]
testpaths = ["src"]
4 changes: 1 addition & 3 deletions scripts/generate_map.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-

from cosmostatmap import CosmoStatMap


def main():

CosmoStatMap('./data/countries.yml').save()
CosmoStatMap("./data/countries.yml").save()


if __name__ == "__main__":
Expand Down
14 changes: 0 additions & 14 deletions setup.cfg

This file was deleted.

24 changes: 0 additions & 24 deletions setup.py

This file was deleted.

Loading

0 comments on commit ae1cdef

Please sign in to comment.