Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
363f245
Update README.md
orrison-andrew Mar 17, 2025
231eb32
Removed Incydr features,renamed Code42 values to CrashPlan ones.
orrison-andrew Mar 19, 2025
9478ab8
Modifying code owners file to add the correct team.
orrison-andrew Mar 20, 2025
16b349d
Fixing pointer to crashplan labs in code owners file
orrison-andrew Mar 20, 2025
c96fbf8
fixing case of the code owners file
orrison-andrew Mar 26, 2025
7b6f75b
changed to the crashplan-code-owners team
orrison-andrew Mar 26, 2025
98e930b
updated license file and moved files from py42 to pycpg
orrison-andrew Mar 26, 2025
fd5575e
Fixing some formatting, and updating logos
orrison-andrew Mar 26, 2025
3399e8b
Removing cla-assistant requirement
orrison-andrew Mar 26, 2025
22aef7d
fixing a build error, with removing queries. Adding newlines to the e…
orrison-andrew Mar 26, 2025
a5fd949
Removing more incydr features from tests
orrison-andrew Mar 26, 2025
6dd1255
Adding newlines, fixing some formatting and style issues.
orrison-andrew Mar 27, 2025
893af6d
Removing further references to incydr features
orrison-andrew Mar 27, 2025
df780cd
Removing unused converters.
orrison-andrew Mar 27, 2025
ce5c903
removed unused import, updated readme, style fixes.
orrison-andrew Mar 27, 2025
23a182c
updating tox.ini
orrison-andrew Mar 27, 2025
d5ae93b
reverting spacing change in tox, removing extra param in test_org_set…
orrison-andrew Mar 27, 2025
1df2eb9
fixing indententation error in test_org_settings
orrison-andrew Mar 27, 2025
893801e
rebuild of test_org_settings
orrison-andrew Mar 27, 2025
90e5e04
style fixes
orrison-andrew Mar 27, 2025
de97708
fixing package reference
orrison-andrew Mar 27, 2025
989dc5c
removing reference to incydr feature
orrison-andrew Mar 27, 2025
d96b1c6
testing adding a doctring to a param
orrison-andrew Mar 27, 2025
184cdbe
reverted docstring
orrison-andrew Mar 27, 2025
c586809
Added param back in
orrison-andrew Mar 27, 2025
10f2637
commiting style changes
orrison-andrew Mar 27, 2025
0278e4e
upgrading dependencies versions for docs
orrison-andrew Mar 27, 2025
b54a8e1
increasing docs packages requirements
orrison-andrew Mar 27, 2025
3effeb2
upgrading contributing doc to mention python 3.11 which is now what's…
orrison-andrew Mar 27, 2025
90643ff
fixing CrashPlan capitalization in docs
orrison-andrew Mar 27, 2025
c86437e
updated readme, removed incydr examples from the basics.md
orrison-andrew Mar 27, 2025
a982345
Finalizing crashplan-conversion bumping version to 1.0.0
orrison-andrew Mar 27, 2025
e987614
fixing path in build script
orrison-andrew Mar 27, 2025
259bdfb
Merge pull request #1 from CrashPlan-Labs/crashplan-conversion
orrison-andrew Apr 2, 2025
3709019
Add environment vars from repo variables to job
NathanGay Apr 23, 2025
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
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ assignees: ''

### Basic Information

- py42 version: <!-- get the version using `pip show py42`-->
- pycpg version: <!-- get the version using `pip show pycpg`-->
- python version: <!-- get the version using `python --version`-->
- operating system:
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Feature request
about: Suggest an idea for py42
about: Suggest an idea for pycpg
title: "[Enhancement] YOUR IDEA!"
labels: enhancement
assignees: ''
Expand Down
23 changes: 10 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,36 @@ on:
tags:
- v*
pull_request:
workflow_dispatch:

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python: [3.9, "3.10", 3.11]
python: ["3.9", "3.10", "3.11"]
env:
CPG_HOST: ${{ vars.CPG_HOST }}
CPG_USER: ${{ vars.CPG_USER }}
CPG_API_CLIENT_ID: ${{ vars.CPG_API_CLIENT_ID }}

