Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI

on:
push:
branches: [master]
pull_request:
workflow_dispatch:

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
name: Lint (ruff)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v8.2.0
with:
enable-cache: true
- name: Install dependencies
run: uv sync --frozen
- name: Ruff check
run: uv run ruff check procountor tests
- name: Mypy
run: uv run mypy procountor

test:
name: Test (py${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v8.2.0
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync
- name: Run tests
run: uv run pytest -q --cov=procountor --cov-report=term-missing
78 changes: 46 additions & 32 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,55 @@
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
name: Publish to PyPI

on:
push:
tags:
- 'v*'

jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
build:
name: Build distributions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v8.2.0
with:
enable-cache: true
- name: Build sdist and wheel
run: uv build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/

publish-testpypi:
name: Publish to TestPyPI
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
skip-existing: true

- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
publish-pypi:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
skip-existing: true
12 changes: 0 additions & 12 deletions .pyup.yml

This file was deleted.

16 changes: 12 additions & 4 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@
Credits
=======

Development Lead
----------------
Maintainer
----------

* Tero Kotti <tero@vilkas.fi>
* Tatu Wikman <tatu@vilkas.fi>

Previous Maintainers
--------------------

With thanks for creating and growing this library:

* Tero Kotti
* Joonas Maliniemi

Contributors
------------

None yet. Why not be the first?
Want to see your name here? Contributions are welcome — see ``CONTRIBUTING.rst``.
47 changes: 24 additions & 23 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,25 +64,23 @@ Ready to contribute? Here's how to set up `Procountor` for local development.

$ git clone git@github.com:vilkasgroup/Procountor.git

3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development::
3. Install your local copy with `uv <https://docs.astral.sh/uv/>`_, which
creates the virtual environment for you::

$ mkvirtualenv Procountor
$ cd Procountor/
$ python setup.py develop
$ uv sync

4. Create a branch for local development::

$ git checkout -b name-of-your-bugfix-or-feature

Now you can make your changes locally.

5. When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox::
5. When you're done making changes, check that your changes pass the linter and
the tests::

$ flake8 procountor tests
$ python setup.py test or py.test
$ tox

To get flake8 and tox, just pip install them into your virtualenv.
$ uv run ruff check procountor tests
$ uv run pytest

6. Commit your changes and push your branch to GitHub::

Expand All @@ -101,34 +99,37 @@ Before you submit a pull request, check that it meets these guidelines:
2. If the pull request adds functionality, the docs should be updated. Put
your new functionality into a function with a docstring, and add the
feature to the list in README.rst.
3. The pull request should work for Python 2.7 and 3.6, and for PyPy. Check
https://travis-ci.org/vilkasgroup/Procountor/pull_requests
and make sure that the tests pass for all supported Python versions.
3. The pull request should work for all supported Python versions (3.9+).
The GitHub Actions CI workflow runs the linter and the test matrix on every
pull request; make sure it is green.

Tips
----

To run a subset of tests::

$ python -m unittest tests.test_client
$ uv run pytest tests/test_900_unit_client.py


Releasing new version
---------------------

When you are ready to release a new version follow these steps:

1. Merge all changes that should be included in the new release to master.
And checkout master.
2. Update HISTORY.rst with the new version number and changes. And commit your
changes to master.
3. run::
1. Merge all changes that should be included in the new release to master, and
check out master.
2. Update ``HISTORY.rst`` with the new version number and the changes, then
commit it.
3. Bump the version. This updates ``procountor/__init__.py`` and
``pyproject.toml``, creates a commit and creates an annotated ``v<version>``
tag::

$ bumpversion patch|minor|major
$ uv run bump-my-version bump patch|minor|major

4. push to master with tags to trigger travis deploy::
4. Push the commit and the tag. ``--follow-tags`` sends both at once (a plain
``git push`` would not push the tag)::

$ git push --tags
$ git push
$ git push --follow-tags

Travis will build the tag and when it is successfull will also deploy to pypi
Pushing the ``v<version>`` tag triggers the publish workflow, which builds the
distributions and, when successful, uploads them to PyPI.
50 changes: 50 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,56 @@
History
=======

Unreleased
----------

* **Fixed**: eight write methods (``update_company``, ``update_user``,
``update_business_partner``, ``update_dimension``, ``create_dimension_item``,
``update_dimension_item``, ``post_payment`` and
``payments_direct_bank_transfers``) passed the request body into the
``headers`` argument, so no JSON body was ever sent. They now forward the body
correctly. This changes what these methods send on the wire.
* Added generic ``get``, ``post``, ``put`` and ``delete`` verbs so any
Procountor endpoint can be called without a dedicated helper (the named
helpers cover only part of the large API surface). ``request`` now also
accepts an explicit ``json`` body, allowing top-level JSON array payloads.
The named helper methods are now thin wrappers over these verbs (no
behavioural change to what they send).
* **Changed**: ``update_dimension`` now takes a ``dimensionId`` argument and
targets ``PUT /dimensions/{dimensionId}``. The previous ``PUT /dimensions``
endpoint was removed by Procountor (around version 25.11).
* **Deprecated**: ``pay_invoice`` and ``send_one_time_pass`` now emit a
``DeprecationWarning``; their endpoints no longer exist in the current
Procountor API.
* **Fixed**: ``get_payments`` queried the ``invoices`` endpoint instead of
``payments``.
* **Fixed**: ``get_invoice_paymentevents`` sent its arguments as a JSON body on
a GET request; they are query parameters (``previousId``, ``orderById``,
``size``, ``page``) and are now sent as such.
* **Fixed**: ``create_dimension_item``, ``update_dimension_item`` and
``confirm_invoice`` produced URLs with a double slash because of a leading
slash in the endpoint path.
* Added type hints throughout the package and a ``py.typed`` marker so the
types are exposed to downstream users. The client is now split into a
``BaseClient`` (HTTP transport) and the ``ApiMethods`` endpoint helpers;
``procountor.client.Client`` and all of its methods are unchanged.
* ``Client`` is now importable directly from the top-level package
(``from procountor import Client``).
* Project tooling modernized:

* Migrated packaging from ``setup.py``/``setup.cfg`` to ``pyproject.toml``
(PEP 621, hatchling build backend) and adopted ``uv`` for dependency and
environment management. Removed ``Pipfile``/``Pipfile.lock``,
``requirements.txt``, ``tox.ini`` and the dead ``.pyup.yml``.
* Dropped Python 2 support; now requires Python 3.9+.
* Refreshed dependencies so transitive packages (urllib3, etc.) resolve to
current, non-vulnerable versions.
* Added an offline unit-test suite. The live integration tests now skip by
default and only run with ``PROCOUNTOR_RUN_INTEGRATION=1`` and credentials.
* Added a GitHub Actions CI workflow (ruff lint + pytest matrix on Python
3.9–3.13) and modernized the PyPI publish workflow to build with ``uv``.
* Added the previously empty ``LICENSE`` (MIT) file.

2.5.0 (2025-07-31)
------------------

Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Vilkas Group Oy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
11 changes: 0 additions & 11 deletions MANIFEST.in

This file was deleted.

16 changes: 0 additions & 16 deletions Pipfile

This file was deleted.

Loading