Skip to content

Commit

Permalink
Merge pull request #151 from eirrgang/149-versioningit
Browse files Browse the repository at this point in the history
Migrate from versioneer to versioningit
  • Loading branch information
Lnaden committed Aug 18, 2022
2 parents 13fd549 + e1e1f4a commit 3288929
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 2,389 deletions.
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ remove deployment platforms, or test with a different suite.
* Basic testing structure with [PyTest](https://docs.pytest.org/en/latest/)
* Automatic `git` initialization + tag
* GitHub Hooks
* Automatic package version control with [Versioneer](https://github.com/warner/python-versioneer)
* Automatic package version control with [Versioningit](https://versioningit.readthedocs.io/en/stable/)
* Sample data inclusion with packaging instructions
* Basic documentation structure powered by [Sphinx](http://www.sphinx-doc.org/en/master/)
* Automatic license file inclusion from several common Open Source licenses (optional)
Expand Down Expand Up @@ -188,13 +188,13 @@ which contains instructions for Python on how to install your package.
Each of the options in the file are commented with what it does and when it should be
used.

### Versioneer
Versioneer automatically provides a version string based on the `git` tag and
commit hash which is exposed through a `project.__version__` attribute in your
### Versioningit
Versioninggit automatically provides a version string based on the `git` tag and
commit hash, which is then exposed through a `project.__version__` attribute in your
`project/__init__.py`. For example, if you mint a tag (a release) for a project
through `git tag -a 0.1 -m "Release 0.1."` (push to GitHub through `git push
origin 0.1`), this tag will then reflect in your project: `project.__version__
== 0.1`. Otherwise a per-commit version is available which looks like
== 0.1`. Otherwise, a per-commit version is available which looks like
`0.3.0+81.g332bfc1`. This string shows the current git (the "g") hash `332bfc1`
is 81 commits beyond the version 0.3 tag.

Expand Down Expand Up @@ -262,7 +262,7 @@ but we recommend letting others handle (and help you) with deployment.
These are meant to serve as guides to help you get started.

Deployment should not get in the way of testing. You could configure the GitHub Action scripts
to handle the build stage after the test stage, but this is should only be done by advanced
to handle the build stage after the test stage, but this should only be done by advanced
users or those looking to deploy themselves.


Expand Down Expand Up @@ -314,7 +314,7 @@ upon setup.
├── {{repo_name}} <- Basic Python Package import file
│ ├── {{first_module_name}}.py <- Starting packge module
│ ├── __init__.py <- Basic Python Package import file
│ ├── _version.py <- Automatic version control with Versioneer
│ ├── _version.py <- Version control with Versioningit (generated during packaging)
│ ├── data <- Sample additional data (non-code) which can be packaged. Just an example, delete in production
│ │   ├── README.md
│ │   └── look_and_say.dat
Expand Down Expand Up @@ -346,8 +346,6 @@ upon setup.
├── pyproject.toml <- Generic Python build system configuration (PEP-517).
├── readthedocs.yml
├── setup.cfg <- Near-master config file to make house INI-like settings for Coverage, Flake8, YAPF, etc.
├── setup.py <- Your package's setup file for installing with additional options that can be set
├── versioneer.py <- Automatic version control with Versioneer
├── .codecov.yml <- Codecov config to help reduce its verbosity to more reasonable levels
├── .github <- GitHub hooks for user contribution, pull request guides and GitHub Actions CI
│   ├── CONTRIBUTING.md
Expand Down
2 changes: 1 addition & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
],

"include_ReadTheDocs": ["y", "n"],
"_cms_cc_version": 1.7
"_cms_cc_version": 1.8
}
14 changes: 10 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,18 @@ Features
* Basic testing structure with `PyTest <https://docs.pytest.org/en/latest/>`_
* Automatic ``git`` initialization + tag
* GitHub Hooks
* Automatic package version control with `Versioneer <https://github.com/warner/python-versioneer>`_
* Automatic package version control with `Versioningit <https://versioningit.readthedocs.io/>`_
* Sample data inclusion with packaging instructions
* Basic documentation structure powered by `Sphinx <http://www.sphinx-doc.org/en/master/>`_
* Automatic license file inclusion from several common Open Source licenses (optional)

.. versionchanged:: 1.7
Added support for :pep:`517` and :pep:`561`.

.. versionchanged:: 1.8
Switch from Versioneer to Versioningit for :pep:`517`-only builds.
``setup.py`` file is no longer generated.

Requirements
------------

Expand Down Expand Up @@ -125,11 +129,13 @@ documentation yourself through `Sphinx <http://www.sphinx-doc.org/en/master/usag
publish the documentation for you. The initial skeleton of the documentation can be found in the ``docs`` folder
of your output.

Additional Python Settings in ``setup.cfg``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Additional Python Settings in ``setup.cfg`` and ``pyproject.toml``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This Cookiecutter generates the package, but there are a several package-specific Python settings you can tune to your
package's installation needs. These are settings in the ``setup.cfg`` file which contains instructions for Python on
package's installation needs.
These are settings in :file:`setup.cfg` and :file:`pyproject.toml`,
which contain instructions for Python on
how to install your package. Each of the options in the file are commented with what it does and when it should be
used.

Expand Down
3 changes: 3 additions & 0 deletions {{cookiecutter.repo_name}}/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,6 @@ ENV/
# profraw files from LLVM? Unclear exactly what triggers this
# There are reports this comes from LLVM profiling, but also Xcode 9.
*profraw

# In-tree generated files
*/_version.py
1 change: 0 additions & 1 deletion {{cookiecutter.repo_name}}/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
include CODE_OF_CONDUCT.md
include versioneer.py

global-exclude *.py[cod] __pycache__ *.so
20 changes: 19 additions & 1 deletion {{cookiecutter.repo_name}}/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
[build-system]
requires = ["setuptools>=42.0", "wheel"]
requires = ["setuptools>=42.0", "wheel", "versioningit~=2.0"]
build-backend = "setuptools.build_meta"

[tool.versioningit]
default-version = "1+unknown"

[tool.versioningit.format]
distance = "{base_version}+{distance}.{vcs}{rev}"
dirty = "{base_version}+{distance}.{vcs}{rev}.dirty"
distance-dirty = "{base_version}+{distance}.{vcs}{rev}.dirty"

[tool.versioningit.vcs]
# The method key:
method = "git" # <- The method name
# Parameters to pass to the method:
match = ["*"]
default-tag = "1.0.0"

[tool.versioningit.write]
file = "{{cookiecutter.repo_name}}/_version.py"
8 changes: 0 additions & 8 deletions {{cookiecutter.repo_name}}/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,5 @@ USE_TABS = False
# Flake8, PyFlakes, etc
max-line-length = 119

[versioneer]
# Automatic version numbering scheme
VCS = git
style = pep440
versionfile_source = {{cookiecutter.repo_name}}/_version.py
versionfile_build = {{cookiecutter.repo_name}}/_version.py
tag_prefix = ''

[aliases]
test = pytest
17 changes: 0 additions & 17 deletions {{cookiecutter.repo_name}}/setup.py

This file was deleted.

0 comments on commit 3288929

Please sign in to comment.