这是indexloc提供的服务,不要输入任何密码
Skip to content
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
10 changes: 4 additions & 6 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:
- 'main'

env:
POETRY_VIRTUALENVS_IN_PROJECT: "true"
# Force nox to produce colorful logs:
FORCE_COLOR: "true"

Expand All @@ -19,8 +18,8 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up runner
uses: opendp/tumult-tools/actions/setup@8c782791336723e50fa70576a220b7aa023b2864
- run: poetry run nox -s build
uses: opendp/tumult-tools/actions/setup@0f3d49599e5824a9f407a6e2063990c1e0d4c2e8
- run: uv run nox -s build
- name: Archive packaged library
uses: actions/upload-artifact@v4
with:
Expand All @@ -35,7 +34,7 @@ jobs:
- name: Checkout code repository
uses: actions/checkout@v4
- name: Set up runner
uses: opendp/tumult-tools/actions/setup@8c782791336723e50fa70576a220b7aa023b2864
uses: opendp/tumult-tools/actions/setup@0f3d49599e5824a9f407a6e2063990c1e0d4c2e8
- name: Download dist
uses: actions/download-artifact@v4
with:
Expand All @@ -44,7 +43,7 @@ jobs:
- name: Get commit
id: commit
run: echo "COMMIT=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- run: poetry run nox -s docs
- run: uv run nox -s docs
- run: rm -r public/.doctrees
- name: Checkout docs repository
uses: actions/checkout@v4
Expand All @@ -64,4 +63,3 @@ jobs:
git add docs/analytics/dev
git commit -m "[auto] Publish docs for dev ($COMMIT)"
git push

2 changes: 0 additions & 2 deletions .github/workflows/dummy_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ name: PR Dummy Pipeline

on:
pull_request:


env:
POETRY_VIRTUALENVS_IN_PROJECT: "true"
# Force nox to produce colorful logs:
FORCE_COLOR: "true"

Expand Down
19 changes: 9 additions & 10 deletions .github/workflows/merge_queue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:


env:
POETRY_VIRTUALENVS_IN_PROJECT: "true"
# Force nox to produce colorful logs:
FORCE_COLOR: "true"

Expand All @@ -18,8 +17,8 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up runner
uses: opendp/tumult-tools/actions/setup@8c782791336723e50fa70576a220b7aa023b2864
- run: poetry run nox -s build
uses: opendp/tumult-tools/actions/setup@0f3d49599e5824a9f407a6e2063990c1e0d4c2e8
- run: uv run nox -s build
- name: Archive packaged library
uses: actions/upload-artifact@v4
with:
Expand All @@ -32,42 +31,42 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up runner
uses: opendp/tumult-tools/actions/setup@8c782791336723e50fa70576a220b7aa023b2864
uses: opendp/tumult-tools/actions/setup@0f3d49599e5824a9f407a6e2063990c1e0d4c2e8
- name: Download dist
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- run: poetry check --lock
- run: poetry run nox -t lint
- run: uv lock --check
- run: uv run nox -t lint
Test:
runs-on: ubuntu-latest
needs: Package
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up runner
uses: opendp/tumult-tools/actions/setup@8c782791336723e50fa70576a220b7aa023b2864
uses: opendp/tumult-tools/actions/setup@0f3d49599e5824a9f407a6e2063990c1e0d4c2e8
- name: Download dist
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- run: poetry run nox -s smoketest test-doctest test-fast
- run: uv run nox -s smoketest test-doctest test-fast
Docs:
runs-on: ubuntu-latest
needs: Package
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up runner
uses: opendp/tumult-tools/actions/setup@8c782791336723e50fa70576a220b7aa023b2864
uses: opendp/tumult-tools/actions/setup@0f3d49599e5824a9f407a6e2063990c1e0d4c2e8
- name: Download dist
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- run: poetry run nox -t docs
- run: uv run nox -t docs
- run: rm -r public/.doctrees
- name: Archive docs
uses: actions/upload-artifact@v4
Expand Down
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

