Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions .circleci/config.yml

This file was deleted.

17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2
updates:
# python dependencies
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
# Disable version updates for pip dependencies in deference to https://github.com/dbt-labs/dbt-core/issues/8409
# this will not affect secrity related updates
open-pull-requests-limit: 0

# github dependencies
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
rebase-strategy: "disabled"
21 changes: 21 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
resolves #

<!---
Include the number of the issue addressed by this PR above if applicable.
PRs for code changes without an associated issue *will not be merged*.
See CONTRIBUTING.md for more information.
-->

### Description

<!---
Describe the Pull Request here. Add any references and info to help reviewers
understand your changes. Include any tradeoffs you considered.
-->

### Checklist

- [ ] I have read [the contributing guide](https://github.com/dbt-labs/dbt-oss-template/blob/main/CONTRIBUTING.md) and understand what's expected of me
- [ ] I have signed the [CLA](https://docs.getdbt.com/docs/contributor-license-agreements)
- [ ] I have run this code in development and it appears to resolve the stated issue

55 changes: 55 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# **what?**
# Runs basic tests on code base

# **why?**
# Ensure code meets a certain quality standard.

# **when?**
# This will run for all PRs, when code is pushed to a release
# branch, and when manually triggered.

name: Tests

on:
push:
branches:
- "master"
pull_request:
workflow_dispatch:

permissions: read-all

# will cancel previous workflows triggered by the same event and for the same ref for PRs or same SHA otherwise
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ contains(github.event_name, 'pull_request') && github.event.pull_request.head.ref || github.sha }}
cancel-in-progress: true

defaults:
run:
shell: bash

jobs:
tests:
name: "Python 3.7 / ubuntu-latest"

runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Check out the repository
uses: actions/checkout@v4

- name: "Set up Python 3.7"
uses: actions/setup-python@v5
with:
python-version: '3.7'

- name: Install python dependencies
run: |
python -m pip install --user --upgrade pip
python -m pip --version
python -m pip install tox
tox --version

- name: Run tox
run: tox
102 changes: 102 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Contributing to `snowplow-python-tracker`

`snowplow-python-tracker` is a fork of the original Snowplow Python tracker v0.8.0.


