-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add __version__ * add ccds.__version__ * add make dist * add release.yml * update python version * add publish to pypi * use currently released version by default * Update README and docs * find the index of the checkout branch parameter in cookiecutter by using its parameter name rather than a fixed index * update readme with accurate version info * add releasing instructions, fix version string for default tag download * Apply suggestions from code review Documentation changes Co-authored-by: Robert Gibboni <[email protected]> * add deprecation warning if running <2.0.1 that the user is always pulling the latest template version * lint * Update hooks/pre_prompt.py Co-authored-by: Robert Gibboni <[email protected]> * update warning string [skip ci] --------- Co-authored-by: Chris Kucharczyk <[email protected]> Co-authored-by: Chris Kucharczyk <[email protected]> Co-authored-by: Robert Gibboni <[email protected]>
- Loading branch information
1 parent
041d6ca
commit 34ecc48
Showing
11 changed files
with
138 additions
and
5 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,52 @@ | ||
name: release | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
build: | ||
name: Build and publish new release | ||
runs-on: "ubuntu-latest" | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r dev-requirements.txt | ||
- name: Check that versions match | ||
id: version | ||
run: | | ||
echo "Release tag: [${{ github.event.release.tag_name }}]" | ||
PACKAGE_VERSION=$(python -c "import ccds; print(ccds.__version__)") | ||
echo "Package version: [$PACKAGE_VERSION]" | ||
[ ${{ github.event.release.tag_name }} == "v$PACKAGE_VERSION" ] || { exit 1; } | ||
echo "::set-output name=major_minor_version::v${PACKAGE_VERSION%.*}" | ||
- name: Build package | ||
run: | | ||
make dist | ||
- name: Publish to Test PyPI | ||
uses: pypa/[email protected] | ||
with: | ||
user: ${{ secrets.PYPI_TEST_USERNAME }} | ||
password: ${{ secrets.PYPI_TEST_PASSWORD }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
skip_existing: true | ||
|
||
- name: Publish to Production PyPI | ||
uses: pypa/[email protected] | ||
with: | ||
user: ${{ secrets.PYPI_PROD_USERNAME }} | ||
password: ${{ secrets.PYPI_PROD_PASSWORD }} | ||
skip_existing: false |
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
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,11 @@ | ||
# Information for releases and versioning of ccds | ||
|
||
## Background | ||
|
||
The release of [ccds v2](https://drivendata.co/blog/ccds-v2) introduced the `ccds` utility and the concept of versioning to cookiecutter data science. Prior to this release, cookiecutter-data-science only provided a project template, which the generic [cookiecutter](https://github.com/cookiecutter/cookiecutter) utility could use to instantiate a project. Branches and forks could be used in the usual way to get different versions of the template. | ||
|
||
To give the utility and the template a bit more stability, PR [#336](https://github.com/drivendataorg/cookiecutter-data-science/pull/336) created automated release mechanics for publishing new releases and, by default, pinned the template used by the `ccds` utility to the installed version. | ||
|
||
## Issuing a new release | ||
|
||
`ccds` uses [semantic versioning](https://semver.org/). When issuing a new release, **ensure that your release version tag has the format `vMAJOR.MINOR.PATCH`. The `v` prefix is important because the utility will look for the tag with that name to download by default. |
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,3 @@ | ||
from ccds.version import __version__ | ||
|
||
__version__ |
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,9 @@ | ||
import sys | ||
|
||
if sys.version_info[:2] >= (3, 8): | ||
import importlib.metadata as importlib_metadata | ||
else: | ||
import importlib_metadata | ||
|
||
|
||
__version__ = importlib_metadata.version("cookiecutter-data-science") |
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 was deleted.
Oops, something went wrong.
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,13 @@ | ||
import warnings | ||
|
||
from ccds.version import __version__ as version | ||
|
||
if __name__ == "__main__": | ||
if version < "2.0.1": | ||
warnings.warn( | ||
"You're currently using a CCDS version that always applies the " | ||
"newest template. For more stable behavior, upgrade to " | ||
"CCDS version 2.0.1 or later with your package manager. " | ||
"For example, with pip, run: pip install -U cookiecutter-data-science.", | ||
DeprecationWarning, | ||
) |