doc/*/reference/api/
# Auto-populated version file
src/tmlt/analytics/_version.py

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down Expand Up @@ -81,9 +82,6 @@ target/
.ipynb_checkpoints
*.nbconvert.ipynb

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.9
11 changes: 6 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ First, let us know what you would like to contribute. Feel free to:

### Installation

We recommend using the lowest supported Python version for local development. Tools like [pyenv](https://github.com/pyenv/pyenv) may be useful for managing your Python version.
We use [`uv`](https://docs.astral.sh/uv/) for dependency management during development. To set up your environment, install `uv` by following its [installation instructions](https://docs.astral.sh/uv/getting-started/installation/), then install the prerequisites listed in the [Tumult Analytics installation instructions](https://opendp.github.io/tumult-docs/analytics/latest/installation.html#prerequisites), and finally install our dev dependencies by running `uv sync` from the root of this repository.

We use [Poetry](https://python-poetry.org/) for dependency management during development. To set up your environment, start by installing the prerequisites listed in the [installation instructions](https://docs.tmlt.dev/platform/latest/installation.html#prerequisites), then install Poetry by following the [installation instructions](https://python-poetry.org/docs/#installation), and finally install our dev dependencies by running `poetry install` from the root of this repository.
To minimize compatibility issues, doing development on the oldest supported Python minor version (currently 3.9) is strongly recommended.
If you are using `uv` to manage your Python installations, running `uv sync` without an existing virtual environment should automatically install and use an appropriate Python version.

### Basic usage

Expand All @@ -31,20 +32,20 @@ from the repository root directory.

Note that some operating systems, including macOS, include versions of `make` that are too old to run this project's [Makefile](./Makefile) correctly. macOS users should [install a newer version of make using Homebrew](https://formulae.brew.sh/formula/make#default).

Behind the scenes, these commands use the Poetry environment, and rely on [nox](https://nox.thea.codes/en/stable/index.html) for test automation. You can get a bit more fine-grained control and access additional tools by running nox commands directly (see [this tutorial](https://nox.thea.codes/en/stable/tutorial.html)). You can find a list of available nox sessions using `poetry run nox --list`, then run one of these sessions using e.g. `poetry run nox -s test-fast`.
Behind the scenes, these commands use the `uv` environment, and rely on [nox](https://nox.thea.codes/en/stable/index.html) for test automation. You can get a bit more fine-grained control and access additional tools by running nox commands directly (see [this tutorial](https://nox.thea.codes/en/stable/tutorial.html)). You can find a list of available nox sessions using `uv run nox --list`, then run one of these sessions using e.g. `uv run nox -s test-fast`.

### Testing

Our unit tests are run with [pytest](https://docs.pytest.org/en/stable/getting-started.html). You can run smaller subsets of tests by using pytest directly. For example, to check tests in a particular test file, run:

```bash
poetry run pytest test/unit/a_test_file.py
uv run pytest test/unit/a_test_file.py
```

You can also filter to specific tests or specific groups of tests using [pytest filters](https://docs.pytest.org/en/stable/how-to/usage.html#specifying-which-tests-to-run). We tag all of our longest-running tests with the `slow` tag, so they can be skipped easily when you want faster feedback (though make sure they pass before you submit!):

```bash
poetry run pytest -m "not slow"
uv run pytest -m "not slow"
```

### Documentation
Expand Down
10 changes: 4 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ SHELL = /bin/bash

# Run all linters
lint:
poetry run nox --no-venv -t lint
uv run nox --no-venv -t lint

# Run all tests
test:
poetry run nox --no-venv -s smoketest test-fast test-slow test-doctest docs-doctest
uv run nox --no-venv -s smoketest test-fast test-slow test-doctest docs-doctest

# Builds the docs and checks links
docs:
poetry run nox --no-venv -s docs docs-linkcheck
uv run nox --no-venv -s docs docs-linkcheck

# Builds the source distribution and wheels
package:
poetry run nox --no-venv -s build
uv run nox --no-venv -s build

# The scripts generate a bunch of junk in the repository that isn't generally
# useful to keep around. This cleans up all of those files/directories.
Expand Down Expand Up @@ -58,5 +58,3 @@ clean:
if [[ "$$CLEAN" = "y" || "$$CLEAN" = "yes" ]]; then
git clean -x -f -- $(foreach f, $(clean-files),'$(f)')
fi


2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ If you have any questions, feedback, or feature requests, please reach out via t
We welcome external volunteers! If you are interested in contributing, please
let us know on [Slack][slack].

See [CONTRIBUTING.md](https://gitlab.com/tumult-labs/analytics/-/blob/dev/CONTRIBUTING.md) for information about installing our development dependencies and running tests.
See [CONTRIBUTING.md](https://github.com/opendp/tumult-analytics/blob/main/CONTRIBUTING.md) for information about installing our development dependencies and running tests.

## Citing Tumult Analytics

Expand Down
21 changes: 0 additions & 21 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,27 +79,6 @@
"keyset_cross_product_per_factors": 24,
}


def install_overrides(session):
"""Custom logic run after installing the current package."""
# Install Core from dist/, if it exists there
if os.environ.get("CORE_WHEEL_DIR"):
core_path = Path(os.environ["CORE_WHEEL_DIR"]).resolve()
core_wheels = list(core_path.glob("*tmlt_core*-cp39*"))
if len(core_wheels) == 0:
raise AssertionError(
"Expected a core wheel since CORE_WHEEL_DIR was set "
f"(to {os.environ.get('CORE_WHEEL_DIR')}), but didn't find any. "
f"Instead, found these files in {str(core_path)}: "
+ "\n".join([str(path) for path in core_path.glob("*")])
)
# Poetry is going to expect, and require, Core version X.Y.Z (ex. "0.6.2"),
# but the Gitlab-built Core will have a version number
# X.Y.Z-<some other stuff>-<git commit hash>
# (ex. "0.6.2-post11+ea346f3")
# This overrides Poetry's dependencies with our own
session.poetry.session.install(str(core_wheels[0]))

sm = SessionManager(
package=PACKAGE_NAME,
directory=CWD,
Expand Down
Loading