1. [About this document](#about-this-document)
2. [Getting the code](#getting-the-code)
3. [Setting up an environment](#setting-up-an-environment)
4. [Running in development](#running-snowplow-python-tracker-in-development)
5. [Testing](#testing)
6. [Debugging](#debugging)
7. [Adding or modifying a changelog entry](#adding-or-modifying-a-changelog-entry)
8. [Submitting a Pull Request](#submitting-a-pull-request)
9. [Troubleshooting Tips](#troubleshooting-tips)

## About this document

There are many ways to contribute to the ongoing development of `snowplow-python-tracker`, such as by participating in discussions and issues. We encourage you to first read our higher-level document: ["Expectations for Open Source Contributors"](https://docs.getdbt.com/docs/contributing/oss-expectations).

The rest of this document serves as a more granular guide for contributing code changes to `snowplow-python-tracker` (this repository). It is not intended as a guide for using `snowplow-python-tracker`, and some pieces assume a level of familiarity with Python development (virtualenvs, `pip`, etc). Specific code snippets in this guide assume you are using macOS or Linux and are comfortable with the command line.

### Notes

- **CLA:** Please note that anyone contributing code to `snowplow-python-tracker` must sign the [Contributor License Agreement](https://docs.getdbt.com/docs/contributor-license-agreements). If you are unable to sign the CLA, the `snowplow-python-tracker` maintainers will unfortunately be unable to merge any of your Pull Requests. We welcome you to participate in discussions, open issues, and comment on existing ones.
- **Branches:** All pull requests from community contributors should target the `master` branch (default).
- **Releases**: This repository is released only as needed.

## Getting the code

### Installing git

You will need `git` in order to download and modify the source code.

### External contributors

If you are not a member of the `dbt-labs` GitHub organization, you can contribute to `snowplow-python-tracker` by forking the `snowplow-python-tracker` repository. For a detailed overview on forking, check out the [GitHub docs on forking](https://help.github.com/en/articles/fork-a-repo). In short, you will need to:

1. Fork the `snowplow-python-tracker` repository
2. Clone your fork locally
3. Check out a new branch for your proposed changes
4. Push changes to your fork
5. Open a pull request against `dbt-labs/snowplow-python-tracker` from your forked repository

### dbt Labs contributors

If you are a member of the `dbt-labs` GitHub organization, you will have push access to the `snowplow-python-tracker` repo. Rather than forking `snowplow-python-tracker` to make your changes, just clone the repository, check out a new branch, and push directly to that branch.

## Setting up an environment

There are some tools that will be helpful to you in developing locally. While this is the list relevant for `snowplow-python-tracker` development, many of these tools are used commonly across open-source python projects.

#### Virtual environments

We strongly recommend using virtual environments when developing code in `snowplow-python-tracker`. We recommend creating this virtualenv
in the root of the `snowplow-python-tracker` repository. To create a new virtualenv, run:
```sh
python3 -m venv env
source env/bin/activate
```

This will create and activate a new Python virtual environment.

## Running `snowplow-python-tracker` in development

### Installation

First make sure that you set up your `virtualenv` as described in [Setting up an environment](#setting-up-an-environment). Also ensure you have the latest version of pip installed with `pip install --upgrade pip`. Next, install `snowplow-python-tracker` (and its dependencies):

```sh
git
pre-commit install
```

## Testing

Once you're able to manually test that your code change is working as expected, it's important to run existing automated tests, as well as adding some new ones. These tests will ensure that:
- Your code changes do not unexpectedly break other established functionality
- Your code changes can handle all known edge cases
- The functionality you're adding will _keep_ working in the future

### Initial setup

None needed.

### Test commands

docker-compose run --rm test tox


### Assorted development tips
* This is a fork of [snowplow-python-tracker](https://github.com/snowplow/snowplow-python-tracker) and bets practices in that repository should be followed here

## Submitting a Pull Request

Code can be merged into the current development branch `main` by opening a pull request. A `snowplow-python-tracker` maintainer will review your PR. They may suggest code revision for style or clarity, or request that you add unit or integration test(s). These are good things! We believe that, with a little bit of help, anyone can contribute high-quality code.

Automated tests run via GitHub Actions. If you're a first-time contributor, all tests (including code checks and unit tests) will require a maintainer to approve. Changes in the `snowplow-python-tracker` repository trigger integration tests against Postgres. dbt Labs also provides CI environments in which to test changes to other adapters, triggered by PRs in those adapters' repositories, as well as periodic maintenance checks of each adapter in concert with the latest `snowplow-python-tracker` code changes.

Once all tests are passing and your PR has been approved, a `snowplow-python-tracker` maintainer will merge your changes into the active development branch. And that's it! Happy developing :tada:

## Troubleshooting Tips
- Sometimes, the content license agreement auto-check bot doesn't find a user's entry in its roster. If you need to force a rerun, add `@cla-bot check` in a comment on the pull request.
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
## Understanding snowplow-python-tracker

Add analytics to your Python apps and Python games with the
[Snowplow](http://snowplowanalytics.com) event tracker for
[Python](http://python.org).

With this tracker you can collect event data from your Python-based
applications, games or Python web servers/frameworks.

This is a fork of the original Snowplow Python tracker v0.8.0, with a number of changes:

- All emitters except for the basic one removed
- Tests converted to docker
- All tracking event methods except for structured/unstructured
removed
- Python 3.7 supported

## Getting started

- Read the [introduction](https://docs.getdbt.com/docs/introduction/) and [viewpoint](https://docs.getdbt.com/docs/about/viewpoint/)

## Join the dbt Community

- Be part of the conversation in the [dbt Community Slack](http://community.getdbt.com/)
- Read more on the [dbt Community Discourse](https://discourse.getdbt.com)

## Reporting bugs and contributing code

- Want to report a bug or request a feature? Let us know and open [an issue](https://github.com/dbt-labs/snowplow-python-tracker/issues/new)
- Want to help us build dbt? Check out the [Contributing Guide](https://github.com/dbt-labs/snowplow-python-tracker/blob/HEAD/CONTRIBUTING.md)

## Code of Conduct

Everyone interacting in the dbt project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [dbt Code of Conduct](https://community.getdbt.com/code-of-conduct).

# Copyright and license

The Snowplow Python Tracker is copyright 2013-2014 Snowplow Analytics
Ltd.

Licensed under the [Apache License, Version
2.0](http://www.apache.org/licenses/LICENSE-2.0) (the \"License\"); you
may not use this software except in compliance with the License.

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an \"AS IS\" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

This software has been modified by Fishtown Analytics. Changes are
copyright 2018 Fishtown Analytics LLC.
54 changes: 0 additions & 54 deletions README.rst

This file was deleted.

14 changes: 6 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
]
authors_str = ', '.join(authors_list)

this_directory = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_directory, "README.md")) as f:
long_description = f.read()

setup(
name='minimal-snowplow-tracker',
version=__version__,
Expand All @@ -56,20 +60,14 @@
url='https://www.fishtownanalytics.com',
license='Apache License 2.0',
description='A minimal snowplow event tracker for Python. Add analytics to your Python and Django apps, webapps and games',
long_description=open('README.rst').read(),
long_description=long_description,
long_description_content_type="text/markdown",

classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Operating System :: OS Independent",
],
Expand Down
11 changes: 2 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
[tox]
skipsdist = True
envlist = unit-py27, unit-py37

[testenv:unit-py27]
basepython = python2.7
commands = /bin/bash -c '$(which pytest) -v {posargs} snowplow_tracker/test'
deps =
-e {toxinidir}
-r{toxinidir}/requirements-test.txt
envlist = unit-py37

[testenv:unit-py37]
basepython = python3.7
commands = /bin/bash -c '{envpython} $(which pytest) -v {posargs} snowplow_tracker/test'
commands = {envpython} -m pytest -v {posargs} snowplow_tracker/test
deps =
-e {toxinidir}
-r{toxinidir}/requirements-test.txt