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

New build system #243

Merged
merged 44 commits into from May 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
f6544d9
new implementation of parsing and serialization
N-Coder Mar 29, 2020
8466e3a
fixed Timespan end/due extra param handling and further small issues
N-Coder Mar 29, 2020
b05ce7d
ensure that event modifications times are in UTC
N-Coder Mar 29, 2020
dc8923c
pass params and context to ValueConverter for timezone handling
N-Coder Apr 4, 2020
eae493d
rename Event.name to the RFC compliant summary
N-Coder Apr 4, 2020
537823d
make mypy happy with ExtraParams and EmptyParams and their defaults
N-Coder Apr 4, 2020
827088e
warn when a modification of EmptyDictType is attempted
N-Coder Apr 4, 2020
f846543
bring back __str__ and fix doctests
N-Coder Apr 5, 2020
3cafe53
make zip safe using importlib_resources
N-Coder Apr 6, 2020
e44e4b3
improved handling of escaped strings, testing
N-Coder Apr 10, 2020
c79fd0b
fix handling of quoted params
N-Coder Apr 10, 2020
aeb575e
migrate repo structure to poetry
N-Coder Apr 10, 2020
92e8a9e
fix src path for pytest
N-Coder Apr 10, 2020
5a4e681
add doc skeleton
N-Coder Apr 10, 2020
f608e0c
implement handling of attachments
N-Coder Apr 10, 2020
f5c6a16
import project files
N-Coder Apr 10, 2020
19b058f
set version
N-Coder Apr 10, 2020
6166169
fix sphinx build with poetry
N-Coder Apr 10, 2020
00cd53c
don't use poetry within tox
N-Coder Apr 10, 2020
03d9ffa
fix timezone tests
N-Coder Apr 10, 2020
7b4ec8e
change coveralls action
N-Coder Apr 10, 2020
7d76bec
try codecov
N-Coder Apr 10, 2020
b9e6ab9
bugfixes
N-Coder Apr 11, 2020
03c549c
add bumpversion
N-Coder Apr 11, 2020
20bade0
Bump version: 0.8.0-dev → 0.8.0
N-Coder Apr 11, 2020
9fb5bdf
Bump version: 0.8.0 → 0.9.0-dev
N-Coder Apr 11, 2020
07a2577
Bump version: 0.9.0-dev → 0.9.0
N-Coder Apr 11, 2020
aab3444
separate src inspection (flake8+mypy src/) from package testing (pyte…
N-Coder Apr 11, 2020
c7f193d
bugfixes
N-Coder Apr 11, 2020
109f1ad
Bump version: 0.9.0 → 0.9.1
N-Coder Apr 11, 2020
4e7b553
Bump version: 0.9.1 → 0.9.2-dev
N-Coder Apr 11, 2020
6673720
Merge branch 'master' into new-parser-impl
N-Coder Apr 11, 2020
281c9f6
remove old files
N-Coder Apr 11, 2020
3365faf
add dev and publish instructions
N-Coder Apr 12, 2020
aa0447e
checker happiness
N-Coder Apr 12, 2020
83bda5c
more checker happiness
N-Coder Apr 12, 2020
4927e0f
Apply suggestions from code review
N-Coder Apr 21, 2020
eff8add
use gitignore directly from github instead of gitignore.io
N-Coder Apr 22, 2020
6c4169a
Apply suggestions from code review to tox.ini
N-Coder Apr 22, 2020
547b241
fix tox.ini
N-Coder Apr 22, 2020
9bc16c5
add pypy support
N-Coder May 10, 2020
28848f8
update developing documentation
N-Coder May 10, 2020
5519b7a
fix non-ASCII whitespace handling
N-Coder May 11, 2020
fdb9aa2
update test/dev dependencies
N-Coder May 16, 2020
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
@@ -0,0 +1,23 @@
[bumpversion]
N-Coder marked this conversation as resolved.
Show resolved Hide resolved
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
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
@@ -1,45 +1,142 @@
# Compiled python modules.
N-Coder marked this conversation as resolved.
Show resolved Hide resolved
*.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
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
@@ -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