-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
344 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[tool.black] | ||
line-length = 79 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[run] | ||
source = src | ||
|
||
omit = */_version.py | ||
|
||
[report] | ||
exclude_also = | ||
from ._version | ||
def __repr__ | ||
if self.debug: | ||
if settings.DEBUG | ||
raise AssertionError | ||
raise NotImplementedError | ||
if 0: | ||
if __name__ == .__main__.: | ||
if TYPE_CHECKING: | ||
@(abc\.)?abstractmethod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
default_language_version: | ||
python: python3.11 | ||
repos: | ||
- repo: https://github.com/psf/black | ||
rev: 23.3.0 | ||
hooks: | ||
- id: black | ||
args: [--config, .config/black.toml] | ||
- repo: https://github.com/charliermarsh/ruff-pre-commit | ||
rev: v0.0.267 | ||
hooks: | ||
- id: ruff | ||
args: [--config, .config/ruff.toml, --fix, --exit-non-zero-on-fix] | ||
- repo: https://github.com/jazzband/pip-tools | ||
rev: 6.13.0 | ||
hooks: | ||
- id: pip-compile | ||
name: pip-compile requirements.txt | ||
files: pyproject.toml | ||
args: [pyproject.toml, --resolver=backtracking, --all-extras, --upgrade, -q, -o, requirements.txt] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[pytest] | ||
pythonpath = ../src | ||
addopts = "--color=yes" | ||
log_cli = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
line-length = 79 | ||
exclude = ["_version.py"] | ||
ignore = [ | ||
"E501" # Line too long | ||
] | ||
# List of rules: https://beta.ruff.rs/docs/rules/ | ||
select = [ | ||
"E", # pycodestyle - default | ||
"F", # pyflakes - default | ||
"I" # isort | ||
] | ||
|
||
[isort] | ||
known-local-folder = ["hdx"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Development | ||
|
||
## Environment | ||
|
||
Development is currently done using Python 3.11. We recommend using a virtual | ||
environment such as ``venv``: | ||
|
||
python3.11 -m venv venv | ||
source venv/bin/activate | ||
|
||
In your virtual environment, please install all packages for | ||
development by running: | ||
|
||
pip install -r requirements.txt | ||
|
||
## Pre-Commit | ||
|
||
Also be sure to install `pre-commit`, which is run every time | ||
you make a git commit: | ||
|
||
pre-commit install | ||
|
||
The configuration file for this project is in a | ||
non-start location. Thus, you will need to edit your | ||
`.git/hooks/pre-commit` file to reflect this. Change | ||
the line that begins with `ARGS` to: | ||
|
||
ARGS=(hook-impl --config=.config/pre-commit-config.yaml --hook-type=pre-commit) | ||
|
||
With pre-commit, all code is formatted according to | ||
[black]("https://github.com/psf/black") and | ||
[ruff]("https://github.com/charliermarsh/ruff") guidelines. | ||
|
||
To check if your changes pass pre-commit without committing, run: | ||
|
||
pre-commit run --all-files --config=.config/pre-commit-config.yaml | ||
|
||
## Testing | ||
|
||
To run the tests and view coverage, execute: | ||
|
||
pytest -c .config/pytest.ini --cov hdx --cov-config .config/coveragerc | ||
|
||
Follow the example set out already in ``api.rst`` as you write the documentation. | ||
|
||
## Packages | ||
|
||
[pip-tools](https://github.com/jazzband/pip-tools) is used for | ||
package management. If you’ve introduced a new package to the | ||
source code (i.e.anywhere in `src/`), please add it to the | ||
`project.dependencies` section of | ||
`pyproject.toml` with any known version constraints. | ||
|
||
For adding packages for testing or development, add them to | ||
the `test` or `dev` sections under `[project.optional-dependencies]`. | ||
|
||
Any changes to the dependencies will be automatically reflected in | ||
`requirements.txt` with `pre-commit`, but you can re-generate | ||
the file without committing by executing: | ||
|
||
pre-commit run pip-compile --all-files --config=.config/pre-commit-config.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
loaders: | ||
- type: python | ||
search_path: | ||
- ../src | ||
packages: | ||
- hdx.database | ||
renderer: | ||
type: mkdocs | ||
output_directory: docs | ||
mkdocs_config: | ||
site_name: HDX Python Database | ||
theme: readthedocs | ||
repo_url: "https://github.com/OCHA-DAP/hdx-python-database" | ||
markdown: | ||
source_linker: | ||
type: github | ||
repo: OCHA-DAP/hdx-python-database | ||
pages: | ||
- title: Home | ||
name: index | ||
source: doc/main.md | ||
- title: API Documentation | ||
children: | ||
- title: Database | ||
contents: | ||
- hdx.database.Database | ||
- title: PostgreSQL specific | ||
contents: | ||
- hdx.database.postgresql.* |
Oops, something went wrong.