Skip to content

Commit

Permalink
Update packaging structure (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxrjones authored Apr 16, 2024
1 parent 0044c90 commit b1ec924
Show file tree
Hide file tree
Showing 17 changed files with 525 additions and 313 deletions.
42 changes: 25 additions & 17 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,35 @@ jobs:
test:
name: ${{ matrix.python-version }}-build
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4.5.0
- uses: actions/checkout@v4
- name: Install Conda environment from environment.yml
uses: mamba-org/setup-micromamba@v1
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/dev-requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- run: |
python -m pip install -r dev-requirements.txt
python -m pip install --no-deps -e .
python -m pip list
- name: Running Tests
environment-name: carbonplan
condarc: |
channels:
- conda-forge
- nodefaults
cache-downloads: false
cache-environment: true
create-args: >-
python=${{ matrix.python-version }}
- name: Install package
run: |
python -m pip install -e .[dev]
- name: Conda list information
run: |
conda env list
conda list
- name: Run tests
run: |
python -m pytest --junitxml=test-reports/junit.xml --cov=./ --verbose
- name: Upload coverage to Codecov
Expand Down
137 changes: 137 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
processed/
.DS_Store

# 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
carbonplan_data/_version.py

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

# web
.next
node_modules
2 changes: 0 additions & 2 deletions .isort.cfg

This file was deleted.

49 changes: 34 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,35 +1,54 @@
ci:
autoupdate_schedule: quarterly

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-docstring-first
- id: check-json
- id: check-yaml
- id: double-quote-string-fixer
- id: debug-statements
- id: mixed-line-ending

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.2
hooks:
- id: pyupgrade
args:
- "--py38-plus"

- repo: https://github.com/psf/black
rev: 23.3.0
rev: 24.3.0
hooks:
- id: black
args: ["--line-length", "100", "--skip-string-normalization"]
- id: black-jupyter

- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
- repo: https://github.com/keewis/blackdoc
rev: v0.3.9
hooks:
- id: flake8
- repo: https://github.com/asottile/seed-isort-config
rev: v2.2.0
- id: blackdoc

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.3.5"
hooks:
- id: seed-isort-config
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
- id: ruff
args: ["--fix"]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: isort
- id: prettier

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.9-for-vscode
rev: "v4.0.0-alpha.8"
hooks:
- id: prettier
language_version: system
name: prettier-markdown
entry: prettier --write --parser mdx
files: "\\.(\
|md|markdown|mdown|mkdn\
|mdx\
)$"
2 changes: 1 addition & 1 deletion carbonplan_styles/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
try:
version = get_distribution(__name__).version
except DistributionNotFound: # pragma: no cover
version = '0.0.0' # pragma: no cover
version = "0.0.0" # pragma: no cover
__version__ = version


Expand Down
Loading

0 comments on commit b1ec924

Please sign in to comment.