Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elevate #40

Merged
merged 8 commits into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ environment:
# Windows core tests
- job_name: test-win
# ~35 min
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
# Python version specification is non-standard on windows
PY: 39-x64
INSTALL_GITANNEX: git-annex -m datalad/packages
Expand All @@ -114,11 +114,12 @@ environment:

# MacOS core tests
- job_name: test-mac
APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey
APPVEYOR_BUILD_WORKER_IMAGE: macos-sonoma
PY: 3.8
INSTALL_GITANNEX: git-annex
DATALAD_LOCATIONS_SOCKETS: /Users/appveyor/DLTMP/sockets
CODECOV_BINARY: https://uploader.codecov.io/latest/macos/codecov
# codecov is broken: https://github.com/codecov/feedback/issues/141
#CODECOV_BINARY: https://uploader.codecov.io/latest/macos/codecov
#DATALAD_TESTS_SSH: 1
# no docker on Mac, we log into self
# 'test_publish_target_url' relies git-annex being installed on the
Expand Down Expand Up @@ -228,10 +229,10 @@ for:
- hatch test --cover --doctest-modules

after_test:
- python -m coverage xml
- "curl -Os $CODECOV_BINARY"
- chmod +x codecov
- ./codecov
- |
[ -n "$CODECOV_BINARY"] \
&& (python -m coverage xml && curl -Os "$CODECOV_BINARY" && chmod +x codecov && ./codecov) \
|| true

on_finish:
# conditionally block the exit of a CI run for direct debugging
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ dist/
docs/generated
docs/_build
*.swp
datasalad/_version.py
44 changes: 32 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,32 @@

## Developer cheat sheet

[Hatch](https://hatch.pypa.io) is used for packaging and development tasks.
Here are a few pointers. For full detail, see the hatch docs.
[Hatch](https://hatch.pypa.io) is used as a convenience solution for packaging and development tasks.
Hatch takes care of managing dependencies and environments, including the Python interpreter itself.
If not installed yet, installing via [pipx](https://github.com/pypa/pipx) is recommended (`pipx install hatch`).

### Run the tests
Below is a list of some provided convenience commands.
An accurate overview of provided convenience scripts can be obtained by running: `hatch env show`.
All command setup can be found in `pyproject.toml`, and given alternatively managed dependencies, all commands can also be used without `hatch`.

### Run the tests (with coverage reporting)

```
hatch test [--cover]
```

There is also a setup for matrix test runs, covering all current Python versions:

```
hatch run tests:run [<select tests>]
```

This can also be used to run tests for a specific Python version only:

```
hatch run tests.py3.10:run [<select tests>]
```

### Build the HTML documentation (under `docs/_build/html`)

```
Expand All @@ -31,26 +48,28 @@ hatch run docs:clean
hatch run types:check
```

### Check the `datasalad` version
### Check commit messages for compliance with [Conventional Commits](https://www.conventionalcommits.org)

```
hatch run cz:check-commits
```

`hatch` determines the version from the VCS tags. This can help check that
things are correct without having to build a release.
### Show would-be auto-generated changelog for the next release

```
hatch version
hatch run cz:show-changelog
```

### Create a new release

```
cz bump --changelog
hatch run cz:bump-version
```

The new version is determined automatically from the nature of the commits
made since the last release. A changelog is generated and committed.
The new version is determined automatically from the nature of the (conventional) commits made since the last release.
A changelog is generated and committed.

In cases where the generated changelog needs to be edited afterwards (typos,
unnecessary complexity, etc.), the created version tag needs to be advanced.
In cases where the generated changelog needs to be edited afterwards (typos, unnecessary complexity, etc.), the created version tag needs to be advanced.


### Build a new source package and wheel
Expand All @@ -65,6 +84,7 @@ hatch build
hatch publish
```


## When should I consider a contribution to `datasalad`?

This project's main purpose is to be a core library for DataLad.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,5 @@ Developers are advised to never reuse any components with names starting with
## Contributing

Contributions to this library are welcome! Please see the [contributing
guidelines](CONTRIBUTING.md) for details on scope on styles of potential
guidelines](CONTRIBUTING.md) for details on scope and style of potential
contributions.
5 changes: 5 additions & 0 deletions datasalad/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from datasalad._version import __version__

__all__ = [
'__version__',
]
2 changes: 1 addition & 1 deletion datasalad/runners/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""High-level utilties for execution of subprocesses
"""High-level utilities for execution of subprocesses

This module provides relevant components for subprocess execution.
Execution errors are communicated with the
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Why ``datasalad``?

This is a base library for DataLad, hence the name ``Data-sa-Lad``. The ``sa``
might stand for "support assemblage", or "smart assets". More importantly, the
library is a mixture of more-or-less standalone utilties that "make up the
library is a mixture of more-or-less standalone utilities that "make up the
salad".

After ~10 years of developing DataLad, these utilities have been factored out
Expand Down
66 changes: 65 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,16 @@ maintainers = [
]
classifiers = [
"License :: OSI Approved :: MIT License",
"Development Status :: 3 - Alpha",
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: End Users/Desktop",
"Natural Language :: English",
"Operating System :: OS Independent",
"Topic :: Software Development",
"Topic :: Software Development :: Version Control",
"Topic :: Software Development :: Version Control :: Git",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand All @@ -50,6 +57,16 @@ Changelog = "https://github.com/datalad/datasalad/blob/main/CHANGELOG.md"
[tool.hatch.version]
source = "vcs"

[tool.hatch.build.hooks.vcs]
version-file = "datasalad/_version.py"

[tool.hatch.build.targets.sdist]
exclude = [
".github",
"tools",
"docs/build",
]

[tool.hatch.envs.hatch-test]
default-args = ["datasalad"]
extra-dependencies = [
Expand All @@ -61,7 +78,19 @@ extra-dependencies = [
"pytest-cov",
]

[tool.hatch.envs.tests]
description = "run tests across Python versions"
template = "hatch-test"

[[tool.hatch.envs.tests.matrix]]
python = ["3.9", "3.10", "3.11", "3.12"]

[tool.hatch.envs.tests.scripts]
run = 'python -m pytest {args}'


[tool.hatch.envs.types]
description = "type checking with MyPy"
extra-dependencies = [
"mypy>=1.0.0",
"pytest",
Expand All @@ -75,6 +104,7 @@ check = [
]

[tool.hatch.envs.docs]
description = "build Sphinx-based docs"
extra-dependencies = [
"sphinx",
]
Expand All @@ -87,6 +117,40 @@ clean = [
"make -C docs clean",
]

[tool.hatch.envs.cz]
description = "commit compliance, changelog, and release generation"
detached = true
extra-dependencies = [
"commitizen",
]
[tool.hatch.envs.cz.scripts]
#check-commits = [
# # check all commit messages since the (before) beginning
# "cz check --rev-range 4b825dc642cb6eb9a060e54bf8d69288fbee4904..HEAD",
#]
show-changelog = [
# show the would-be changelog on stdout
"cz changelog --dry-run",
]
bump-version = [
# bump version (also tags) and update changelog
"cz bump --changelog",
]

[tool.hatch.envs.codespell]
description = "spell checking"
detached = true
extra-dependencies = [
"codespell",
]
[tool.hatch.envs.codespell.scripts]
check = "codespell"
fix = "codespell --write-changes"

[tool.codespell]
skip = ".git,build,.*cache,dist,./docs/_build/*"
#exclude-file = ".codespell-exclude"


[tool.coverage.run]
source_pkgs = ["datasalad", "tests"]
Expand Down