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

squash and merge #240 and #243 #246

Merged
merged 2 commits into from
May 22, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 23 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[bumpversion]
current_version = 0.8.0-dev
commit = True
tag = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)-?(?P<release>dev)?
serialize =
{major}.{minor}.{patch}-{release}
{major}.{minor}.{patch}

[bumpversion:file:pyproject.toml]

[bumpversion:file:src/ics/__init__.py]

[bumpversion:file:doc/event.rst]

[bumpversion:file:README.rst]

[bumpversion:part:release]
values =
dev
release
optional_value = release

2 changes: 0 additions & 2 deletions .coveragerc

This file was deleted.

20 changes: 10 additions & 10 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jobs:
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools
pip install -r requirements.txt -r dev/requirements-test.txt
- name: Static checking with mypy
run: |
mypy ics
- name: Run pytest
run: |
python setup.py test
- name: Report timezone information
run: python -c "import time; print((time.timezone, time.altzone, time.daylight, time.tzname, time.time()))"
- name: Install tox
run: python -m pip install --upgrade tox tox-gh-actions
- name: Run tox
run: tox
- name: Publish coverage
run:
rm -rf ./.mypy_cache/;
bash <(curl https://codecov.io/bash)
171 changes: 134 additions & 37 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,45 +1,142 @@
# Compiled python modules.
*.pyc
/.idea
/venv
/.venv

# Setuptools distribution folder.
dist/
build/
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Python egg metadata, regenerated from source files by setuptools.
/*.egg-info
/*.egg
# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Virtualenvs
ve
ve3

bin
include
lib
local
venv
venv3
/bin
/include/
/lib/

# doc builds
doc/_build/*

#tests
.cache/
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
htmlcov
.pytest_cache
/.pytest_cache/
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# IDE settings
/.idea/
# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# pffff
.idea
pip-selfcheck.json
/pip-selfcheck.json
share
# Cython debug symbols
cython_debug/
122 changes: 118 additions & 4 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ How to submit an issue

Please include the following in your bug reports:

* the version of ics.py you are using; run ``pip freeze | grep ics``
* the version of Python ``python -v``
* the version of ics.py you are using; run :command:`pip freeze | grep ics`
* the version of Python :command:`python -v`
* the OS you are using

Please also include a (preferably minimal) example of the code or
Expand All @@ -33,6 +33,76 @@ you are solving it. This might save you a lot of time if the maintainers
are already working on it or have a specific idea on how the problem should
be solved.

Setting up the Development Environment
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

There are three Python tools required to develop, test, and release ics.py:

* `poetry <https://python-poetry.org/>`_ for managing virtualenvs, dependencies, building, and publishing the package.
* `tox <https://tox.readthedocs.io/>`_ for running the testsuite and building the documentation.
* `bump2version <https://pypi.org/project/bump2version/>`_ to help with making a release.

Their respective configuration files are :file:`pyproject.toml`, :file:`tox.ini` and :file:`.bumpversion.cfg`.
Install the tools via pip:

.. code-block:: bash

$ pip install tox poetry bump2version --user

.. note::
If you want to develop using multiple different Python versions, you might want to consider the
`poetry installer <https://python-poetry.org/docs/#installation>`_.

Poetry will automatically manage a virtualenv that you can use for developing.
By default, it will be located centrally in your home directory (e.g. in :file:`/home/user/.cache/pypoetry/virtualenvs/`).
To make poetry use a :file:`./.venv/` directory within the ics.py folder, use the following config:

.. code-block:: bash

$ poetry config virtualenvs.in-project true

Now you are ready to setup your development environment using the following command:

.. code-block:: bash

$ poetry install

This will create a new virtualenv and install the dependencies for using ics.py.
Furthermore, the current source of the ics.py package will be available similar to running :command:`./setup.py develop`.
To access the virtualenv, use :command:`poetry run python` or :command:`poetry shell`.
The :file:`poetry.lock` file locks the versions of dependencies in the development environment set up by poetry. This ensures that such an environment is the same for everyone.
The file :file:`poetry.lock` is only read by poetry and not included in any distributions. These restrictions don't apply when running :command:`pip install ics`.
As tox manages its own environments and doesn't read the lock file, it installs the latest versions of dependencies for testing.
More details on the poetry side can be found in the `poetry documentation <https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control>`_.

If you made some changes and now want to lint your code, run the testsuite, or build the documentation, run tox.
You don't have to worry about which versions in which venvs are installed and whether you're directly testing against the sources or against a built package, tox handles all that for you:

.. code-block:: bash

$ tox

To run a single task and not the whole testsuite, use the ``-e`` flag:

.. code-block:: bash

$ tox -e docs

To get a list of all available tasks, run :command:`tox -av`.

.. note::
If you want to run any tasks of tox manually, make sure you have all the dependencies of the task listed in :file:`tox.ini`.
For testing with pytest, this can be done through poetry by installing the ``test`` extra: :command:`poetry install -E test`.
Alternatively, you can also let tox `set up <https://tox.readthedocs.io/en/latest/example/devenv.html#creating-development-environments-using-the-devenv-option>`_ your development environment or re-use one of its test environments:

.. code-block:: bash

$ tox -e py38
$ source .tox/py38/bin/activate
(py38) $ pytest

This also works without having poetry installed.

If you are fixing a bug
^^^^^^^^^^^^^^^^^^^^^^^

Expand All @@ -55,8 +125,8 @@ We will ask you to provide:
Last thing
^^^^^^^^^^

* Please add yourself to ``AUTHORS.rst``
* and state your changes in ``CHANGELOG.rst``.
* Please add yourself to :file:`AUTHORS.rst`
* and state your changes in :file:`CHANGELOG.rst`.

.. note::
Your PR will most likely be squashed in a single commit, authored
Expand All @@ -66,3 +136,47 @@ Last thing

The title of your PR will become the commit message, please craft it
with care.

How to make a new release
-------------------------

If you want to publish a new release, use the following steps

.. code-block:: bash

# Grab the sources and install the dev tools
git clone https://github.com/C4ptainCrunch/ics.py.git && cd ics.py
pip install tox poetry bump2version --user

# Make sure all the test run
tox && echo "Ready to make a new release" \
|| echo "Please fix all the tests first"

# Bump the version and make a "0.8.0-dev -> 0.8.0 (release)" commit
bump2version --verbose release
# Build the package
poetry build
# Ensure that the version numbers are consistent
tox --recreate
# Check changelog and amend if necessary
vi CHANGELOG.rst && git commit -i CHANGELOG.rst --amend
# Publish to GitHub
git push && git push --tags
# Publish to PyPi
poetry publish

# Bump the version again to start development of next version
bump2version --verbose minor # 0.8.0 (release) -> 0.9.0-dev
# Start new changelog
vi CHANGELOG.rst && git commit -i CHANGELOG.rst --amend
# Publish to GitHub
git push && git push --tags

Please note that bump2version directly makes a commit with the new version if you don't
pass ``--no-commit`` or ``--dry-run``,
but that's no problem as you can easily amend any changes you want to make.
Further things to check:

* Check GitHub and PyPi release pages for obvious errors
* Build documentation for the tag v{version} on rtfd.org
* Set the default rtfd version to {version}
11 changes: 0 additions & 11 deletions MANIFEST.in

This file was deleted.

4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Ics.py : iCalendar for Humans
=============================
ics.py `0.8.0-dev` : iCalendar for Humans
=========================================

`Original repository <https://github.com/C4ptainCrunch/ics.py>`_ (GitHub) -
`Bugtracker and issues <https://github.com/C4ptainCrunch/ics.py/issues>`_ (GitHub) -
Expand Down