steps:
- uses: actions/checkout@v2
with:
path: py42
path: pycpg
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python }}
- name: Install tox
run: pip install tox==3.24.1
- name: Run Unit tests
run: cd py42; tox -e py # Run tox using the version of Python in `PATH`
run: cd pycpg; tox -e py # Run tox using the version of Python in `PATH`
- name: Submit coverage report
uses: codecov/codecov-action@v1.0.7
with:
file: py42/coverage.xml
file: pycpg/coverage.xml
- name: Checkout mock servers
uses: actions/checkout@v2
with:
Expand All @@ -42,19 +47,11 @@ jobs:
sudo tee -a /etc/hosts <<EOF
127.0.0.1 localhost
127.0.0.1 core
127.0.0.1 alerts
127.0.0.1 alert-rules
127.0.0.1 detection-lists
127.0.0.1 audit-log
127.0.0.1 file-events
127.0.0.1 storage
127.0.0.1 preservation-data-service
127.0.0.1 exfiltration-data-service
127.0.0.1 connected-server
127.0.0.1 cases
127.0.0.1 trusted-activities-service
EOF
- name: Start up the mock servers
run: cd code42-mock-servers; docker compose up -d --build
- name: Run the integration testss
run: sleep 15; cd py42; tox -e integration
run: sleep 15; cd pycpg; tox -e integration
33 changes: 0 additions & 33 deletions .github/workflows/cla.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: '3.10'
python-version: '3.11'
- name: Install tox
run: pip install tox==3.24.0
- name: Run style checks
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

The intended audience of this file is for py42 consumers -- as such, changes that don't affect
The intended audience of this file is for pycpg consumers -- as such, changes that don't affect
how a consumer would use the library (e.g. adding unit tests, updating documentation, etc) are not captured here.

## Removed 1.0.0

- As this is the first version of pycpg setting version number to 1.0.0
- Removed Incydr functionality
- Renamed base to pycpg from py42. This tool can now be used by calling py42.sdk.method

## 1.27.3 - 2024-12-18

## Removed
Expand Down
2 changes: 1 addition & 1 deletion CODECLASSIFICATION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CODECLASSIFICATION for py42
# CODECLASSIFICATION for pycpg

