# Pkg.activate vs Base.set\_active\_project

**URL:** https://discourse.julialang.org/t/pkg-activate-vs-base-set-active-project/131111
**Category:** General Usage
**Tags:** question, pkg
**Created:** [July 27, 2025, 3:59pm UTC](https://discourse.julialang.org/t/pkg-activate-vs-base-set-active-project/131111 "2025-07-27T15:59:14Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [July 27, 2025, 3:59pm UTC](https://discourse.julialang.org/t/pkg-activate-vs-base-set-active-project/131111/1 "2025-07-27T15:59:14Z")

</div>

Can someone please explain the difference between `Pkg.activate` vs `Base.set_active_project` from a practical perspective? I looked at the source and they do slightly different things (besides setting `Base.ACTIVE_PROJECT[]`).

I want to do the following:

1. given a _local path_, which should default to the active project,
2. activate that project,
3. (ideally, check that it is a package, not `test/` or a similar subproject, but I can skip that),
4. run tests, collect coverage,
5. activate the previous project.

All of this with a `try ... finally` to do step 6. if anything fails.

It is unclear which entry functions one should use for this, because they have different effects (eg dealing with `Base.active_project_callbacks`). Surprisingly, the `Pkg.activate(::Function, ::AbstractString)` is the most barebones.

[FWIW, I am revamping the API of LocalCoverage.jl]
