npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@hyperupcall/autoenv

v0.3.0

Published

Magic per-project shell environments

Downloads

115

Readme

Autoenv: Directory-based Environments Build Status

Magic per-project shell environments

Note: you should probably use direnv instead. Simply put, it is higher quality software. But, autoenv is still great, too. Maybe try both? :)

This image sums up the relationship between the two projects, very well:

What is it?

If a directory contains a .env file, it will automatically be executed when you cd into it. When enabled (set AUTOENV_ENABLE_LEAVE to a non-null string), if a directory contains a .env.leave file, it will automatically be executed when you leave it.

This is great for...

  • auto-activating virtualenvs
  • auto-deactivating virtualenvs
  • project-specific environment variables
  • making millions

You can also nest envs within each other. How awesome is that!?

When executing, autoenv, will walk up the directories until the mount point and execute all .env files beginning at the top.

Usage

Follow the white rabbit:

$ echo "echo 'whoa'" > project/.env
$ cd project
whoa

Mind blown GIF

Install

Install it easily:

MacOS using Homebrew

$ brew install autoenv
$ echo "source $(brew --prefix autoenv)/activate.sh" >> ~/.bash_profile

Using Git

$ git clone git://github.com/inishchith/autoenv.git ~/.autoenv
$ echo 'source ~/.autoenv/activate.sh' >> ~/.bashrc

Using AUR

Arch Linux users can install autoenv or autoenv-git with their favorite AUR helper.

You need to source activate.sh in your bashrc afterwards:

$ echo 'source /usr/share/autoenv/activate.sh' >> ~/.bashrc

Note that there was previously a pip installation option, but it is no longer recommended as the package is severely out of date

Configuration

Before sourcing activate.sh, you can set the following variables:

  • AUTOENV_AUTH_FILE: Authorized env files, defaults to ~/.autoenv_authorized
  • AUTOENV_ENV_FILENAME: Name of the .env file, defaults to .env
  • AUTOENV_LOWER_FIRST: Set this variable to a non-null string to flip the order of .env files executed
  • AUTOENV_ENV_LEAVE_FILENAME: Name of the .env.leave file, defaults to .env.leave
  • AUTOENV_ENABLE_LEAVE: Set this to a non-null string in order to enable source env when leaving
  • AUTOENV_ASSUME_YES: Set this variable to a non-null string to silently authorize the initialization of new environments

Shells

autoenv is tested on:

Alternatives

direnv is an excellent alternative to autoenv, and includes the ability to unset environment variables as well. It also supports the fish terminal.

https://direnv.net

Disclaimer

Autoenv overrides cd. If you already do this, invoke autoenv_init within your custom cd after sourcing activate.sh.

Autoenv can be disabled via unset cd if you experience I/O issues with certain file systems, particularly those that are FUSE-based (such as smbnetfs).

Attributions

Autoenv was originally created by @kennethreitz. Ownership was then transfered to @inishchith. As of August 22nd, 2021, Edwin Kofler (@hyperupcall) owns and maintains the project