# Specify all repository branches as non-production (catch all)
/refs/heads/* non-prod
Expand Down
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @code42/literally-skynet
* @CrashPlan-Labs/crashplan-code-owners
36 changes: 16 additions & 20 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@

## Set up your Development environment

The very first thing to do is to fork the py42 repo, clone it, and make it your working directory!
The very first thing to do is to fork the pycpg repo, clone it, and make it your working directory!

```bash
git clone https://github.com/myaccount/py42
cd py42
git clone https://github.com/myaccount/pycpg
cd pycpg
```

To set up your development environment, create a python virtual environment and activate it. This keeps your dependencies sandboxed so that they are unaffected by (and do not affect) other python packages you may have installed.
Expand All @@ -47,32 +47,32 @@ eval "$(pyenv virtualenv-init -)"
Then, create your virtual environment.

```bash
pyenv install 3.9.10
pyenv virtualenv 3.9.10 py42
pyenv activate py42
pyenv install 3.11
pyenv virtualenv 3.11.11 pycpg
pyenv activate pycpg
```

**Note**: Py42 for end users supports Pythons versions <3.6 and <4 - However due to some of the build dependencies, you'll need a version >=3.7 for your virtual environment. Use `pyenv --versions` to see all versions available for install. There are some known issues installing python 3.6 with pyenv on certain OS.
**Note**: Pycpg for end users supports Pythons versions <3.6 and <4 - However due to some of the build dependencies, you'll need a version >=3.7 for your virtual environment. Use `pyenv --versions` to see all versions available for install. There are some known issues installing python 3.6 with pyenv on certain OS.

If running into issues on Big Sur(Version 11) while installing python 3.6 the below may work

```bash
pyenv install --patch 3.6.14 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch)
```

Use `source deactivate` to exit the virtual environment and `pyenv activate py42` to reactivate it.
Use `source deactivate` to exit the virtual environment and `pyenv activate pycpg` to reactivate it.

### Windows/Linux

Install a version of python 3.6 or higher from [python.org](https://python.org).
Next, in a directory somewhere outside the project, create and activate your virtual environment:

```bash
python -m venv py42
python -m venv pycpg
# macOS/Linux
source py42/bin/activate
source pycpg/bin/activate
# Windows
.\py42\Scripts\Activate
.\pycpg\Scripts\Activate
```

To leave the virtual environment, simply use:
Expand All @@ -82,7 +82,7 @@ deactivate

## Installation

Next, with your virtual environment activated, install py42 and its development dependencies. The `-e` option installs py42 in
Next, with your virtual environment activated, install pycpg and its development dependencies. The `-e` option installs pycpg in
["editable mode"](https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs).

```bash
Expand Down Expand Up @@ -159,8 +159,8 @@ def test_add_one_and_one_equals_two():

#### Integration tests

If not using the mock server, set the environment variables `C42_HOST`, `C42_USER`,
and `C42_PW` with CCA credentials. Otherwise, the integration tests default to using
If not using the mock server, set the environment variables `CPG_HOST`, `CPG_USER`,
and `CPG_PW` with CCA credentials. Otherwise, the integration tests default to using
`http://127.0.0.1:4200`, which is the same address that the mock server is set to run on.

To execute integration tests:
Expand All @@ -176,7 +176,7 @@ Follow [Google's format](https://google.github.io/styleguide/pyguide.html#38-com

### Generating documentation

py42 uses [Sphinx](http://www.sphinx-doc.org/) to generate documentation.
pycpg uses [Sphinx](http://www.sphinx-doc.org/) to generate documentation.

#### Performing a test build

Expand All @@ -186,7 +186,7 @@ To simply test that the documentation build without errors, you can run:
tox -e docs
```

Note that the `myst-parser` dependency that contributes to building the docs requires python 3.7+.
Note that the `myst-parser` and `sphinx` dependency that contributes to building the docs requires python 3.11.

#### Running the docs locally

Expand Down Expand Up @@ -217,8 +217,4 @@ Document all notable consumer-affecting changes in CHANGELOG.md per principles a

When you're satisfied with your changes, open a PR and fill out the pull request template file. We recommend prefixing the name of your branch and/or PR title with `bugfix`, `chore`, or `feature` to help quickly categorize your change. Your unit tests and other checks will run against all supported python versions when you do this.

For contributions from non-Code42 employees, we require you to agree to our [Contributor License Agreement](https://code42.github.io/code42-cla/Code42_Individual_Contributor_License_Agreement).

On submission of your first PR, a GitHub action will run requiring you to reply in a comment with your affirmation of the CLA before the PR will be able to be merged.

A team member should get in contact with you shortly to help merge your PR to completion and get it ready for a release!
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Code42 Software
Copyright (c) 2025 CrashPlan Software

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
55 changes: 28 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
# CrashPlan fork of py42, this will become the official CrashPlan Python SDK

# py42, the official Code42 Python SDK

![Build status](https://github.com/code42/py42/workflows/build/badge.svg)
[![codecov.io](https://codecov.io/github/code42/py42/coverage.svg?branch=main)](https://codecov.io/github/code42/py42?branch=main)
[![versions](https://img.shields.io/pypi/pyversions/py42.svg)](https://pypi.org/project/py42/)

![Build status](https://github.com/CrashPlan-Labs/pycpg/workflows/build/badge.svg)
[![codecov.io](https://codecov.io/github/CrashPlan-Labs/pycpg/coverage.svg?branch=main)](https://codecov.io/github/CrashPlan-Labs/pycpg?branch=main)
[![versions](https://img.shields.io/pypi/pyversions/pycpg.svg)](https://pypi.org/project/pycpg/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Documentation Status](https://readthedocs.org/projects/py42/badge/?version=latest)](https://py42docs.code42.com/en/latest/?badge=latest)
[![Documentation Status](https://readthedocs.org/projects/pycpg/badge/?version=latest)](https://pycpgdocs.crashplan.com/en/latest/?badge=latest)


`py42` is a Python wrapper around the Code42 REST APIs that also provides several other useful utility methods.
It is designed to be used for developing your own tools for working with Code42 data while avoiding the overhead
`pycpg` is a Python wrapper around the CrashPlan REST APIs that also provides several other useful utility methods.
It is designed to be used for developing your own tools for working with CrashPlan data while avoiding the overhead
of session / authentication management.

## Requirements

- Python 3.6.0+
- Code42 Server 6.8.x+ or cloud environment (e.g. console.us.code42.com or crashplan.com)
- CrashPlan Cloud environment (e.g. console.us1.crashplan.com or console.us2.crashplan.com)

## Installation

Run the `setup.py` script to install the py42 package and its dependencies on your system.
Run the `setup.py` script to install the pycpg package and its dependencies on your system.
You will likely need administrative privileges for this.

```bash
$ python setup.py install
```

## Hello, py42
## Hello, pycpg

Here's a simple example to verify the installation and your server/account.

Expand All @@ -39,18 +40,18 @@ $ python
Import a couple essentials

```python
>>> import py42.sdk
>>> import py42.util as util
>>> import pycpg.sdk
>>> import pycpg.util as util
```

Initialize the client.

```python
>>> sdk = py42.sdk.from_local_account("https://console.us.code42.com", "john.doe", "password")
>>> sdk = pycpg.sdk.from_local_account("https://console.us1.crashplan.com", "john.doe", "password")
```
or alternatively
```
>>> sdk = py42.sdk.from_jwt_provider("https://console.us.code42.com", jwt_provider_function)
>>> sdk = pycpg.sdk.from_jwt_provider("https://console.us1.crashplan.com", jwt_provider_function)
```

Get and print your user information.
Expand Down Expand Up @@ -103,12 +104,12 @@ There are a few default settings that affect the behavior of the client.
| debug.logger | Controls logger used | `logging.Logger` with `StreamHandler` sending to `sys.stderr`
| items_per_page | Controls how many items are retrieved per request for methods that loops over several "pages" of items in order to collect them all. | 500

To override these settings, import `py42.settings` and override values as necessary before creating the client.
To override these settings, import `pycpg.settings` and override values as necessary before creating the client.
For example, to disable certificate validation in a dev environment:

```python
import py42.sdk
import py42.settings as settings
import pycpg.sdk
import pycpg.settings as settings
import logging

settings.verify_ssl_certs = False
Expand All @@ -120,17 +121,17 @@ custom_logger.addHandler(handler)
settings.debug.logger = custom_logger
settings.debug.level = logging.DEBUG

sdk = py42.sdk.from_local_account("https://console.us.code42.com", "my_username", "my_password")
sdk = pycpg.sdk.from_local_account("https://console.us1.crashplan.com", "my_username", "my_password")
```

## Usage

The SDK object opens availability to APIs across the Code42 environment, including storage nodes.
The SDK object opens availability to APIs across the CrashPlan environment, including storage nodes.

```python
import py42.sdk
import pycpg.sdk

sdk = py42.sdk.from_local_account("https://console.us.code42.com", "my_username", "my_password")
sdk = pycpg.sdk.from_local_account("https://console.us1.crashplan.com", "my_username", "my_password")

# clients are organized by feature groups and accessible under the sdk object

Expand All @@ -154,17 +155,17 @@ with open("/path/to/my/file", 'wb') as f:
if chunk:
f.write(chunk)

# search file events
from py42.sdk.queries.fileevents.file_event_query import FileEventQuery
from py42.sdk.queries.fileevents.filters import *
# search file events -- deprecated, to be replaced with another example
from pycpg.sdk.queries.fileevents.file_event_query import FileEventQuery
from pycpg.sdk.queries.fileevents.filters import *

query = FileEventQuery.all(MD5.eq("e804d1eb229298b04522c5504b8131f0"))
file_events = sdk.securitydata.search_file_events(query)
```

## Additional Resources

For complete documentation on the Code42 web API that backs this SDK, here are some helpful resources:
For complete documentation on the CrashPlan web API that backs this SDK, here are some helpful resources:

- [Introduction to the Code42 API](https://support.code42.com/Administrator/Cloud/Monitoring_and_managing/Introduction_to_the_Code42_API)
- [Code42 API documentation viewers](https://support.code42.com/Administrator/Cloud/Monitoring_and_managing/Introduction_to_the_Code42_API/Code42_API_documentation_viewer)
- [Introduction to the CrashPlan API](https://support.crashplan.com/hc/en-us/articles/9057001723917--CrashPlan-API-syntax-and-usage)
- [CrashPlan API documentation viewers](https://support.crashplan.com/hc/en-us/articles/9057096803469--CrashPlan-API-documentation-viewer-reference)
Loading
Loading