Skip to content

Commit

Permalink
Add content
Browse files Browse the repository at this point in the history
  • Loading branch information
jlapeyre committed Jan 20, 2025
1 parent 2792b87 commit e930b5c
Show file tree
Hide file tree
Showing 12 changed files with 796 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
48 changes: 48 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: CI
on:
push:
branches:
- main
tags: ['*']
pull_request:
workflow_dispatch:
concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created
actions: write
contents: read
strategy:
fail-fast: false
matrix:
version:
- '1.10'
- 'pre'
os:
- ubuntu-latest
# - mac-os-latest
- windows-latest
arch:
- x64
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v5
with:
files: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
16 changes: 16 additions & 0 deletions .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: CompatHelper
on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:
jobs:
CompatHelper:
runs-on: ubuntu-latest
steps:
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}
run: julia -e 'using CompatHelper; CompatHelper.main()'
31 changes: 31 additions & 0 deletions .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: TagBot
on:
issue_comment:
types:
- created
workflow_dispatch:
inputs:
lookback:
default: "3"
permissions:
actions: read
checks: read
contents: write
deployments: read
issues: read
discussions: read
packages: read
pages: read
pull-requests: read
repository-projects: read
security-events: read
statuses: read
jobs:
TagBot:
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
runs-on: ubuntu-latest
steps:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
ssh: ${{ secrets.DOCUMENTER_KEY }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.jl.*.cov
*.jl.cov
*.jl.mem
/Manifest.toml
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) 2024 John Lapeyre <jlapeyre@users.noreply.github.com> and contributors

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.
24 changes: 24 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name = "StackEnvs"
uuid = "6dbe6948-1a74-428b-a0c7-b6033448b207"
authors = ["John Lapeyre <jlapeyre@users.noreply.github.com> and contributors"]
version = "0.1.0"

[deps]
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"

[compat]
Aqua = ">= 0"
TOML = "1.0.3"
JET = ">= 0"
Test = ">= 0"
Pkg = ">= 0"
julia = "1.8"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test", "Aqua", "JET"]
88 changes: 88 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# StackEnvs

[![Build Status](https://github.com/jlapeyre/StackEnvs.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/jlapeyre/StackEnvs.jl/actions/workflows/CI.yml?query=branch%3Amain)
[![Coverage](https://codecov.io/gh/jlapeyre/StackEnvs.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/jlapeyre/StackEnvs.jl)
[![Aqua QA](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)

`StackEnvs` provides tools for minimal management of a shared environment that is meant to be used from your "stacked environment" but never to be active itself.

This is useful if you are developing a package and want to use some other packages without polluting any environment.

It is meant to be used in a script that you `include` when, for example, developing a particular package, and want some other particular
packages to be available.

```julia
using StackEnvs
env = StackEnv("my_env", ["PackA", "PackB"])
ensure_in_stack(env)
```

or more simply,

```julia
using StackEnvs
ensure_in_stack("my_env", ["PackA", "PackB"])
```

After including the script, you can immediately `using PackA`.

> [!WARNING]
> `StackedEnvs` pays no attention to version numbers, uuids. It can't remove any packages. It is useful
for some simple, straightforward, use cases.

> [!WARNING]
> The test suite adds and deletes an environment to your `~/.julia/environments` directory. Something could potentially go wrong causing it
to delete your entire home directory. I've taken some steps to minimize this risk. There is nothing like `rm -r *` in the test. Rather, the
two `toml` files are deleted, then the empty directory is deleted. If any of this should fail, the test suite will fail.

> [!WARNING]
> `StackedEnvs` uses some non-API functions in `Base`. But the way these are used is simple and should be fixable.
### Example

```julia-repl
julia> using StackEnvs
julia> env = StackEnv("my_env", ["StatsBase"])
StackEnv("my_env", [:StatsBase])
julia> env_exists(env)
false
julia> is_in_stack(env)
false
julia> ensure_in_stack(env)
Activating new project at `~/.julia/environments/my_env`
Resolving package versions...
julia> is_in_stack(env)
true
julia> env_exists(env)
true
julia> using StatsBase
julia> push!(env, "ILog2")
2-element Vector{Symbol}:
:StatsBase
:ILog2
julia> ensure_in_stack(env)
Activating project at `~/.julia/environments/my_env`
Resolving package versions...
Updating `~/.julia/environments/my_env/Project.toml`
[2cd5bd5f] + ILog2 v2.0.0
Updating `~/.julia/environments/my_env/Manifest.toml`
[2cd5bd5f] + ILog2 v2.0.0
Activating project at `~/github/jlapeyre/StackEnvs`
StackEnv("my_env", [:StatsBase, :ILog2])
julia> ensure_in_stack(env) # Nothing to do. Returns in 30 micro seconds
StackEnv("my_env", [:StatsBase, :ILog2])
```

<!-- LocalWords: StackEnvs julia env StackEnv PackA StackedEnvs uuids toml repl ILog2
<!-- LocalWords: StatsBase 2cd5bd5f
-->
Loading

2 comments on commit e930b5c

@jlapeyre
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/123353

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.0 -m "<description of version>" e930b5c47b2f169e38644c0d0b9829b11609bfe2
git push origin v0.1.0

Please sign in to comment.