-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from jasongrout/packaging
Update packaging to use more modern python practices
- Loading branch information
Showing
11 changed files
with
103 additions
and
90 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
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 |
---|---|---|
@@ -1,23 +1,53 @@ | ||
- To release a new version of {{ cookiecutter.python_package_name }} on PyPI: | ||
# Release | ||
|
||
Update _version.py (set release version, remove 'dev') | ||
git add the _version.py file and git commit | ||
`python setup.py sdist upload` | ||
`python setup.py bdist_wheel upload` | ||
`git tag -a X.X.X -m 'comment'` | ||
Update _version.py (add 'dev' and increment minor) | ||
git add and git commit | ||
git push | ||
git push --tags | ||
Before doing a release, check to see if there are any outstanding changes or untracked files: | ||
|
||
- To release a new version of {{ cookiecutter.npm_package_name }} on NPM: | ||
``` | ||
git status | ||
git clean -fdxn | ||
``` | ||
|
||
Update `js/package.json` with new npm package version | ||
Commit changes, and make sure that any untracked files can be deleted. Then clean the repository: | ||
|
||
``` | ||
# clean out the `dist` and `node_modules` directories | ||
git clean -fdx | ||
yarn | ||
yarn build:prod | ||
yarn publish | ||
git clean -fdx # actually delete untracked files | ||
``` | ||
|
||
## Javascript release | ||
|
||
To release a new version of {{ cookiecutter.npm_package_name }} on NPM, first register for an NPM account [here](https://www.npmjs.com/), then log in with `yarn login`. Then: | ||
|
||
1. Update `js/package.json` with the new npm package version | ||
2. Build and publish the npm package inside the `js/` directory: | ||
|
||
``` | ||
cd js/ | ||
yarn install | ||
yarn publish | ||
cd .. | ||
``` | ||
|
||
## Python release | ||
|
||
To release a new version of {{ cookiecutter.python_package_name }} on PyPI, first make sure that the `build` package is installed: `pip install build`. | ||
|
||
1. Update `{{ cookiecutter.python_package_name }}/_version.py`: | ||
- Update `__version__` | ||
- Update `NPM_PACKAGE_RANGE` if necessary | ||
2. Commit changes to `_version.py` and tag the release | ||
``` | ||
git add {{ cookiecutter.python_package_name }}/_version.py | ||
git tag -a X.X.X -m 'comment' | ||
``` | ||
3. Generate Python packages and upload to PyPI: | ||
``` | ||
python -m build | ||
twine check dist/* | ||
twine upload dist/* | ||
``` | ||
4. Update `_version.py` (add 'dev' and increment minor) | ||
``` | ||
git commit -a -m 'Back to dev' | ||
git push | ||
git push --tags | ||
``` |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[build-system] | ||
requires = ["jupyter_packaging~=0.7.9", "jupyterlab>=3.0.0,==3.*", "setuptools>=40.8.0", "wheel"] | ||
requires = ["jupyter_packaging~=0.7.9", "jupyterlab~=3.0", "setuptools>=40.8.0", "wheel"] | ||
build-backend = "setuptools.build_meta" |
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 |
---|---|---|
@@ -1,2 +1,35 @@ | ||
[bdist_wheel] | ||
universal=1 | ||
[metadata] | ||
name = {{ cookiecutter.python_package_name }} | ||
author = {{ cookiecutter.author_name }} | ||
author_email={{ cookiecutter.author_email }} | ||
version = attr: {{ cookiecutter.python_package_name }}._version.__version__ | ||
description = {{ cookiecutter.project_short_description }} | ||
long_description = file: README.md | ||
long_description_content_type = text/markdown | ||
url = https://github.com/{{ cookiecutter.github_organization_name }}/{{ cookiecutter.github_project_name }} | ||
keywords = ipython, widgets, Jupyter, JupyterLab, JupyterLab3 | ||
license = BSD 3-Clause License | ||
classifiers = | ||
License :: OSI Approved :: BSD License | ||
Development Status :: 4 - Beta | ||
Framework :: IPython | ||
Intended Audience :: Developers | ||
Intended Audience :: Science/Research | ||
Programming Language :: Python | ||
Programming Language :: Python :: 3.7 | ||
Programming Language :: Python :: 3.8 | ||
Programming Language :: Python :: 3.9 | ||
Programming Language :: Python :: 3.10 | ||
Framework :: Jupyter | ||
Framework :: Jupyter :: JupyterLab | ||
Framework :: Jupyter :: JupyterLab :: 3 | ||
Framework :: Jupyter :: JupyterLab :: Extensions | ||
Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt | ||
|
||
[options] | ||
zip_safe = False | ||
include_package_data = True | ||
packages = find: | ||
install_requires = | ||
ipywidgets>=7.6.0,<9 | ||
python_requires = >=3.7 |
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
2 changes: 1 addition & 1 deletion
2
{{cookiecutter.github_project_name}}/{{cookiecutter.python_package_name}}/__init__.py
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from ._version import version_info, __version__ | ||
from ._version import __version__ | ||
|
||
from .example import * | ||
|
||
|
9 changes: 2 additions & 7 deletions
9
{{cookiecutter.github_project_name}}/{{cookiecutter.python_package_name}}/_version.py
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 |
---|---|---|
@@ -1,9 +1,4 @@ | ||
# Module version | ||
version_info = (0, 1, 0, 'alpha', 0) | ||
__version__ = '0.1.0a0' | ||
|
||
# Module version stage suffix map | ||
_specifier_ = {'alpha': 'a', 'beta': 'b', 'candidate': 'rc', 'final': ''} | ||
|
||
# Module version accessible using {{ cookiecutter.python_package_name }}.__version__ | ||
__version__ = '%s.%s.%s%s'%(version_info[0], version_info[1], version_info[2], | ||
'' if version_info[3]=='final' else _specifier_[version_info[3]]+str(version_info[4])) | ||
NPM_PACKAGE_RANGE='^{{ cookiecutter.npm_package_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